forked from grblHAL/core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.c
3045 lines (2499 loc) · 121 KB
/
settings.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
settings.c - non-volatile storage configuration handling
Part of grblHAL
Copyright (c) 2017-2024 Terje Io
Copyright (c) 2011-2015 Sungeun K. Jeon
Copyright (c) 2009-2011 Simen Svale Skogsrud
grblHAL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
grblHAL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with grblHAL. If not, see <http://www.gnu.org/licenses/>.
*/
#include <math.h>
#include <string.h>
#include <stdint.h>
#include <stdbool.h>
#include <assert.h>
#include "hal.h"
#include "config.h"
#include "machine_limits.h"
#include "nvs_buffer.h"
#include "tool_change.h"
#include "state_machine.h"
#if ENABLE_BACKLASH_COMPENSATION
#include "motion_control.h"
#endif
#if ENABLE_SPINDLE_LINEARIZATION
#include <stdio.h>
#endif
settings_t settings;
static const control_signals_t limits_override = { .limits_override = On };
const settings_restore_t settings_all = {
.defaults = SETTINGS_RESTORE_DEFAULTS,
.parameters = SETTINGS_RESTORE_PARAMETERS,
.startup_lines = SETTINGS_RESTORE_STARTUP_LINES,
.build_info = SETTINGS_RESTORE_BUILD_INFO,
.driver_parameters = SETTINGS_RESTORE_DRIVER_PARAMETERS
};
PROGMEM const settings_t defaults = {
.version = SETTINGS_VERSION,
#if DEFAULT_LASER_MODE
.mode = Mode_Laser,
#elif DEFAULT_LATHE_MODE
.mode = Mode_Lathe,
#else
.mode = Mode_Standard,
#endif
.junction_deviation = DEFAULT_JUNCTION_DEVIATION,
.arc_tolerance = DEFAULT_ARC_TOLERANCE,
.g73_retract = DEFAULT_G73_RETRACT,
.report_interval = DEFAULT_AUTOREPORT_INTERVAL,
.timezone = DEFAULT_TIMEZONE_OFFSET,
.planner_buffer_blocks = DEFAULT_PLANNER_BUFFER_BLOCKS,
.flags.legacy_rt_commands = DEFAULT_LEGACY_RTCOMMANDS,
.flags.report_inches = DEFAULT_REPORT_INCHES,
.flags.sleep_enable = DEFAULT_SLEEP_ENABLE && SLEEP_DURATION > 0.0f,
.flags.compatibility_level = COMPATIBILITY_LEVEL,
#if DEFAULT_DISABLE_G92_PERSISTENCE
.flags.g92_is_volatile = 1,
#else
.flags.g92_is_volatile = 0,
#endif
.flags.disable_laser_during_hold = DEFAULT_DISABLE_LASER_DURING_HOLD,
.flags.restore_after_feed_hold = DEFAULT_RESTORE_AFTER_FEED_HOLD,
.flags.force_initialization_alarm = DEFAULT_FORCE_INITIALIZATION_ALARM,
.flags.restore_overrides = DEFAULT_RESET_OVERRIDES,
.flags.no_restore_position_after_M6 = DEFAULT_TOOLCHANGE_NO_RESTORE_POSITION,
.probe.disable_probe_pullup = DEFAULT_PROBE_SIGNAL_DISABLE_PULLUP,
.probe.allow_feed_override = DEFAULT_ALLOW_FEED_OVERRIDE_DURING_PROBE_CYCLES,
.probe.invert_probe_pin = DEFAULT_PROBE_SIGNAL_INVERT,
.steppers.pulse_microseconds = DEFAULT_STEP_PULSE_MICROSECONDS,
.steppers.pulse_delay_microseconds = DEFAULT_STEP_PULSE_DELAY,
.steppers.idle_lock_time = DEFAULT_STEPPER_IDLE_LOCK_TIME,
.steppers.step_invert.mask = DEFAULT_STEP_SIGNALS_INVERT_MASK,
.steppers.dir_invert.mask = DEFAULT_DIR_SIGNALS_INVERT_MASK,
.steppers.ganged_dir_invert.mask = DEFAULT_GANGED_DIRECTION_INVERT_MASK,
#if COMPATIBILITY_LEVEL <= 2
.steppers.enable_invert.mask = DEFAULT_ENABLE_SIGNALS_INVERT_MASK,
#elif DEFAULT_ENABLE_SIGNALS_INVERT_MASK
.steppers.enable_invert.mask = 0,
#else
.steppers.enable_invert.mask = AXES_BITMASK,
#endif
.steppers.deenergize.mask = DEFAULT_STEPPER_DEENERGIZE_MASK,
#if N_AXIS > 3
.steppers.is_rotary.mask = (DEFAULT_AXIS_ROTATIONAL_MASK & AXES_BITMASK) & 0b11111000,
.steppers.rotary_wrap.mask = (DEFAULT_AXIS_ROTARY_WRAP_MASK & AXES_BITMASK) & 0b11111000,
#endif
#if DEFAULT_HOMING_ENABLE
.homing.flags.enabled = DEFAULT_HOMING_ENABLE,
.homing.flags.init_lock = DEFAULT_HOMING_INIT_LOCK,
.homing.flags.single_axis_commands = DEFAULT_HOMING_SINGLE_AXIS_COMMANDS,
.homing.flags.force_set_origin = DEFAULT_HOMING_FORCE_SET_ORIGIN,
.homing.flags.manual = DEFAULT_HOMING_ALLOW_MANUAL,
.homing.flags.override_locks = DEFAULT_HOMING_OVERRIDE_LOCKS,
.homing.flags.keep_on_reset = DEFAULT_HOMING_KEEP_STATUS_ON_RESET,
.homing.flags.use_limit_switches = DEFAULT_HOMING_USE_LIMIT_SWITCHES,
#else
.homing.flags.value = 0,
#endif
.homing.dir_mask.value = DEFAULT_HOMING_DIR_MASK,
.homing.feed_rate = DEFAULT_HOMING_FEED_RATE,
.homing.seek_rate = DEFAULT_HOMING_SEEK_RATE,
.homing.debounce_delay = DEFAULT_HOMING_DEBOUNCE_DELAY,
.homing.pulloff = DEFAULT_HOMING_PULLOFF,
.homing.locate_cycles = DEFAULT_N_HOMING_LOCATE_CYCLE,
.homing.cycle[0].mask = DEFAULT_HOMING_CYCLE_0,
.homing.cycle[1].mask = DEFAULT_HOMING_CYCLE_1,
.homing.cycle[2].mask = DEFAULT_HOMING_CYCLE_2,
.homing.dual_axis.fail_length_percent = DEFAULT_DUAL_AXIS_HOMING_FAIL_AXIS_LENGTH_PERCENT,
.homing.dual_axis.fail_distance_min = DEFAULT_DUAL_AXIS_HOMING_FAIL_DISTANCE_MIN,
.homing.dual_axis.fail_distance_max = DEFAULT_DUAL_AXIS_HOMING_FAIL_DISTANCE_MAX,
.home_invert.mask = DEFAULT_HOME_SIGNALS_INVERT_MASK,
.status_report.machine_position = DEFAULT_REPORT_MACHINE_POSITION,
.status_report.buffer_state = DEFAULT_REPORT_BUFFER_STATE,
.status_report.line_numbers = DEFAULT_REPORT_LINE_NUMBERS,
.status_report.feed_speed = DEFAULT_REPORT_CURRENT_FEED_SPEED,
.status_report.pin_state = DEFAULT_REPORT_PIN_STATE,
.status_report.work_coord_offset = DEFAULT_REPORT_WORK_COORD_OFFSET,
.status_report.overrides = DEFAULT_REPORT_OVERRIDES,
.status_report.probe_coordinates = DEFAULT_REPORT_PROBE_COORDINATES,
.status_report.sync_on_wco_change = DEFAULT_REPORT_SYNC_ON_WCO_CHANGE,
.status_report.parser_state = DEFAULT_REPORT_PARSER_STATE,
.status_report.alarm_substate = DEFAULT_REPORT_ALARM_SUBSTATE,
.status_report.run_substate = DEFAULT_REPORT_RUN_SUBSTATE,
.status_report.when_homing = DEFAULT_REPORT_WHEN_HOMING,
.limits.flags.hard_enabled = DEFAULT_HARD_LIMIT_ENABLE,
.limits.flags.soft_enabled = DEFAULT_SOFT_LIMIT_ENABLE,
.limits.flags.jog_soft_limited = DEFAULT_JOG_LIMIT_ENABLE,
.limits.flags.check_at_init = DEFAULT_CHECK_LIMITS_AT_INIT,
.limits.flags.hard_disabled_rotary = DEFAULT_HARD_LIMITS_DISABLE_FOR_ROTARY,
.limits.flags.two_switches = DEFAULT_LIMITS_TWO_SWITCHES_ON_AXES,
.limits.invert.mask = DEFAULT_LIMIT_SIGNALS_INVERT_MASK,
.limits.disable_pullup.mask = DEFAULT_LIMIT_SIGNALS_PULLUP_DISABLE_MASK,
.control_invert.mask = DEFAULT_CONTROL_SIGNALS_INVERT_MASK,
.control_disable_pullup.mask = DEFAULT_DISABLE_CONTROL_PINS_PULL_UP_MASK,
.spindle.rpm_max = DEFAULT_SPINDLE_RPM_MAX,
.spindle.rpm_min = DEFAULT_SPINDLE_RPM_MIN,
.spindle.flags.pwm_disable = false,
.spindle.flags.enable_rpm_controlled = DEFAULT_SPINDLE_ENABLE_OFF_WITH_ZERO_SPEED,
.spindle.invert.on = DEFAULT_INVERT_SPINDLE_ENABLE_PIN,
.spindle.invert.ccw = DEFAULT_INVERT_SPINDLE_CCW_PIN,
.spindle.invert.pwm = DEFAULT_INVERT_SPINDLE_PWM_PIN,
.spindle.pwm_freq = DEFAULT_SPINDLE_PWM_FREQ,
.spindle.pwm_off_value = DEFAULT_SPINDLE_PWM_OFF_VALUE,
.spindle.pwm_min_value = DEFAULT_SPINDLE_PWM_MIN_VALUE,
.spindle.pwm_max_value = DEFAULT_SPINDLE_PWM_MAX_VALUE,
.spindle.at_speed_tolerance = DEFAULT_SPINDLE_AT_SPEED_TOLERANCE,
.spindle.ppr = DEFAULT_SPINDLE_PPR,
.spindle.pid.p_gain = DEFAULT_SPINDLE_P_GAIN,
.spindle.pid.i_gain = DEFAULT_SPINDLE_I_GAIN,
.spindle.pid.d_gain = DEFAULT_SPINDLE_D_GAIN,
.spindle.pid.i_max_error = DEFAULT_SPINDLE_I_MAX,
#if ENABLE_SPINDLE_LINEARIZATION
#if SPINDLE_NPWM_PIECES > 0
.spindle.pwm_piece[0] = { .rpm = DEFAULT_RPM_POINT01, .start = DEFAULT_RPM_LINE_A1, .end = DEFAULT_RPM_LINE_B1 },
#endif
#if SPINDLE_NPWM_PIECES > 1
.spindle.pwm_piece[1] = { .rpm = DEFAULT_RPM_POINT12, .start = DEFAULT_RPM_LINE_A2, .end = DEFAULT_RPM_LINE_B2 },
#endif
#if SPINDLE_NPWM_PIECES > 2
.spindle.pwm_piece[2] = { .rpm = DEFAULT_RPM_POINT23, .start = DEFAULT_RPM_LINE_A3, .end = DEFAULT_RPM_LINE_B3 },
#endif
#if SPINDLE_NPWM_PIECES > 3
.spindle.pwm_piece[3] = { .rpm = DEFAULT_RPM_POINT34, .start = DEFAULT_RPM_LINE_A4, .end = DEFAULT_RPM_LINE_B4 },
#endif
#else
#if SPINDLE_NPWM_PIECES > 0
.spindle.pwm_piece[0] = { .rpm = NAN, .start = 0.0f, .end = 0.0f },
#endif
#if SPINDLE_NPWM_PIECES > 1
.spindle.pwm_piece[1] = { .rpm = NAN, .start = 0.0f, .end = 0.0f },
#endif
#if SPINDLE_NPWM_PIECES > 2
.spindle.pwm_piece[2] = { .rpm = NAN, .start = 0.0f, .end = 0.0f },
#endif
#if SPINDLE_NPWM_PIECES > 3
.spindle.pwm_piece[3] = { .rpm = NAN, .start = 0.0f, .end = 0.0f },
#endif
#endif
.coolant_invert.flood = DEFAULT_INVERT_COOLANT_FLOOD_PIN,
.coolant_invert.mist = DEFAULT_INVERT_COOLANT_MIST_PIN,
.axis[X_AXIS].steps_per_mm = DEFAULT_X_STEPS_PER_MM,
.axis[X_AXIS].max_rate = DEFAULT_X_MAX_RATE,
.axis[X_AXIS].acceleration = (DEFAULT_X_ACCELERATION * 60.0f * 60.0f),
.axis[X_AXIS].max_travel = (-DEFAULT_X_MAX_TRAVEL),
.axis[X_AXIS].dual_axis_offset = 0.0f,
#if ENABLE_BACKLASH_COMPENSATION
.axis[X_AXIS].backlash = 0.0f,
#endif
.axis[Y_AXIS].steps_per_mm = DEFAULT_Y_STEPS_PER_MM,
.axis[Y_AXIS].max_rate = DEFAULT_Y_MAX_RATE,
.axis[Y_AXIS].max_travel = (-DEFAULT_Y_MAX_TRAVEL),
.axis[Y_AXIS].acceleration = (DEFAULT_Y_ACCELERATION * 60.0f * 60.0f),
.axis[Y_AXIS].dual_axis_offset = 0.0f,
#if ENABLE_BACKLASH_COMPENSATION
.axis[Y_AXIS].backlash = 0.0f,
#endif
.axis[Z_AXIS].steps_per_mm = DEFAULT_Z_STEPS_PER_MM,
.axis[Z_AXIS].max_rate = DEFAULT_Z_MAX_RATE,
.axis[Z_AXIS].acceleration = (DEFAULT_Z_ACCELERATION * 60.0f * 60.0f),
.axis[Z_AXIS].max_travel = (-DEFAULT_Z_MAX_TRAVEL),
.axis[Z_AXIS].dual_axis_offset = 0.0f,
#if ENABLE_BACKLASH_COMPENSATION
.axis[Z_AXIS].backlash = 0.0f,
#endif
#ifdef A_AXIS
.axis[A_AXIS].steps_per_mm = DEFAULT_A_STEPS_PER_MM,
.axis[A_AXIS].max_rate = DEFAULT_A_MAX_RATE,
.axis[A_AXIS].acceleration =(DEFAULT_A_ACCELERATION * 60.0f * 60.0f),
.axis[A_AXIS].max_travel = (-DEFAULT_A_MAX_TRAVEL),
.axis[A_AXIS].dual_axis_offset = 0.0f,
#if ENABLE_BACKLASH_COMPENSATION
.axis[A_AXIS].backlash = 0.0f,
#endif
.homing.cycle[3].mask = DEFAULT_HOMING_CYCLE_3,
#endif
#ifdef B_AXIS
.axis[B_AXIS].steps_per_mm = DEFAULT_B_STEPS_PER_MM,
.axis[B_AXIS].max_rate = DEFAULT_B_MAX_RATE,
.axis[B_AXIS].acceleration = (DEFAULT_B_ACCELERATION * 60.0f * 60.0f),
.axis[B_AXIS].max_travel = (-DEFAULT_B_MAX_TRAVEL),
.axis[B_AXIS].dual_axis_offset = 0.0f,
#if ENABLE_BACKLASH_COMPENSATION
.axis[B_AXIS].backlash = 0.0f,
#endif
.homing.cycle[4].mask = DEFAULT_HOMING_CYCLE_4,
#endif
#ifdef C_AXIS
.axis[C_AXIS].steps_per_mm = DEFAULT_C_STEPS_PER_MM,
.axis[C_AXIS].acceleration = (DEFAULT_C_ACCELERATION * 60.0f * 60.0f),
.axis[C_AXIS].max_rate = DEFAULT_C_MAX_RATE,
.axis[C_AXIS].max_travel = (-DEFAULT_C_MAX_TRAVEL),
.axis[C_AXIS].dual_axis_offset = 0.0f,
#if ENABLE_BACKLASH_COMPENSATION
.axis[C_AXIS].backlash = 0.0f,
#endif
.homing.cycle[5].mask = DEFAULT_HOMING_CYCLE_5,
#endif
#ifdef U_AXIS
.axis[U_AXIS].steps_per_mm = DEFAULT_U_STEPS_PER_MM,
.axis[U_AXIS].acceleration = (DEFAULT_U_ACCELERATION * 60.0f * 60.0f),
.axis[U_AXIS].max_rate = DEFAULT_U_MAX_RATE,
.axis[U_AXIS].max_travel = (-DEFAULT_U_MAX_TRAVEL),
.axis[U_AXIS].dual_axis_offset = 0.0f,
#if ENABLE_BACKLASH_COMPENSATION
.axis[U_AXIS].backlash = 0.0f,
#endif
#endif
#ifdef V_AXIS
.axis[V_AXIS].steps_per_mm = DEFAULT_V_STEPS_PER_MM,
.axis[V_AXIS].acceleration = (DEFAULT_V_ACCELERATION * 60.0f * 60.0f),
.axis[V_AXIS].max_rate = DEFAULT_V_MAX_RATE,
.axis[V_AXIS].max_travel = (-DEFAULT_V_MAX_TRAVEL),
.axis[V_AXIS].dual_axis_offset = 0.0f,
#if ENABLE_BACKLASH_COMPENSATION
.axis[V_AXIS].backlash = 0.0f,
#endif
#endif
.tool_change.mode = (toolchange_mode_t)DEFAULT_TOOLCHANGE_MODE,
.tool_change.probing_distance = DEFAULT_TOOLCHANGE_PROBING_DISTANCE,
.tool_change.feed_rate = DEFAULT_TOOLCHANGE_FEED_RATE,
.tool_change.seek_rate = DEFAULT_TOOLCHANGE_SEEK_RATE,
.tool_change.pulloff_rate = DEFAULT_TOOLCHANGE_PULLOFF_RATE,
.parking.flags.enabled = DEFAULT_PARKING_ENABLE,
.parking.flags.deactivate_upon_init = DEFAULT_DEACTIVATE_PARKING_UPON_INIT,
.parking.flags.enable_override_control= DEFAULT_ENABLE_PARKING_OVERRIDE_CONTROL,
.parking.axis = DEFAULT_PARKING_AXIS,
.parking.target = DEFAULT_PARKING_TARGET,
.parking.rate = DEFAULT_PARKING_RATE,
.parking.pullout_rate = DEFAULT_PARKING_PULLOUT_RATE,
.parking.pullout_increment = DEFAULT_PARKING_PULLOUT_INCREMENT,
.safety_door.flags.ignore_when_idle = DEFAULT_DOOR_IGNORE_WHEN_IDLE,
.safety_door.flags.keep_coolant_on = DEFAULT_DOOR_KEEP_COOLANT_ON,
.safety_door.spindle_on_delay = DEFAULT_SAFETY_DOOR_SPINDLE_DELAY,
.safety_door.coolant_on_delay = DEFAULT_SAFETY_DOOR_COOLANT_DELAY
};
static bool group_is_available (const setting_group_detail_t *group)
{
return true;
}
PROGMEM static const setting_group_detail_t setting_group_detail [] = {
{ Group_Root, Group_Root, "Root", group_is_available },
{ Group_Root, Group_General, "General", group_is_available },
{ Group_Root, Group_ControlSignals, "Control signals" },
{ Group_Root, Group_Limits, "Limits" },
{ Group_Limits, Group_Limits_DualAxis, "Dual axis" },
{ Group_Root, Group_Coolant, "Coolant" },
{ Group_Root, Group_Spindle, "Spindle" },
{ Group_Spindle, Group_Spindle_Sync, "Spindle sync" },
{ Group_Root, Group_Toolchange, "Tool change" },
{ Group_Root, Group_Homing, "Homing" },
{ Group_Root, Group_Probing, "Probing" },
{ Group_Root, Group_SafetyDoor, "Safety door" },
{ Group_Root, Group_Jogging, "Jogging"},
{ Group_Root, Group_Stepper, "Stepper" },
{ Group_Root, Group_MotorDriver, "Stepper driver" },
{ Group_Root, Group_Axis, "Axis", group_is_available },
{ Group_Axis, Group_XAxis, "X-axis", group_is_available },
{ Group_Axis, Group_YAxis, "Y-axis", group_is_available },
{ Group_Axis, Group_ZAxis, "Z-axis", group_is_available },
#if !AXIS_REMAP_ABC2UVW
#ifdef A_AXIS
{ Group_Axis, Group_AAxis, "A-axis", group_is_available },
#endif
#ifdef B_AXIS
{ Group_Axis, Group_BAxis, "B-axis", group_is_available },
#endif
#ifdef C_AXIS
{ Group_Axis, Group_CAxis, "C-axis", group_is_available },
#endif
#ifdef U_AXIS
{ Group_Axis, Group_UAxis, "U-axis", group_is_available },
#endif
#ifdef V_AXIS
{ Group_Axis, Group_VAxis, "V-axis", group_is_available }
#endif
#else
#ifdef A_AXIS
{ Group_Axis, Group_AAxis, "U-axis", group_is_available },
#endif
#ifdef B_AXIS
{ Group_Axis, Group_BAxis, "V-axis", group_is_available },
#endif
#ifdef C_AXIS
{ Group_Axis, Group_CAxis, "W-axis", group_is_available },
#endif
#endif
};
static status_code_t set_probe_invert (setting_id_t id, uint_fast16_t int_value);
static status_code_t set_report_mask (setting_id_t id, uint_fast16_t int_value);
static status_code_t set_report_inches (setting_id_t id, uint_fast16_t int_value);
static status_code_t set_control_invert (setting_id_t id, uint_fast16_t int_value);
static status_code_t set_spindle_invert (setting_id_t id, uint_fast16_t int_value);
static status_code_t set_pwm_mode (setting_id_t id, uint_fast16_t int_value);
static status_code_t set_pwm_options (setting_id_t id, uint_fast16_t int_value);
static status_code_t set_spindle_type (setting_id_t id, uint_fast16_t int_value);
static status_code_t set_encoder_spindle (setting_id_t id, uint_fast16_t int_value);
static status_code_t set_control_disable_pullup (setting_id_t id, uint_fast16_t int_value);
static status_code_t set_probe_disable_pullup (setting_id_t id, uint_fast16_t int_value);
static status_code_t set_soft_limits_enable (setting_id_t id, uint_fast16_t int_value);
static status_code_t set_hard_limits_enable (setting_id_t id, uint_fast16_t int_value);
static status_code_t set_jog_soft_limited (setting_id_t id, uint_fast16_t int_value);
static status_code_t set_homing_enable (setting_id_t id, uint_fast16_t int_value);
static status_code_t set_enable_legacy_rt_commands (setting_id_t id, uint_fast16_t int_value);
static status_code_t set_homing_cycle (setting_id_t id, uint_fast16_t int_value);
#if !LATHE_UVW_OPTION
static status_code_t set_mode (setting_id_t id, uint_fast16_t int_value);
#endif
static status_code_t set_sleep_enable (setting_id_t id, uint_fast16_t int_value);
static status_code_t set_hold_actions (setting_id_t id, uint_fast16_t int_value);
static status_code_t set_force_initialization_alarm (setting_id_t id, uint_fast16_t int_value);
static status_code_t set_probe_allow_feed_override (setting_id_t id, uint_fast16_t int_value);
static status_code_t set_tool_change_mode (setting_id_t id, uint_fast16_t int_value);
static status_code_t set_tool_change_probing_distance (setting_id_t id, float value);
static status_code_t set_tool_restore_pos (setting_id_t id, uint_fast16_t int_value);
static status_code_t set_ganged_dir_invert (setting_id_t id, uint_fast16_t int_value);
static status_code_t set_stepper_deenergize_mask (setting_id_t id, uint_fast16_t int_value);
static status_code_t set_report_interval (setting_id_t setting, uint_fast16_t int_value);
static status_code_t set_estop_unlock (setting_id_t id, uint_fast16_t int_value);
#if COMPATIBILITY_LEVEL <= 1
static status_code_t set_offset_lock (setting_id_t id, uint_fast16_t int_value);
#endif
#ifndef NO_SAFETY_DOOR_SUPPORT
static status_code_t set_parking_enable (setting_id_t id, uint_fast16_t int_value);
static status_code_t set_restore_overrides (setting_id_t id, uint_fast16_t int_value);
#endif
#if ENABLE_SPINDLE_LINEARIZATION
static status_code_t set_linear_piece (setting_id_t id, char *svalue);
static char *get_linear_piece (setting_id_t id);
#endif
#if N_AXIS > 3
static status_code_t set_rotary_axes (setting_id_t id, uint_fast16_t int_value);
static status_code_t set_rotary_wrap_axes (setting_id_t id, uint_fast16_t int_value);
#endif
#if COMPATIBILITY_LEVEL > 2
static status_code_t set_enable_invert_mask (setting_id_t id, uint_fast16_t int_value);
#endif
#if COMPATIBILITY_LEVEL > 1
static status_code_t set_limits_invert_mask (setting_id_t id, uint_fast16_t int_value);
#endif
static status_code_t set_axis_setting (setting_id_t setting, float value);
#if COMPATIBILITY_LEVEL <= 1
static status_code_t set_g92_disable_persistence (setting_id_t id, uint_fast16_t int_value);
#endif
static float get_float (setting_id_t setting);
static uint32_t get_int (setting_id_t id);
static bool is_setting_available (const setting_detail_t *setting);
static bool is_group_available (const setting_detail_t *setting);
#if NGC_EXPRESSIONS_ENABLE
static status_code_t set_ngc_debug_out (setting_id_t id, uint_fast16_t int_value);
#endif
static bool machine_mode_changed = false;
#if COMPATIBILITY_LEVEL <= 1
static char homing_options[] = "Enable,Enable single axis commands,Homing on startup required,Set machine origin to 0,Two switches shares one input pin,Allow manual,Override locks,Keep homed status on reset,Use limit switches";
#endif
static char control_signals[] = "Reset,Feed hold,Cycle start,Safety door,Block delete,Optional stop,EStop,Probe connected,Motor fault,Motor warning,Limits override,Single step blocks";
static char spindle_signals[] = "Spindle enable,Spindle direction,PWM";
static char coolant_signals[] = "Flood,Mist";
static char ganged_axes[] = "X-Axis,Y-Axis,Z-Axis";
#if !AXIS_REMAP_ABC2UVW
#if N_AXIS == 4
static const char rotary_axes[] = "A-Axis";
#elif N_AXIS == 5
static const char rotary_axes[] = "A-Axis,B-Axis";
#elif N_AXIS == 6
static const char rotary_axes[] = "A-Axis,B-Axis,C-Axis";
#elif N_AXIS == 7
static const char rotary_axes[] = "A-Axis,B-Axis,C-Axis,U-Axis";
#elif N_AXIS == 8
static const char rotary_axes[] = "A-Axis,B-Axis,C-Axis,U-Axis,V-Axis";
#endif
#else
#if N_AXIS == 4
static const char rotary_axes[] = "U-Axis";
#elif N_AXIS == 5
static const char rotary_axes[] = "U-Axis,V-Axis";
#elif N_AXIS == 6
static const char rotary_axes[] = "U-Axis,V-Axis,W-Axis";
#endif
#endif
static char fs_options[] = "Auto mount SD card,Hide LittleFS";
static char spindle_types[100] = "";
static char axis_dist[4] = "mm";
static char axis_rate[8] = "mm/min";
static char axis_accel[10] = "mm/sec^2";
#if DELTA_ROBOT
static char axis_steps[9] = "step/rev";
#else
static char axis_steps[9] = "step/mm";
#endif
#define AXIS_OPTS { .subgroups = On, .increment = 1 }
PROGMEM static const setting_detail_t setting_detail[] = {
{ Setting_PulseMicroseconds, Group_Stepper, "Step pulse time", "microseconds", Format_Decimal, "#0.0", "2.0", NULL, Setting_IsLegacy, &settings.steppers.pulse_microseconds, NULL, NULL },
{ Setting_StepperIdleLockTime, Group_Stepper, "Step idle delay", "milliseconds", Format_Int16, "####0", NULL, "65535", Setting_IsLegacy, &settings.steppers.idle_lock_time, NULL, NULL },
{ Setting_StepInvertMask, Group_Stepper, "Step pulse invert", NULL, Format_AxisMask, NULL, NULL, NULL, Setting_IsLegacy, &settings.steppers.step_invert.mask, NULL, NULL },
{ Setting_DirInvertMask, Group_Stepper, "Step direction invert", NULL, Format_AxisMask, NULL, NULL, NULL, Setting_IsLegacy, &settings.steppers.dir_invert.mask, NULL, NULL },
#if COMPATIBILITY_LEVEL <= 2
{ Setting_InvertStepperEnable, Group_Stepper, "Invert stepper enable pin(s)", NULL, Format_AxisMask, NULL, NULL, NULL, Setting_IsLegacy, &settings.steppers.enable_invert.mask, NULL, NULL },
#else
{ Setting_InvertStepperEnable, Group_Stepper, "Invert stepper enable pins", NULL, Format_Bool, NULL, NULL, NULL, Setting_IsLegacyFn, set_enable_invert_mask, get_int, NULL },
#endif
#if COMPATIBILITY_LEVEL <= 1
{ Setting_LimitPinsInvertMask, Group_Limits, "Invert limit pins", NULL, Format_AxisMask, NULL, NULL, NULL, Setting_IsLegacy, &settings.limits.invert.mask, NULL, NULL },
#else
{ Setting_LimitPinsInvertMask, Group_Limits, "Invert limit pins", NULL, Format_Bool, NULL, NULL, NULL, Setting_IsLegacyFn, set_limits_invert_mask, get_int, NULL },
#endif
{ Setting_InvertProbePin, Group_Probing, "Invert probe pin", NULL, Format_Bool, NULL, NULL, NULL, Setting_IsLegacyFn, set_probe_invert, get_int, is_setting_available },
{ Setting_SpindlePWMBehaviour, Group_Spindle, "Deprecated", NULL, Format_Bool, NULL, NULL, NULL, Setting_IsLegacyFn, set_pwm_mode, get_int, is_setting_available },
{ Setting_GangedDirInvertMask, Group_Stepper, "Ganged axes direction invert", NULL, Format_Bitfield, ganged_axes, NULL, NULL, Setting_IsExtendedFn, set_ganged_dir_invert, get_int, is_setting_available },
{ Setting_SpindlePWMOptions, Group_Spindle, "PWM Spindle", NULL, Format_XBitfield, "Enable,RPM controls spindle enable signal,Disable laser mode capability", NULL, NULL, Setting_IsExtendedFn, set_pwm_options, get_int, is_setting_available },
#if COMPATIBILITY_LEVEL <= 1
{ Setting_StatusReportMask, Group_General, "Status report options", NULL, Format_Bitfield, "Position in machine coordinate,Buffer state,Line numbers,Feed & speed,Pin state,Work coordinate offset,Overrides,Probe coordinates,Buffer sync on WCO change,Parser state,Alarm substatus,Run substatus,Enable when homing", NULL, NULL, Setting_IsExtendedFn, set_report_mask, get_int, NULL },
#else
{ Setting_StatusReportMask, Group_General, "Status report options", NULL, Format_Bitfield, "Position in machine coordinate,Buffer state", NULL, NULL, Setting_IsLegacyFn, set_report_mask, get_int, NULL },
#endif
{ Setting_JunctionDeviation, Group_General, "Junction deviation", "mm", Format_Decimal, "#####0.000", NULL, NULL, Setting_IsLegacy, &settings.junction_deviation, NULL, NULL },
{ Setting_ArcTolerance, Group_General, "Arc tolerance", "mm", Format_Decimal, "#####0.000", NULL, NULL, Setting_IsLegacy, &settings.arc_tolerance, NULL, NULL },
{ Setting_ReportInches, Group_General, "Report in inches", NULL, Format_Bool, NULL, NULL, NULL, Setting_IsLegacyFn, set_report_inches, get_int, NULL },
{ Setting_ControlInvertMask, Group_ControlSignals, "Invert control pins", NULL, Format_Bitfield, control_signals, NULL, NULL, Setting_IsExpandedFn, set_control_invert, get_int, NULL },
{ Setting_CoolantInvertMask, Group_Coolant, "Invert coolant pins", NULL, Format_Bitfield, coolant_signals, NULL, NULL, Setting_IsExtended, &settings.coolant_invert.mask, NULL, NULL },
{ Setting_SpindleInvertMask, Group_Spindle, "Invert spindle signals", NULL, Format_Bitfield, spindle_signals, NULL, NULL, Setting_IsExtendedFn, set_spindle_invert, get_int, is_setting_available, { .reboot_required = On } },
{ Setting_ControlPullUpDisableMask, Group_ControlSignals, "Pullup disable control pins", NULL, Format_Bitfield, control_signals, NULL, NULL, Setting_IsExtendedFn, set_control_disable_pullup, get_int, NULL },
{ Setting_LimitPullUpDisableMask, Group_Limits, "Pullup disable limit pins", NULL, Format_AxisMask, NULL, NULL, NULL, Setting_IsExtended, &settings.limits.disable_pullup.mask, NULL, NULL },
{ Setting_ProbePullUpDisable, Group_Probing, "Pullup disable probe pin", NULL, Format_Bool, NULL, NULL, NULL, Setting_IsExtendedFn, set_probe_disable_pullup, get_int, is_setting_available },
{ Setting_SoftLimitsEnable, Group_Limits, "Soft limits enable", NULL, Format_Bool, NULL, NULL, NULL, Setting_IsLegacyFn, set_soft_limits_enable, get_int, NULL },
#if COMPATIBILITY_LEVEL <= 1
#if N_AXIS > 3
{ Setting_HardLimitsEnable, Group_Limits, "Hard limits enable", NULL, Format_XBitfield, "Enable,Strict mode,Disable for rotary axes", NULL, NULL, Setting_IsExpandedFn, set_hard_limits_enable, get_int, NULL },
#else
{ Setting_HardLimitsEnable, Group_Limits, "Hard limits enable", NULL, Format_XBitfield, "Enable,Strict mode", NULL, NULL, Setting_IsExpandedFn, set_hard_limits_enable, get_int, NULL },
#endif
#else
{ Setting_HardLimitsEnable, Group_Limits, "Hard limits enable", NULL, Format_Bool, NULL, NULL, NULL, Setting_IsLegacyFn, set_hard_limits_enable, get_int, NULL },
#endif
#if COMPATIBILITY_LEVEL <= 1
{ Setting_HomingEnable, Group_Homing, "Homing cycle", NULL, Format_XBitfield, homing_options, NULL, NULL, Setting_IsExpandedFn, set_homing_enable, get_int, NULL },
#else
{ Setting_HomingEnable, Group_Homing, "Homing cycle enable", NULL, Format_Bool, NULL, NULL, NULL, Setting_IsLegacyFn, set_homing_enable, get_int, NULL },
#endif
{ Setting_HomingDirMask, Group_Homing, "Homing direction invert", NULL, Format_AxisMask, NULL, NULL, NULL, Setting_IsLegacy, &settings.homing.dir_mask.value, NULL, NULL },
{ Setting_HomingFeedRate, Group_Homing, "Homing locate feed rate", "mm/min", Format_Decimal, "#####0.0", NULL, NULL, Setting_IsLegacy, &settings.homing.feed_rate, NULL, NULL },
{ Setting_HomingSeekRate, Group_Homing, "Homing search seek rate", "mm/min", Format_Decimal, "#####0.0", NULL, NULL, Setting_IsLegacy, &settings.homing.seek_rate, NULL, NULL },
{ Setting_HomingDebounceDelay, Group_Homing, "Homing switch debounce delay", "milliseconds", Format_Int16, "##0", NULL, NULL, Setting_IsLegacy, &settings.homing.debounce_delay, NULL, NULL },
{ Setting_HomingPulloff, Group_Homing, "Homing switch pull-off distance", "mm", Format_Decimal, "#####0.000", NULL, NULL, Setting_IsLegacy, &settings.homing.pulloff, NULL, NULL },
{ Setting_G73Retract, Group_General, "G73 Retract distance", "mm", Format_Decimal, "#####0.000", NULL, NULL, Setting_IsExtended, &settings.g73_retract, NULL, NULL },
{ Setting_PulseDelayMicroseconds, Group_Stepper, "Pulse delay", "microseconds", Format_Decimal, "#0.0", NULL, "10", Setting_IsExtended, &settings.steppers.pulse_delay_microseconds, NULL, NULL },
{ Setting_RpmMax, Group_Spindle, "Maximum spindle speed", "RPM", Format_Decimal, "#####0.000", NULL, NULL, Setting_IsLegacy, &settings.spindle.rpm_max, NULL, is_setting_available },
{ Setting_RpmMin, Group_Spindle, "Minimum spindle speed", "RPM", Format_Decimal, "#####0.000", NULL, NULL, Setting_IsLegacy, &settings.spindle.rpm_min, NULL, is_setting_available },
#if !LATHE_UVW_OPTION
{ Setting_Mode, Group_General, "Mode of operation", NULL, Format_RadioButtons, "Normal,Laser mode,Lathe mode", NULL, NULL, Setting_IsLegacyFn, set_mode, get_int, NULL },
#endif
{ Setting_PWMFreq, Group_Spindle, "Spindle PWM frequency", "Hz", Format_Decimal, "#####0", NULL, NULL, Setting_IsExtended, &settings.spindle.pwm_freq, NULL, is_setting_available },
{ Setting_PWMOffValue, Group_Spindle, "Spindle PWM off value", "percent", Format_Decimal, "##0.0", NULL, "100", Setting_IsExtended, &settings.spindle.pwm_off_value, NULL, is_setting_available },
{ Setting_PWMMinValue, Group_Spindle, "Spindle PWM min value", "percent", Format_Decimal, "##0.0", NULL, "100", Setting_IsExtended, &settings.spindle.pwm_min_value, NULL, is_setting_available },
{ Setting_PWMMaxValue, Group_Spindle, "Spindle PWM max value", "percent", Format_Decimal, "##0.0", NULL, "100", Setting_IsExtended, &settings.spindle.pwm_max_value, NULL, is_setting_available },
{ Setting_StepperDeenergizeMask, Group_Stepper, "Steppers deenergize", NULL, Format_AxisMask, NULL, NULL, NULL, Setting_IsExtendedFn, set_stepper_deenergize_mask, get_int, NULL },
{ Setting_SpindlePPR, Group_Spindle, "Spindle pulses per revolution (PPR)", NULL, Format_Int16, "###0", NULL, NULL, Setting_IsExtended, &settings.spindle.ppr, NULL, is_setting_available, { .reboot_required = On } },
{ Setting_EnableLegacyRTCommands, Group_General, "Enable legacy RT commands", NULL, Format_Bool, NULL, NULL, NULL, Setting_IsExtendedFn, set_enable_legacy_rt_commands, get_int, NULL },
{ Setting_JogSoftLimited, Group_Jogging, "Limit jog commands", NULL, Format_Bool, NULL, NULL, NULL, Setting_IsExtendedFn, set_jog_soft_limited, get_int, NULL },
#ifndef NO_SAFETY_DOOR_SUPPORT
{ Setting_ParkingEnable, Group_SafetyDoor, "Parking cycle", NULL, Format_XBitfield, "Enable,Enable parking override control,Deactivate upon init", NULL, NULL, Setting_IsExtendedFn, set_parking_enable, get_int, is_setting_available },
{ Setting_ParkingAxis, Group_SafetyDoor, "Parking axis", NULL, Format_RadioButtons, "X,Y,Z", NULL, NULL, Setting_IsExtended, &settings.parking.axis, NULL, is_setting_available },
#endif
{ Setting_HomingLocateCycles, Group_Homing, "Homing passes", NULL, Format_Int8, "##0", "1", "128", Setting_IsExtended, &settings.homing.locate_cycles, NULL, NULL },
{ Setting_HomingCycle_1, Group_Homing, "Axes homing, first pass", NULL, Format_AxisMask, NULL, NULL, NULL, Setting_IsExtendedFn, set_homing_cycle, get_int, NULL },
{ Setting_HomingCycle_2, Group_Homing, "Axes homing, second pass", NULL, Format_AxisMask, NULL, NULL, NULL, Setting_IsExtendedFn, set_homing_cycle, get_int, NULL },
{ Setting_HomingCycle_3, Group_Homing, "Axes homing, third pass", NULL, Format_AxisMask, NULL, NULL, NULL, Setting_IsExtendedFn, set_homing_cycle, get_int, NULL },
#ifdef A_AXIS
{ Setting_HomingCycle_4, Group_Homing, "Axes homing, fourth pass", NULL, Format_AxisMask, NULL, NULL, NULL, Setting_IsExtendedFn, set_homing_cycle, get_int, NULL },
#endif
#ifdef B_AXIS
{ Setting_HomingCycle_5, Group_Homing, "Axes homing, fifth pass", NULL, Format_AxisMask, NULL, NULL, NULL, Setting_IsExtendedFn, set_homing_cycle, get_int, NULL },
#endif
#ifdef C_AXIS
{ Setting_HomingCycle_6, Group_Homing, "Axes homing, sixth pass", NULL, Format_AxisMask, NULL, NULL, NULL, Setting_IsExtendedFn, set_homing_cycle, get_int, NULL },
#endif
#ifndef NO_SAFETY_DOOR_SUPPORT
{ Setting_ParkingPulloutIncrement, Group_SafetyDoor, "Parking pull-out distance", "mm", Format_Decimal, "###0.0", NULL, NULL, Setting_IsExtended, &settings.parking.pullout_increment, NULL, is_setting_available },
{ Setting_ParkingPulloutRate, Group_SafetyDoor, "Parking pull-out rate", "mm/min", Format_Decimal, "###0.0", NULL, NULL, Setting_IsExtended, &settings.parking.pullout_rate, NULL, is_setting_available },
{ Setting_ParkingTarget, Group_SafetyDoor, "Parking target", "mm", Format_Decimal, "-###0.0", "-100000", NULL, Setting_IsExtended, &settings.parking.target, NULL, is_setting_available },
{ Setting_ParkingFastRate, Group_SafetyDoor, "Parking fast rate", "mm/min", Format_Decimal, "###0.0", NULL, NULL, Setting_IsExtended, &settings.parking.rate, NULL, is_setting_available },
{ Setting_RestoreOverrides, Group_General, "Restore overrides", NULL, Format_Bool, NULL, NULL, NULL, Setting_IsExtendedFn, set_restore_overrides, get_int, is_setting_available },
{ Setting_DoorOptions, Group_SafetyDoor, "Safety door options", NULL, Format_Bitfield, "Ignore when idle,Keep coolant state on open", NULL, NULL, Setting_IsExtended, &settings.safety_door.flags.value, NULL, is_setting_available },
#endif
{ Setting_SleepEnable, Group_General, "Sleep enable", NULL, Format_Bool, NULL, NULL, NULL, Setting_IsExtendedFn, set_sleep_enable, get_int, is_setting_available },
{ Setting_HoldActions, Group_General, "Feed hold actions", NULL, Format_Bitfield, "Disable laser during hold,Restore spindle and coolant state on resume", NULL, NULL, Setting_IsExtendedFn, set_hold_actions, get_int, NULL },
{ Setting_ForceInitAlarm, Group_General, "Force init alarm", NULL, Format_Bool, NULL, NULL, NULL, Setting_IsExtendedFn, set_force_initialization_alarm, get_int, NULL },
{ Setting_ProbingFeedOverride, Group_Probing, "Probing feed override", NULL, Format_Bool, NULL, NULL, NULL, Setting_IsExtendedFn, set_probe_allow_feed_override, get_int, is_setting_available },
#if ENABLE_SPINDLE_LINEARIZATION
{ Setting_LinearSpindlePiece1, Group_Spindle, "Spindle linearisation, 1st point", NULL, Format_String, "x(39)", NULL, "39", Setting_IsExtendedFn, set_linear_piece, get_linear_piece, NULL },
#if SPINDLE_NPWM_PIECES > 1
{ Setting_LinearSpindlePiece2, Group_Spindle, "Spindle linearisation, 2nd point", NULL, Format_String, "x(39)", NULL, "39", Setting_IsExtendedFn, set_linear_piece, get_linear_piece, NULL },
#endif
#if SPINDLE_NPWM_PIECES > 2
{ Setting_LinearSpindlePiece3, Group_Spindle, "Spindle linearisation, 3rd point", NULL, Format_String, "x(39)", NULL, "39", Setting_IsExtendedFn, set_linear_piece, get_linear_piece, NULL },
#endif
#if SPINDLE_NPWM_PIECES > 3
{ Setting_LinearSpindlePiece4, Group_Spindle, "Spindle linearisation, 4th point", NULL, Format_String, "x(39)", NULL, "39", Setting_IsExtendedFn, set_linear_piece, get_linear_piece, NULL },
#endif
#endif
{ Setting_SpindlePGain, Group_Spindle_ClosedLoop, "Spindle P-gain", NULL, Format_Decimal, "###0.000", NULL, NULL, Setting_IsExtended, &settings.spindle.pid.p_gain, NULL, is_group_available },
{ Setting_SpindleIGain, Group_Spindle_ClosedLoop, "Spindle I-gain", NULL, Format_Decimal, "###0.000", NULL, NULL, Setting_IsExtended, &settings.spindle.pid.i_gain, NULL, is_group_available },
{ Setting_SpindleDGain, Group_Spindle_ClosedLoop, "Spindle D-gain", NULL, Format_Decimal, "###0.000", NULL, NULL, Setting_IsExtended, &settings.spindle.pid.d_gain, NULL, is_group_available },
{ Setting_SpindleMaxError, Group_Spindle_ClosedLoop, "Spindle PID max error", NULL, Format_Decimal, "###0.000", NULL, NULL, Setting_IsExtended, &settings.spindle.pid.max_error, NULL, is_group_available },
{ Setting_SpindleIMaxError, Group_Spindle_ClosedLoop, "Spindle PID max I error", NULL, Format_Decimal, "###0.000", NULL, NULL, Setting_IsExtended, &settings.spindle.pid.i_max_error, NULL, is_group_available },
{ Setting_PositionPGain, Group_Spindle_Sync, "Spindle sync P-gain", NULL, Format_Decimal, "###0.000", NULL, NULL, Setting_IsExtended, &settings.position.pid.p_gain, NULL, is_group_available },
{ Setting_PositionIGain, Group_Spindle_Sync, "Spindle sync I-gain", NULL, Format_Decimal, "###0.000", NULL, NULL, Setting_IsExtended, &settings.position.pid.i_gain, NULL, is_group_available },
{ Setting_PositionDGain, Group_Spindle_Sync, "Spindle sync D-gain", NULL, Format_Decimal, "###0.000", NULL, NULL, Setting_IsExtended, &settings.position.pid.d_gain, NULL, is_group_available },
{ Setting_PositionIMaxError, Group_Spindle_Sync, "Spindle sync PID max I error", NULL, Format_Decimal, "###0.000", NULL, NULL, Setting_IsExtended, &settings.position.pid.i_max_error, NULL, is_group_available },
{ Setting_AxisStepsPerMM, Group_Axis0, "-axis travel resolution", axis_steps, Format_Decimal, "#####0.000##", NULL, NULL, Setting_IsLegacyFn, set_axis_setting, get_float, NULL, AXIS_OPTS },
{ Setting_AxisMaxRate, Group_Axis0, "-axis maximum rate", axis_rate, Format_Decimal, "#####0.000", NULL, NULL, Setting_IsLegacyFn, set_axis_setting, get_float, NULL, AXIS_OPTS },
{ Setting_AxisAcceleration, Group_Axis0, "-axis acceleration", axis_accel, Format_Decimal, "#####0.000", NULL, NULL, Setting_IsLegacyFn, set_axis_setting, get_float, NULL, AXIS_OPTS },
{ Setting_AxisMaxTravel, Group_Axis0, "-axis maximum travel", axis_dist, Format_Decimal, "#####0.000", NULL, NULL, Setting_IsLegacyFn, set_axis_setting, get_float, NULL, AXIS_OPTS },
#if ENABLE_BACKLASH_COMPENSATION
{ Setting_AxisBacklash, Group_Axis0, "-axis backlash compensation", axis_dist, Format_Decimal, "#####0.000##", NULL, NULL, Setting_IsExtendedFn, set_axis_setting, get_float, NULL, AXIS_OPTS },
#endif
{ Setting_AxisAutoSquareOffset, Group_Axis0, "-axis dual axis offset", "mm", Format_Decimal, "-0.000", "-10", "10", Setting_IsExtendedFn, set_axis_setting, get_float, is_setting_available, AXIS_OPTS },
{ Setting_SpindleAtSpeedTolerance, Group_Spindle, "Spindle at speed tolerance", "percent", Format_Decimal, "##0.0", NULL, NULL, Setting_IsExtended, &settings.spindle.at_speed_tolerance, NULL, is_setting_available },
{ Setting_ToolChangeMode, Group_Toolchange, "Tool change mode", NULL, Format_RadioButtons, "Normal,Manual touch off,Manual touch off @ G59.3,Automatic touch off @ G59.3,Ignore M6", NULL, NULL, Setting_IsExtendedFn, set_tool_change_mode, get_int, NULL },
{ Setting_ToolChangeProbingDistance, Group_Toolchange, "Tool change probing distance", "mm", Format_Decimal, "#####0.0", NULL, NULL, Setting_IsExtendedFn, set_tool_change_probing_distance, get_float, NULL },
{ Setting_ToolChangeFeedRate, Group_Toolchange, "Tool change locate feed rate", "mm/min", Format_Decimal, "#####0.0", NULL, NULL, Setting_IsExtended, &settings.tool_change.feed_rate, NULL, NULL },
{ Setting_ToolChangeSeekRate, Group_Toolchange, "Tool change search seek rate", "mm/min", Format_Decimal, "#####0.0", NULL, NULL, Setting_IsExtended, &settings.tool_change.seek_rate, NULL, NULL },
{ Setting_ToolChangePulloffRate, Group_Toolchange, "Tool change probe pull-off rate", "mm/min", Format_Decimal, "#####0.0", NULL, NULL, Setting_IsExtended, &settings.tool_change.pulloff_rate, NULL, NULL },
{ Setting_ToolChangeRestorePosition, Group_Toolchange, "Restore position after M6", NULL, Format_Bool, NULL, NULL, NULL, Setting_IsExtendedFn, set_tool_restore_pos, get_int, NULL },
{ Setting_DualAxisLengthFailPercent, Group_Limits_DualAxis, "Dual axis length fail", "percent", Format_Decimal, "##0.0", "0", "100", Setting_IsExtended, &settings.homing.dual_axis.fail_length_percent, NULL, is_setting_available },
{ Setting_DualAxisLengthFailMin, Group_Limits_DualAxis, "Dual axis length fail min", "mm", Format_Decimal, "#####0.000", NULL, NULL, Setting_IsExtended, &settings.homing.dual_axis.fail_distance_min, NULL, is_setting_available },
{ Setting_DualAxisLengthFailMax, Group_Limits_DualAxis, "Dual axis length fail max", "mm", Format_Decimal, "#####0.000", NULL, NULL, Setting_IsExtended, &settings.homing.dual_axis.fail_distance_max, NULL, is_setting_available },
#if COMPATIBILITY_LEVEL <= 1
{ Setting_DisableG92Persistence, Group_General, "Disable G92 persistence", NULL, Format_Bool, NULL, NULL, NULL, Setting_IsExtendedFn, set_g92_disable_persistence, get_int, NULL },
#endif
#if N_AXIS > 3
{ Settings_RotaryAxes, Group_Stepper, "Rotary axes", NULL, Format_Bitfield, rotary_axes, NULL, NULL, Setting_IsExtendedFn, set_rotary_axes, get_int, NULL },
#endif
#ifndef NO_SAFETY_DOOR_SUPPORT
{ Setting_DoorSpindleOnDelay, Group_SafetyDoor, "Spindle on delay", "s", Format_Decimal, "#0.0", "0.5", "20", Setting_IsExtended, &settings.safety_door.spindle_on_delay, NULL, is_setting_available },
{ Setting_DoorCoolantOnDelay, Group_SafetyDoor, "Coolant on delay", "s", Format_Decimal, "#0.0", "0.5", "20", Setting_IsExtended, &settings.safety_door.coolant_on_delay, NULL, is_setting_available },
#endif
{ Setting_SpindleOnDelay, Group_Spindle, "Spindle on delay", "s", Format_Decimal, "#0.0", "0.5", "20", Setting_IsExtended, &settings.safety_door.spindle_on_delay, NULL, is_setting_available },
{ Setting_SpindleType, Group_Spindle, "Default spindle", NULL, Format_RadioButtons, spindle_types, NULL, NULL, Setting_IsExtendedFn, set_spindle_type, get_int, is_setting_available },
{ Setting_PlannerBlocks, Group_General, "Planner buffer blocks", NULL, Format_Int16, "####0", "30", "1000", Setting_IsExtended, &settings.planner_buffer_blocks, NULL, NULL, { .reboot_required = On } },
{ Setting_AutoReportInterval, Group_General, "Autoreport interval", "ms", Format_Int16, "###0", "100", "1000", Setting_IsExtendedFn, set_report_interval, get_int, NULL, { .reboot_required = On, .allow_null = On } },
// { Setting_TimeZoneOffset, Group_General, "Timezone offset", NULL, Format_Decimal, "-#0.00", "0", "12", Setting_IsExtended, &settings.timezone, NULL, NULL },
{ Setting_UnlockAfterEStop, Group_General, "Unlock required after E-Stop", NULL, Format_Bool, NULL, NULL, NULL, Setting_IsExtendedFn, set_estop_unlock, get_int, is_setting_available },
#if NGC_EXPRESSIONS_ENABLE
{ Setting_NGCDebugOut, Group_General, "Output NGC debug messages", NULL, Format_Bool, NULL, NULL, NULL, Setting_IsExtendedFn, set_ngc_debug_out, get_int, NULL },
#endif
#if COMPATIBILITY_LEVEL <= 1
{ Setting_OffsetLock, Group_General, "Lock coordinate systems", NULL, Format_Bitfield, "G59.1,G59.2,G59.3", NULL, NULL, Setting_IsExtendedFn, set_offset_lock, get_int, NULL },
#endif
{ Setting_EncoderSpindle, Group_Spindle, "Encoder spindle", NULL, Format_RadioButtons, spindle_types, NULL, NULL, Setting_IsExtendedFn, set_encoder_spindle, get_int, is_setting_available },
#if N_AXIS > 3
{ Setting_RotaryWrap, Group_Stepper, "Fast rotary go to G28", NULL, Format_Bitfield, rotary_axes, NULL, NULL, Setting_IsExtendedFn, set_rotary_wrap_axes, get_int, NULL },
#endif
{ Setting_FSOptions, Group_General, "File systems options", NULL, Format_Bitfield, fs_options, NULL, NULL, Setting_IsExtended, &settings.fs_options.mask, NULL, is_setting_available },
{ Setting_HomePinsInvertMask, Group_Limits, "Invert home pins", NULL, Format_AxisMask, NULL, NULL, NULL, Setting_IsExtended, &settings.home_invert.mask, NULL, is_setting_available },
{ Setting_HoldCoolantOnDelay, Group_Coolant, "Coolant on delay", "s", Format_Decimal, "#0.0", "0.5", "20", Setting_IsExtended, &settings.safety_door.coolant_on_delay, NULL, is_setting_available }
};
#ifndef NO_SETTINGS_DESCRIPTIONS
PROGMEM static const setting_descr_t setting_descr[] = {
{ Setting_PulseMicroseconds, "Sets time length per step. Minimum 2 microseconds.\\n\\n"
"This needs to be reduced from the default value of 10 when max. step rates exceed approximately 80 kHz."
},
{ Setting_StepperIdleLockTime, "Sets a short hold delay when stopping to let dynamics settle before disabling steppers. Value 255 keeps motors enabled." },
{ Setting_StepInvertMask, "Inverts the step signals (active low)." },
{ Setting_DirInvertMask, "Inverts the direction signals (active low)." },
#if COMPATIBILITY_LEVEL <= 2
{ Setting_InvertStepperEnable, "Inverts the stepper driver enable signals. Most drivers uses active low enable requiring inversion.\\n\\n"
"NOTE: If the stepper drivers shares the same enable signal only X is used."
},
#else
{ Setting_InvertStepperEnable, "Inverts the stepper driver enable signals. Drivers using active high enable require inversion.\\n\\n" },
#endif
{ Setting_LimitPinsInvertMask, "Inverts the axis limit input signals." },
{ Setting_InvertProbePin, "Inverts the probe input pin signal." },
{ Setting_SpindlePWMOptions, "Enable controls PWM output availability.\\n"
"When `RPM controls spindle enable signal` is checked and M3 or M4 is active S0 switches it off and S > 0 switches it on."
},
{ Setting_GangedDirInvertMask, "Inverts the direction signals for the second motor used for ganged axes.\\n\\n"
"NOTE: This inversion will be applied in addition to the inversion from setting $3."
},
{ Setting_StatusReportMask, "Specifies optional data included in status reports and if report is sent when homing.\\n"
"If Run substatus is enabled it may be used for simple probe protection.\\n\\n"
"NOTE: Parser state will be sent separately after the status report and only on changes."
},
{ Setting_JunctionDeviation, "Sets how fast Grbl travels through consecutive motions. Lower value slows it down." },
{ Setting_ArcTolerance, "Sets the G2 and G3 arc tracing accuracy based on radial error. Beware: A very small value may effect performance." },
{ Setting_ReportInches, "Enables inch units when returning any position and rate value that is not a settings value." },
{ Setting_ControlInvertMask, "Inverts the control signals (active low).\\n"
"NOTE: Block delete, Optional stop, EStop and Probe connected are optional signals, availability is driver dependent."
},
{ Setting_CoolantInvertMask, "Inverts the coolant and mist signals (active low)." },
{ Setting_SpindleInvertMask, "Inverts the spindle on, counterclockwise and PWM signals (active low)." },
{ Setting_ControlPullUpDisableMask, "Disable the control signals pullup resistors. Potentially enables pulldown resistor if available.\\n"
"NOTE: Block delete, Optional stop and EStop are optional signals, availability is driver dependent."
},
{ Setting_LimitPullUpDisableMask, "Disable the limit signals pullup resistors. Potentially enables pulldown resistor if available."},
{ Setting_ProbePullUpDisable, "Disable the probe signal pullup resistor. Potentially enables pulldown resistor if available." },
{ Setting_SoftLimitsEnable, "Enables soft limits checks within machine travel and sets alarm when exceeded. Requires homing." },
{ Setting_HardLimitsEnable, "When enabled immediately halts motion and throws an alarm when a limit switch is triggered. In strict mode only homing is possible when a switch is engaged." },
{ Setting_HomingEnable, "Enables homing cycle. Requires limit switches on axes to be automatically homed.\\n\\n"
"When `Enable single axis commands` is checked, single axis homing can be performed by $H<axis letter> commands.\\n\\n"
"When `Allow manual` is checked, axes not homed automatically may be homed manually by $H or $H<axis letter> commands.\\n\\n"
"`Override locks` is for allowing a soft reset to disable `Homing on startup required`."
},
{ Setting_HomingDirMask, "Homing searches for a switch in the positive direction. Set axis bit to search in negative direction." },
{ Setting_HomingFeedRate, "Feed rate to slowly engage limit switch to determine its location accurately." },
{ Setting_HomingSeekRate, "Seek rate to quickly find the limit switch before the slower locating phase." },
{ Setting_HomingDebounceDelay, "Sets a short delay between phases of homing cycle to let a switch debounce." },
{ Setting_HomingPulloff, "Retract distance after triggering switch to disengage it. Homing will fail if switch isn't cleared." },
{ Setting_G73Retract, "G73 retract distance (for chip breaking drilling)." },
{ Setting_PulseDelayMicroseconds, "Step pulse delay.\\n\\n"
"Normally leave this at 0 as there is an implicit delay on direction changes when AMASS is active."
},
{ Setting_RpmMax, "Maximum spindle speed, can be overridden by spindle plugins." },
{ Setting_RpmMin, "Minimum spindle speed, can be overridden by spindle plugins.\\n\\n"
"When set > 0 $35 (PWM min value) may have to be set to get the configured RPM."},
#if !LATHE_UVW_OPTION
{ Setting_Mode, "Laser mode: consecutive G1/2/3 commands will not halt when spindle speed is changed.\\n"
"Lathe mode: allows use of G7, G8, G96 and G97."
},
#endif
{ Setting_PWMFreq, "Spindle PWM frequency." },
{ Setting_PWMOffValue, "Spindle PWM off value in percent (duty cycle)." },
{ Setting_PWMMinValue, "Spindle PWM min value in percent (duty cycle)." },
{ Setting_PWMMaxValue, "Spindle PWM max value in percent (duty cycle)." },
{ Setting_StepperDeenergizeMask, "Specifies which steppers not to disable when stopped." },
{ Setting_SpindlePPR, "Spindle encoder pulses per revolution." },
{ Setting_EnableLegacyRTCommands, "Enables \"normal\" processing of ?, ! and ~ characters when part of $-setting or comment. If disabled then they are added to the input string instead." },
{ Setting_JogSoftLimited, "Limit jog commands to machine limits for homed axes." },
{ Setting_ParkingEnable, "Enables parking cycle, requires parking axis homed." },
{ Setting_ParkingAxis, "Define which axis that performs the parking motion." },
{ Setting_HomingLocateCycles, "Number of homing passes. Minimum 1, maximum 128." },
{ Setting_HomingCycle_1, "Axes to home in first pass." },
{ Setting_HomingCycle_2, "Axes to home in second pass." },
{ Setting_HomingCycle_3, "Axes to home in third pass." },
#ifdef A_AXIS
{ Setting_HomingCycle_4, "Axes to home in fourth pass." },
#endif
#ifdef B_AXIS
{ Setting_HomingCycle_5, "Axes to home in fifth pass." },
#endif
#ifdef C_AXIS
{ Setting_HomingCycle_6, "Axes to home in sixth pass." },
#endif
{ Setting_JogStepSpeed, "Step jogging speed in millimeters per minute." },
{ Setting_JogSlowSpeed, "Slow jogging speed in millimeters per minute." },
{ Setting_JogFastSpeed, "Fast jogging speed in millimeters per minute." },
{ Setting_JogStepDistance, "Jog distance for single step jogging." },
{ Setting_JogSlowDistance, "Jog distance before automatic stop." },
{ Setting_JogFastDistance, "Jog distance before automatic stop." },
#ifndef NO_SAFETY_DOOR_SUPPORT
{ Setting_ParkingPulloutIncrement, "Spindle pull-out and plunge distance in mm.Incremental distance." },
{ Setting_ParkingPulloutRate, "Spindle pull-out/plunge slow feed rate in mm/min." },
{ Setting_ParkingTarget, "Parking axis target. In mm, as machine coordinate [-max_travel, 0]." },
{ Setting_ParkingFastRate, "Parking fast rate to target after pull-out in mm/min." },
{ Setting_RestoreOverrides, "Restore overrides to default values at program end." },
{ Setting_DoorOptions, "Enable this if it is desirable to open the safety door when in IDLE mode (eg. for jogging)." },
#endif
{ Setting_SleepEnable, "Enable sleep mode." },
{ Setting_HoldActions, "Actions taken during feed hold and on resume from feed hold." },
{ Setting_ForceInitAlarm, "Starts Grbl in alarm mode after a cold reset." },
{ Setting_ProbingFeedOverride, "Allow feed override during probing." },
#if ENABLE_SPINDLE_LINEARIZATION
{ Setting_LinearSpindlePiece1, "Comma separated list of values: RPM_MIN, RPM_LINE_A1, RPM_LINE_B1, set to blank to disable." },
#if SPINDLE_NPWM_PIECES > 1
{ Setting_LinearSpindlePiece2, "Comma separated list of values: RPM_POINT12, RPM_LINE_A2, RPM_LINE_B2, set to blank to disable." },
#endif
#if SPINDLE_NPWM_PIECES > 2
{ Setting_LinearSpindlePiece3, "Comma separated list of values: RPM_POINT23, RPM_LINE_A3, RPM_LINE_B3, set to blank to disable." },
#endif
#if SPINDLE_NPWM_PIECES > 3
{ Setting_LinearSpindlePiece4, "Comma separated list of values: RPM_POINT34, RPM_LINE_A4, RPM_LINE_B4, set to blank to disable." },
#endif
#endif
{ Setting_SpindlePGain, "" },
{ Setting_SpindleIGain, "" },
{ Setting_SpindleDGain, "" },
{ Setting_SpindleMaxError, "" },
{ Setting_SpindleIMaxError, "Spindle PID max integrator error." },
{ Setting_PositionPGain, "" },
{ Setting_PositionIGain, "" },
{ Setting_PositionDGain, "" },
{ Setting_PositionIMaxError, "Spindle sync PID max integrator error." },
{ Setting_AxisStepsPerMM, "Travel resolution in steps per millimeter." },
{ (setting_id_t)(Setting_AxisStepsPerMM + 1), "Travel resolution in steps per degree." }, // "Hack" to get correct description for rotary axes
{ Setting_AxisMaxRate, "Maximum rate. Used as G0 rapid rate." },
{ Setting_AxisAcceleration, "Acceleration. Used for motion planning to not exceed motor torque and lose steps." },
{ Setting_AxisMaxTravel, "Maximum axis travel distance from homing switch. Determines valid machine space for soft-limits and homing search distances." },
#if ENABLE_BACKLASH_COMPENSATION
{ Setting_AxisBacklash, "Backlash distance to compensate for." },
#endif
{ Setting_AxisAutoSquareOffset, "Offset between sides to compensate for homing switches inaccuracies." },
{ Setting_SpindleAtSpeedTolerance, "Spindle at speed tolerance as percentage deviation from programmed speed, set to 0 to disable.\\n"
"If not within tolerance when checked after spindle on delay ($392) alarm 14 is raised."
},
{ Setting_ToolChangeMode, "Normal: allows jogging for manual touch off. Set new position manually.\\n\\n"
"Manual touch off: retracts tool axis to home position for tool change, use jogging or $TPW for touch off.\\n\\n"
"Manual touch off @ G59.3: retracts tool axis to home position then to G59.3 position for tool change, use jogging or $TPW for touch off.\\n\\n"
"Automatic touch off @ G59.3: retracts tool axis to home position for tool change, then to G59.3 position for automatic touch off.\\n\\n"
"All modes except \"Normal\" and \"Ignore M6\" returns the tool (controlled point) to original position after touch off."
},
{ Setting_ToolChangeProbingDistance, "Maximum probing distance for automatic or $TPW touch off." },
{ Setting_ToolChangeFeedRate, "Feed rate to slowly engage tool change sensor to determine the tool offset accurately." },
{ Setting_ToolChangeSeekRate, "Seek rate to quickly find the tool change sensor before the slower locating phase." },
{ Setting_ToolChangePulloffRate, "Pull-off rate for the retract move before the slower locating phase." },
{ Setting_ToolChangeRestorePosition, "When set the spindle is moved so that the controlled point (tool tip) is the same as before the M6 command, if not the spindle is only moved to the Z home position." },
{ Setting_DualAxisLengthFailPercent, "Dual axis length fail in percent of axis max travel." },
{ Setting_DualAxisLengthFailMin, "Dual axis length fail minimum distance." },
{ Setting_DualAxisLengthFailMax, "Dual axis length fail minimum distance." },
#if COMPATIBILITY_LEVEL <= 1
{ Setting_DisableG92Persistence, "Disables save/restore of G92 offset to non-volatile storage (NVS)." },
#endif
#if N_AXIS > 3
{ Settings_RotaryAxes, "Designates axes as rotary, interpretation some other relevant axis settings is changed accordingly." },
#endif
#ifndef NO_SAFETY_DOOR_SUPPORT
{ Setting_DoorSpindleOnDelay, "Delay to allow spindle to spin up after safety door is opened or feed hold is canceled." },
{ Setting_DoorCoolantOnDelay, "Delay to allow coolant to restart after safety door is opened or feed hold is canceled." },
#else
{ Setting_DoorSpindleOnDelay, "Delay to allow spindle to spin up when spindle at speed tolerance is > 0." },
#endif
{ Setting_SpindleOnDelay, "Delay to allow spindle to restart after feed hold is canceled." },
{ Setting_SpindleType, "Spindle selected on startup." },
{ Setting_PlannerBlocks, "Number of blocks in the planner buffer." },
{ Setting_AutoReportInterval, "Interval the real time report will be sent, set to 0 to disable." },
{ Setting_TimeZoneOffset, "Offset in hours from UTC." },
{ Setting_UnlockAfterEStop, "If set unlock (by sending $X) is required after resetting a cleared E-Stop condition." },
#if COMPATIBILITY_LEVEL <= 1
{ Setting_OffsetLock, "Lock coordinate systems against accidental changes." },
#endif
#if NGC_EXPRESSIONS_ENABLE
{ Setting_NGCDebugOut, "Example: (debug, metric mode: #<_metric>, coord system: #5220)" },
#endif
{ Setting_EncoderSpindle, "Specifies which spindle has the encoder attached." },
#if N_AXIS > 3
{ Setting_RotaryWrap, "Perform fast move to angle stored in G28 position.\\n"
"Use:\\n"
" G91G28<axisletter>0\\n"
" G90\\n"
},
#endif
{ Setting_FSOptions, "Auto mount SD card on startup." },
{ Setting_HomePinsInvertMask, "Inverts the axis home input signals." },
{ Setting_HoldCoolantOnDelay, "Delay to allow coolant to restart after feed hold is canceled." }
};
#endif
static setting_details_t setting_details = {
.groups = setting_group_detail,
.n_groups = sizeof(setting_group_detail) / sizeof(setting_group_detail_t),
.settings = setting_detail,
.n_settings = sizeof(setting_detail) / sizeof(setting_detail_t),
#ifndef NO_SETTINGS_DESCRIPTIONS
.descriptions = setting_descr,
.n_descriptions = sizeof(setting_descr) / sizeof(setting_descr_t),
#endif
.save = settings_write_global
};
// Acceleration override
static struct {
bool valid;
float acceleration[N_AXIS];
} override_backup = { .valid = false };
static void save_override_backup (void)
{
uint_fast8_t idx = N_AXIS;
do {
idx--;
override_backup.acceleration[idx] = settings.axis[idx].acceleration;
} while(idx);
override_backup.valid = true;
}
static void restore_override_backup (void)
{
uint_fast8_t idx = N_AXIS;
if(override_backup.valid) do {
idx--;
settings.axis[idx].acceleration = override_backup.acceleration[idx];
} while(idx);
}
// Temporarily override acceleration, if 0 restore to setting value.
// Note: only allowed when current state is idle.
bool settings_override_acceleration (uint8_t axis, float acceleration)
{
sys_state_t state = state_get();
if(!(state == STATE_IDLE || (state & (STATE_HOMING|STATE_ALARM))))
return false;
if(acceleration <= 0.0f) {
if(override_backup.valid)
settings.axis[axis].acceleration = override_backup.acceleration[axis];
} else {
if(!override_backup.valid)
save_override_backup();
settings.axis[axis].acceleration = acceleration * 60.0f * 60.0f; // Limit max to setting value?
}
return true;
}
// ---
static setting_details_t *settingsd = &setting_details;
void settings_register (setting_details_t *details)
{
settingsd->next = details;
settingsd = details;
}
setting_details_t *settings_get_details (void)
{
return &setting_details;
}
#if COMPATIBILITY_LEVEL > 2
static status_code_t set_enable_invert_mask (setting_id_t id, uint_fast16_t int_value)
{
settings.steppers.enable_invert.mask = int_value ? 0 : AXES_BITMASK;
return Status_OK;
}
#endif
#if COMPATIBILITY_LEVEL > 1
static status_code_t set_limits_invert_mask (setting_id_t id, uint_fast16_t int_value)
{
settings.limits.invert.mask = (int_value ? ~(DEFAULT_LIMIT_SIGNALS_INVERT_MASK) : DEFAULT_LIMIT_SIGNALS_INVERT_MASK) & AXES_BITMASK;
return Status_OK;
}
#endif
static status_code_t set_probe_invert (setting_id_t id, uint_fast16_t int_value)
{
if(!hal.probe.configure)
return Status_SettingDisabled;
settings.probe.invert_probe_pin = int_value != 0;
ioport_setting_changed(id);
hal.probe.configure(false, false);
return Status_OK;
}
static status_code_t set_ganged_dir_invert (setting_id_t id, uint_fast16_t int_value)
{
if(!hal.stepper.get_ganged)
return Status_SettingDisabled;
settings.steppers.ganged_dir_invert.mask = int_value & hal.stepper.get_ganged(false).mask;
return Status_OK;
}
static status_code_t set_stepper_deenergize_mask (setting_id_t id, uint_fast16_t int_value)
{
settings.steppers.deenergize.mask = int_value;
hal.stepper.enable(settings.steppers.deenergize);
return Status_OK;
}
static status_code_t set_report_interval (setting_id_t setting, uint_fast16_t int_value)
{
if((settings.report_interval = int_value) == 0)
sys.flags.auto_reporting = Off;
return Status_OK;
}
static status_code_t set_report_mask (setting_id_t id, uint_fast16_t int_value)
{
#if COMPATIBILITY_LEVEL <= 1
settings.status_report.mask = int_value;
#else
int_value &= 0b11;
settings.status_report.mask = (settings.status_report.mask & ~0b11) | int_value;
#endif
return Status_OK;
}
static status_code_t set_report_inches (setting_id_t id, uint_fast16_t int_value)
{
settings.flags.report_inches = int_value != 0;
report_init();
system_flag_wco_change(); // Make sure WCO is immediately updated.
return Status_OK;
}
#if NGC_EXPRESSIONS_ENABLE
static status_code_t set_ngc_debug_out (setting_id_t id, uint_fast16_t int_value)
{
settings.flags.ngc_debug_out = int_value != 0;
report_init();
system_flag_wco_change(); // Make sure WCO is immediately updated.