grblHAL core  20240318
gcode.h
Go to the documentation of this file.
1 /*
2  gcode.h - rs274/ngc parser.
3 
4  Part of grblHAL
5 
6  Copyright (c) 2017-2023 Terje Io
7  Copyright (c) 2011-2016 Sungeun K. Jeon for Gnea Research LLC
8  Copyright (c) 2009-2011 Simen Svale Skogsrud
9 
10  Grbl is free software: you can redistribute it and/or modify
11  it under the terms of the GNU General Public License as published by
12  the Free Software Foundation, either version 3 of the License, or
13  (at your option) any later version.
14 
15  Grbl is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  GNU General Public License for more details.
19 
20  You should have received a copy of the GNU General Public License
21  along with Grbl. If not, see <http://www.gnu.org/licenses/>.
22 */
23 
24 #ifndef _GCODE_H_
25 #define _GCODE_H_
26 
27 #include "nuts_bolts.h"
28 #include "coolant_control.h"
29 #include "spindle_control.h"
30 #include "errors.h"
31 
32 typedef uint32_t tool_id_t;
33 typedef uint16_t macro_id_t;
34 
35 // Define command actions for within execution-type modal groups (motion, stopping, non-modal). Used
36 // internally by the parser to know which command to execute.
37 // NOTE: Some values are assigned specific values to make g-code state reporting and parsing
38 // compile a little smaller. Although not
39 // ideal, just be careful with values that state 'do not alter' and check both report.c and gcode.c
40 // to see how they are used, if you need to alter them.
41 
46 typedef enum {
61 
66 typedef enum {
87  MotionMode_None = 80
89 
94 typedef enum {
97  PlaneSelect_YZ = 2
99 
100 // Modal Group G4: Arc IJK distance mode
101 //#define DISTANCE_ARC_MODE_INCREMENTAL 0 // G91.1 - Default, must be zero
102 
103 
108 typedef enum {
113 
114 // Modal Group G7: Cutter radius compensation mode
115 //#define CUTTER_COMP_DISABLE 0 // G40 - Default, must be zero
116 
121 typedef enum {
127 
132 typedef enum {
134  CCRetractMode_RPos = 1
136 
137 
143 typedef enum {
150 #if COMPATIBILITY_LEVEL <= 1
154 #endif
160 } __attribute__ ((__packed__)) coord_system_id_t;
161 
162 
167 typedef enum {
172 
177 typedef enum {
181 
186 typedef enum {
193  ProgramFlow_Return = 99
195 
196 // Modal Group M9: Override control
197 typedef enum {
203  Override_Parking = 56
205 
208 typedef enum {
216 } io_mcode_t;
217 
221 typedef enum {
229  Fan_On = 106,
230  Fan_Off = 107,
244  Probe_Deploy = 401,
245  Probe_Stow = 402,
256 
258 typedef struct output_command {
261  uint8_t port;
262  int32_t value;
265 
267 typedef enum {
273  WaitMode_Max
275 
277 typedef enum {
282 
287 typedef enum {
292  #if SET_CHECK_MODE_PROBE_TO_START
294  #else
296  #endif
298 
300 typedef union {
301  uint16_t value;
302  struct {
303  uint16_t jog_motion :1,
304  canned_cycle_change :1, // Use motion_mode_changed?
314  };
316 
318 typedef union {
319  uint8_t value;
320  struct {
321  uint8_t feed_rate_disable :1,
326  sync :1;
327  };
329 
331 typedef union {
332  float values[N_AXIS];
333  struct {
334  float x;
335  float y;
336  float z;
337 #ifdef A_AXIS
338  float a;
339 #endif
340 #ifdef B_AXIS
341  float b;
342 #endif
343 #ifdef C_AXIS
344  float c;
345 #endif
346 #ifdef U_AXIS
347  float u;
348 #endif
349 #ifdef V_AXIS
350  float v;
351 #endif
352  };
353 } coord_data_t;
354 
356 typedef struct {
357  float xyz[N_AXIS];
358  coord_system_id_t id;
360 
362 typedef union {
363  uint8_t axis[3];
364  struct {
365  uint8_t axis_0;
366  uint8_t axis_1;
367  uint8_t axis_linear;
368  };
369 } plane_t;
370 
378 typedef struct {
379  float d;
380  float e;
381  float f;
382  float ijk[3];
383  float k;
384  float m;
385  float p;
386  float q;
387  float r;
388  float s;
389 #ifndef A_AXIS
390  float a;
391 #endif
392 #ifndef B_AXIS
393  float b;
394 #endif
395 #ifndef C_AXIS
396  float c;
397 #endif
398 #if !defined(U_AXIS) && !AXIS_REMAP_ABC2UVW
399  float u;
400 #endif
401 #if !defined(V_AXIS) && !AXIS_REMAP_ABC2UVW
402  float v;
403 #endif
404 #if !AXIS_REMAP_ABC2UVW
405  float w;
406 #endif
407  float xyz[N_AXIS];
408 #if LATHE_UVW_OPTION
409  float uvw[3];
410 #endif
412  int32_t $;
413  int32_t n;
414  uint32_t o;
415  uint32_t h;
417  uint8_t l;
418 } gc_values_t;
419 
421 typedef union {
422  uint32_t mask;
423  uint32_t value;
424  struct {
425  uint32_t $ :1,
426  a :1,
427  b :1,
428  c :1,
429  i :1,
430  j :1,
431  k :1,
432  d :1,
433  e :1,
434  f :1,
435  g :1,
436  h :1,
437  l :1,
438  m :1,
439  n :1,
440  o :1,
441  p :1,
442  q :1,
443  r :1,
444  s :1,
445  t :1,
446  u :1,
447  v :1,
448  w :1,
449  x :1,
450  y :1,
451  z :1;
452  };
454 
455 typedef enum {
462 
463 typedef struct {
464  const void *value;
467 
468 typedef struct {
472 
473 // NOTE: When this struct is zeroed, the above defines set the defaults for the system.
474 typedef struct {
480  //< uint8_t distance_arc; //!< {G91.1} NOTE: Don't track. Only default supported.
482  //< uint8_t cutter_comp; //!< {G40} NOTE: Don't track. Only default supported.
485 #if ENABLE_PATH_BLENDING
486  control_mode_t control;
487 #endif
495  float spline_pq[2];
496 } gc_modal_t;
497 
499 typedef struct {
500  float xyz[3];
501  float delta;
502  float dwell;
507  bool change;
508 } gc_canned_t;
509 
511 typedef enum {
515  Taper_Both
517 
518 typedef struct {
519  float pitch;
520  float z_final;
521  float peak;
523  float depth;
529  uint_fast16_t spring_passes;
532 
534 typedef struct {
535  float offset[N_AXIS];
536  float radius;
538 } tool_data_t;
539 
540 typedef struct {
541  float rpm;
545 } spindle_t;
546 
550 typedef struct {
554  float feed_rate;
556  float position[N_AXIS];
557 #if ENABLE_PATH_BLENDING
558  float path_tolerance;
559  float cam_tolerance;
560 #endif
561  int32_t line_number;
563 #if NGC_EXPRESSIONS_ENABLE
564  uint32_t g43_pending;
565 #endif
566  bool file_run;
570  bool skip_blocks;
571  status_code_t last_error;
574  float g92_coord_offset[N_AXIS];
577  float tool_length_offset[N_AXIS];
580 
581 typedef struct {
582  float xyz[N_AXIS];
583  float ijk[N_AXIS];
585 
586 extern parser_state_t gc_state;
587 
593 typedef struct {
602  uint32_t arc_turns; //
605 
606 // Initialize the parser
607 void gc_init (void);
608 
609 char *gc_normalize_block (char *block, char **message);
610 
611 // Execute one block of rs275/ngc/g-code
612 status_code_t gc_execute_block (char *block);
613 
614 // Sets g-code parser position in mm. Input in steps. Called by the system abort and hard
615 // limit pull-off routines.
616 #define gc_sync_position() system_convert_array_steps_to_mpos (gc_state.position, sys.position)
617 
618 // Sets g-code parser and planner position in mm.
619 #define sync_position() plan_sync_position(); system_convert_array_steps_to_mpos (gc_state.position, sys.position)
620 
621 // Set dynamic laser power mode to PPI (Pulses Per Inch)
622 // Driver support for pulsing the laser on signal is required for this to work.
623 // Returns true if driver uses hardware implementation.
624 bool gc_laser_ppi_enable (uint_fast16_t ppi, uint_fast16_t pulse_length);
626 // Gets axes scaling state.
628 float *gc_get_scaling (void);
629 
630 // Get current axis offset.
631 float gc_get_offset (uint_fast8_t idx);
632 
634 
635 void gc_spindle_off (void);
636 void gc_coolant_off (void);
637 
638 void gc_set_tool_offset (tool_offset_mode_t mode, uint_fast8_t idx, int32_t offset);
640 
641 #endif
#define N_AXIS
Defines number of axes supported - minimum 3, maximum 8. If more than 3 axes are configured a complia...
Definition: config.h:42
override_mode_t
Definition: gcode.h:197
@ Override_FeedRate
50 - M50
Definition: gcode.h:200
@ Override_FeedHold
53 - M53
Definition: gcode.h:202
@ Override_FeedSpeedDisable
49 - M49
Definition: gcode.h:199
@ Override_SpindleSpeed
51 - M51
Definition: gcode.h:201
@ Override_Parking
56 - M56
Definition: gcode.h:203
@ Override_FeedSpeedEnable
48 - M48
Definition: gcode.h:198
float gc_get_offset(uint_fast8_t idx)
Definition: gcode.c:189
uint32_t tool_id_t
Definition: gcode.h:32
feed_mode_t
Definition: gcode.h:108
@ FeedMode_InverseTime
1 - G93
Definition: gcode.h:110
@ FeedMode_UnitsPerRev
2 - G95
Definition: gcode.h:111
@ FeedMode_UnitsPerMin
0 - G94 - Default, must be zero
Definition: gcode.h:109
tool_offset_mode_t
Definition: gcode.h:121
@ ToolLengthOffset_EnableDynamic
2 - G43.1
Definition: gcode.h:124
@ ToolLengthOffset_Cancel
0 - G49 - Default, must be zero
Definition: gcode.h:122
@ ToolLengthOffset_Enable
1 - G43
Definition: gcode.h:123
@ ToolLengthOffset_ApplyAdditional
3 - G43.2
Definition: gcode.h:125
plane_t * gc_get_plane_data(plane_t *plane, plane_select_t select)
Definition: gcode.c:238
motion_mode_t
Definition: gcode.h:66
@ MotionMode_RigidTapping
331 - G33.1
Definition: gcode.h:74
@ MotionMode_DrillChipBreak
73 - G73
Definition: gcode.h:75
@ MotionMode_CannedCycle82
82 - G82
Definition: gcode.h:78
@ MotionMode_CannedCycle83
83 - G83
Definition: gcode.h:79
@ MotionMode_CannedCycle89
89 - G89
Definition: gcode.h:82
@ MotionMode_CcwArc
3 - G3
Definition: gcode.h:70
@ MotionMode_Seek
0 - G0 - Default, must be zero
Definition: gcode.h:67
@ MotionMode_ProbeToward
140 - G38.2
Definition: gcode.h:83
@ MotionMode_SpindleSynchronized
33 - G33
Definition: gcode.h:73
@ MotionMode_CubicSpline
5 - G5
Definition: gcode.h:71
@ MotionMode_CwArc
2 - G2
Definition: gcode.h:69
@ MotionMode_ProbeAway
142 - G38.4
Definition: gcode.h:85
@ MotionMode_Linear
1 - G1
Definition: gcode.h:68
@ MotionMode_ProbeTowardNoError
141 - G38.3
Definition: gcode.h:84
@ MotionMode_Threading
76 - G76
Definition: gcode.h:76
@ MotionMode_QuadraticSpline
51 - G5.1
Definition: gcode.h:72
@ MotionMode_CannedCycle86
86 - G86
Definition: gcode.h:81
@ MotionMode_CannedCycle85
85 - G85
Definition: gcode.h:80
@ MotionMode_CannedCycle81
81 - G81
Definition: gcode.h:77
@ MotionMode_None
80 - G80
Definition: gcode.h:87
@ MotionMode_ProbeAwayNoError
143 - G38.5
Definition: gcode.h:86
io_mcode_t
Definition: gcode.h:208
@ IoMCode_OutputOffSynced
63 - M63
Definition: gcode.h:210
@ IoMCode_WaitOnInput
66 - M66
Definition: gcode.h:213
@ IoMCode_OutputOnSynced
62 - M62
Definition: gcode.h:209
@ IoMCode_AnalogOutSynced
67 - M67
Definition: gcode.h:214
@ IoMCode_AnalogOutImmediate
68 - M68
Definition: gcode.h:215
@ IoMCode_OutputOnImmediate
64 - M64
Definition: gcode.h:211
@ IoMCode_OutputOffImmediate
65 - M65
Definition: gcode.h:212
struct output_command output_command_t
Data for M62, M63 and M67 commands when executed synchronized with motion.
non_modal_t
Definition: gcode.h:46
@ NonModal_SetCoordinateData
10 - G10
Definition: gcode.h:49
@ NonModal_SetHome_1
40 - G30.1
Definition: gcode.h:53
@ NonModal_SetCoordinateOffset
92 - G92
Definition: gcode.h:56
@ NonModal_SetHome_0
38 - G28.1
Definition: gcode.h:51
@ NonModal_MacroCall
65 - G65
Definition: gcode.h:55
@ NonModal_AbsoluteOverride
53 - G53
Definition: gcode.h:54
@ NonModal_Dwell
4 - G4
Definition: gcode.h:48
@ NonModal_NoAction
0 - Default, must be zero
Definition: gcode.h:47
@ NonModal_RestoreCoordinateOffset
122 - G92.3
Definition: gcode.h:59
@ NonModal_GoHome_1
30 - G30
Definition: gcode.h:52
@ NonModal_ResetCoordinateOffset
102 - G92.1
Definition: gcode.h:57
@ NonModal_ClearCoordinateOffset
112 - G92.2
Definition: gcode.h:58
@ NonModal_GoHome_0
28 - G28
Definition: gcode.h:50
pos_update_t
Parser position updating flags.
Definition: gcode.h:277
@ GCUpdatePos_None
2
Definition: gcode.h:280
@ GCUpdatePos_System
1
Definition: gcode.h:279
@ GCUpdatePos_Target
0
Definition: gcode.h:278
char * gc_normalize_block(char *block, char **message)
Definition: gcode.c:491
user_mcode_t
Definition: gcode.h:221
@ Trinamic_ModeToggle
569 - M569, Marlin format
Definition: gcode.h:247
@ UserMCode_Ignore
0 - Default, must be zero
Definition: gcode.h:222
@ RGB_WriteLEDs
150 - M150, Marlin format
Definition: gcode.h:239
@ LaserPPI_Enable
126 - M126
Definition: gcode.h:236
@ OpenPNP_FinishMoves
400 - M400
Definition: gcode.h:243
@ OpenPNP_GetCurrentPosition
114 - M114
Definition: gcode.h:231
@ UserMCode_Generic1
101 - For private use only
Definition: gcode.h:224
@ UserMCode_Generic4
104 - For private use only
Definition: gcode.h:227
@ UserMCode_Generic2
102 - For private use only
Definition: gcode.h:225
@ OpenPNP_SettingsReset
502 - M502
Definition: gcode.h:246
@ Trinamic_ChopperTiming
919 - M919, Marlin format
Definition: gcode.h:253
@ OpenPNP_FirmwareInfo
115 - M115
Definition: gcode.h:232
@ UserMCode_Generic3
103 - For private use only
Definition: gcode.h:226
@ PWMServo_SetPosition
280 - M280, Marlin format
Definition: gcode.h:241
@ LaserPPI_PulseLength
128 - M128
Definition: gcode.h:238
@ Trinamic_StepperCurrent
906 - M906, Marlin format
Definition: gcode.h:248
@ Trinamic_ReportPrewarnFlags
911 - M911, Marlin format
Definition: gcode.h:249
@ OpenPNP_GetADCReading
105 - M105
Definition: gcode.h:228
@ Trinamic_HomingSensitivity
914 - M914, Marlin format
Definition: gcode.h:252
@ Probe_Deploy
401 - M401, Marlin format
Definition: gcode.h:244
@ Probe_Stow
402 - M402, Marlin format
Definition: gcode.h:245
@ RGB_Inspection_Light
356 - M356
Definition: gcode.h:242
@ Fan_Off
107 - M107
Definition: gcode.h:230
@ LaserPPI_Rate
127 - M127
Definition: gcode.h:237
@ Trinamic_DebugReport
122 - M122, Marlin format
Definition: gcode.h:233
@ Trinamic_HybridThreshold
913 - M913, Marlin format
Definition: gcode.h:251
@ Spindle_Select
Value to be assigned later!
Definition: gcode.h:254
@ OpenPNP_SetPinState
42 - M42
Definition: gcode.h:223
@ Trinamic_ClearPrewarnFlags
912 - M912, Marlin format
Definition: gcode.h:250
@ Trinamic_ReadRegister
123 - M123
Definition: gcode.h:234
@ Fan_On
106 - M106
Definition: gcode.h:229
@ OpenPNP_SetAcceleration
204 - M204
Definition: gcode.h:240
@ Trinamic_WriteRegister
124 - M124
Definition: gcode.h:235
program_flow_t
Definition: gcode.h:186
@ ProgramFlow_Running
0 - Default, must be zero
Definition: gcode.h:187
@ ProgramFlow_CompletedM60
60 - M60
Definition: gcode.h:192
@ ProgramFlow_OptionalStop
1 - M1
Definition: gcode.h:189
@ ProgramFlow_CompletedM2
2 - M2
Definition: gcode.h:190
@ ProgramFlow_Return
99 - M99
Definition: gcode.h:193
@ ProgramFlow_Paused
3 - M0
Definition: gcode.h:188
@ ProgramFlow_CompletedM30
30 - M30
Definition: gcode.h:191
uint16_t macro_id_t
Definition: gcode.h:33
gc_taper_type
Thread taper types.
Definition: gcode.h:511
@ Taper_None
0
Definition: gcode.h:512
@ Taper_Both
3
Definition: gcode.h:515
@ Taper_Exit
2
Definition: gcode.h:514
@ Taper_Entry
1
Definition: gcode.h:513
gc_probe_t
Definition: gcode.h:287
@ GCProbe_FailEnd
0
Definition: gcode.h:291
@ GCProbe_FailInit
2
Definition: gcode.h:290
@ GCProbe_CheckMode
0
Definition: gcode.h:295
@ GCProbe_Found
1
Definition: gcode.h:288
@ GCProbe_Abort
2
Definition: gcode.h:289
float * gc_get_scaling(void)
Definition: gcode.c:169
cc_retract_mode_t
Definition: gcode.h:132
@ CCRetractMode_Previous
0 - G98 - Default, must be zero
Definition: gcode.h:133
@ CCRetractMode_RPos
1 - G99
Definition: gcode.h:134
spindle_rpm_mode_t
Definition: gcode.h:177
@ SpindleSpeedMode_RPM
0 - G97 - Default, must be zero
Definition: gcode.h:178
@ SpindleSpeedMode_CSS
1 - G96
Definition: gcode.h:179
parser_state_t gc_state
Definition: gcode.c:108
__attribute__
Definition: gcode.h:143
@ CoordinateSystem_G55
1 - G55 (G12)
Definition: gcode.h:145
@ CoordinateSystem_G28
9 - G28 (G0) when COMPATIBILITY_LEVEL <= 1, 6 otherwise
Definition: gcode.h:156
@ CoordinateSystem_G59_3
8 - G59.3 (G12) - availability depending on COMPATIBILITY_LEVEL <= 1
Definition: gcode.h:153
@ CoordinateSystem_G54
0 - G54 (G12)
Definition: gcode.h:144
@ N_WorkCoordinateSystems
9 when COMPATIBILITY_LEVEL <= 1, 6 otherwise
Definition: gcode.h:155
@ CoordinateSystem_G56
2 - G56 (G12)
Definition: gcode.h:146
@ CoordinateSystem_G92
11 - G92 (G0) when COMPATIBILITY_LEVEL <= 1, 8 otherwise
Definition: gcode.h:158
@ CoordinateSystem_G59
5 - G59 (G12)
Definition: gcode.h:149
@ CoordinateSystem_G57
3 - G57 (G12)
Definition: gcode.h:147
@ CoordinateSystem_G30
10 - G30 (G0) when COMPATIBILITY_LEVEL <= 1, 7 otherwise
Definition: gcode.h:157
@ CoordinateSystem_G59_2
7 - G59.2 (G12) - availability depending on COMPATIBILITY_LEVEL <= 1
Definition: gcode.h:152
@ CoordinateSystem_G59_1
6 - G59.1 (G12) - availability depending on COMPATIBILITY_LEVEL <= 1
Definition: gcode.h:151
@ CoordinateSystem_G58
4 - G58 (G12)
Definition: gcode.h:148
@ N_CoordinateSystems
12 when COMPATIBILITY_LEVEL <= 1, 9 otherwise
Definition: gcode.h:159
control_mode_t
Definition: gcode.h:167
@ ControlMode_ExactStop
1 - G61.1
Definition: gcode.h:169
@ ControlMode_PathBlending
2 - G64
Definition: gcode.h:170
@ ControlMode_ExactPath
0 - G61 - Default, must be zero
Definition: gcode.h:168
spindle_ptrs_t * gc_spindle_get(void)
Definition: gcode.c:347
axes_signals_t gc_get_g51_state(void)
Definition: gcode.c:174
void gc_spindle_off(void)
Definition: gcode.c:331
gc_value_type_t
Definition: gcode.h:455
@ ValueType_UInt8
Definition: gcode.h:457
@ ValueType_UInt32
Definition: gcode.h:458
@ ValueType_NA
Definition: gcode.h:456
@ ValueType_Int32
Definition: gcode.h:459
@ ValueType_Float
Definition: gcode.h:460
status_code_t gc_execute_block(char *block)
Definition: gcode.c:629
bool gc_laser_ppi_enable(uint_fast16_t ppi, uint_fast16_t pulse_length)
Definition: gcode.c:324
wait_mode_t
M66 Allowed L-parameter values.
Definition: gcode.h:267
@ WaitMode_High
3
Definition: gcode.h:271
@ WaitMode_Immediate
0 - This is the only mode allowed for analog inputs
Definition: gcode.h:268
@ WaitMode_Fall
2
Definition: gcode.h:270
@ WaitMode_Max
For internal use.
Definition: gcode.h:273
@ WaitMode_Low
4
Definition: gcode.h:272
@ WaitMode_Rise
1
Definition: gcode.h:269
void gc_coolant_off(void)
Definition: gcode.c:340
void gc_init(void)
Definition: gcode.c:263
void gc_set_tool_offset(tool_offset_mode_t mode, uint_fast8_t idx, int32_t offset)
Definition: gcode.c:199
plane_select_t
Definition: gcode.h:94
@ PlaneSelect_YZ
2 - G19
Definition: gcode.h:97
@ PlaneSelect_ZX
1 - G18
Definition: gcode.h:96
@ PlaneSelect_XY
0 - G17 - Default, must be zero
Definition: gcode.h:95
parser_state_t * gc_get_state(void)
Definition: gcode.c:146
Coordinate data including id.
Definition: gcode.h:356
coord_system_id_t id
Definition: gcode.h:358
Data for canned cycles.
Definition: gcode.h:499
float dwell
Definition: gcode.h:502
cc_retract_mode_t retract_mode
Definition: gcode.h:506
float delta
Definition: gcode.h:501
bool spindle_off
Definition: gcode.h:505
bool change
Definition: gcode.h:507
float retract_position
Canned cycle retract position.
Definition: gcode.h:503
bool rapid_retract
Definition: gcode.h:504
Definition: gcode.h:474
cc_retract_mode_t retract_mode
{G98,G99}
Definition: gcode.h:492
bool canned_cycle_active
Definition: gcode.h:494
feed_mode_t feed_mode
{G93,G94,G95}
Definition: gcode.h:476
motion_mode_t motion
{G0,G1,G2,G3,G38.2,G80}
Definition: gcode.h:475
spindle_mode_t spindle
{M3,M4,M5 and G96,G97}
Definition: gcode.h:490
gc_override_flags_t override_ctrl
{M48,M49,M50,M51,M53,M56}
Definition: gcode.h:491
plane_select_t plane_select
{G17,G18,G19}
Definition: gcode.h:481
coolant_state_t coolant
{M7,M8,M9}
Definition: gcode.h:489
tool_offset_mode_t tool_offset_mode
{G43,G43.1,G49}
Definition: gcode.h:483
program_flow_t program_flow
{M0,M1,M2,M30,M60}
Definition: gcode.h:488
bool scaling_active
{G50,G51}
Definition: gcode.h:493
bool units_imperial
{G20,G21}
Definition: gcode.h:477
coord_system_t coord_system
{G54,G55,G56,G57,G58,G59,G59.1,G59.2,G59.3}
Definition: gcode.h:484
bool diameter_mode
{G7,G8} Lathe diameter mode.
Definition: gcode.h:479
bool distance_incremental
{G90,G91}
Definition: gcode.h:478
Definition: gcode.h:518
float main_taper_height
Definition: gcode.h:525
float infeed_angle
Definition: gcode.h:527
float pitch
Definition: gcode.h:519
gc_taper_type end_taper_type
Definition: gcode.h:530
uint_fast16_t spring_passes
Definition: gcode.h:529
float cut_direction
Definition: gcode.h:528
float peak
Definition: gcode.h:521
float z_final
Definition: gcode.h:520
float depth
Definition: gcode.h:523
float end_taper_length
Definition: gcode.h:526
float initial_depth
Definition: gcode.h:522
float depth_degression
Definition: gcode.h:524
Definition: gcode.h:463
const gc_value_type_t type
Definition: gcode.h:465
const void * value
Definition: gcode.h:464
G- and M-code parameter values.
Definition: gcode.h:378
float q
User defined M-code parameter, M67 output value, G64 naive CAM tolerance, G83 delta increment.
Definition: gcode.h:386
coord_system_t coord_data
Coordinate data.
Definition: gcode.h:411
float p
G10, 664 or dwell parameters.
Definition: gcode.h:385
float d
Max spindle RPM in Constant Surface Speed Mode (G96)
Definition: gcode.h:379
float r
Arc radius or retract position.
Definition: gcode.h:387
float v
Definition: gcode.h:402
float a
Definition: gcode.h:390
int32_t n
Line number - single-meaning word.
Definition: gcode.h:413
float e
Thread taper length (G76), M67 output number.
Definition: gcode.h:380
uint32_t h
Tool number or number of G76 thread spring passes.
Definition: gcode.h:415
uint8_t l
G10 or canned cycles parameters.
Definition: gcode.h:417
float u
Definition: gcode.h:399
float w
Definition: gcode.h:405
float b
Definition: gcode.h:393
float s
Spindle speed - single-meaning word.
Definition: gcode.h:388
uint32_t o
Subroutine identifier - single-meaning word (not used by the core)
Definition: gcode.h:414
tool_id_t t
Tool selection - single-meaning word.
Definition: gcode.h:416
float k
G33 distance per revolution.
Definition: gcode.h:383
float m
G65 argument.
Definition: gcode.h:384
float c
Definition: gcode.h:396
float f
Feed rate - single-meaning word.
Definition: gcode.h:381
Data for M62, M63 and M67 commands when executed synchronized with motion.
Definition: gcode.h:258
int32_t value
Definition: gcode.h:262
uint8_t port
Definition: gcode.h:261
bool is_digital
Definition: gcode.h:259
struct output_command * next
Definition: gcode.h:263
bool is_executed
Definition: gcode.h:260
Parser block structure.
Definition: gcode.h:593
spindle_ptrs_t * spindle
Spindle to control, NULL for all.
Definition: gcode.h:603
user_mcode_t user_mcode
Set > UserMCode_Ignore if a user M-code is found.
Definition: gcode.h:596
override_mode_t override_command
Override command TODO: add to non_modal above?
Definition: gcode.h:595
output_command_t output_command
Details about M62-M68 output command to execute if present in block.
Definition: gcode.h:601
gc_values_t values
Parameter values for block.
Definition: gcode.h:599
uint32_t arc_turns
Definition: gcode.h:602
bool user_mcode_sync
Set to true by M-code validation handler if M-code is to be executed after synchronization.
Definition: gcode.h:597
non_modal_t non_modal_command
Non modal command.
Definition: gcode.h:594
gc_modal_t modal
The current modal state is copied here before parsing starts.
Definition: gcode.h:598
parameter_words_t words
Bitfield for tracking found parameter values.
Definition: gcode.h:600
Parser state.
Definition: gcode.h:550
status_code_t last_error
The following variables are not cleared upon warm restart when COMPATIBILITY_LEVEL <= 1.
Definition: gcode.h:571
tool_data_t * tool
Tracks tool number and tool offset.
Definition: gcode.h:578
float distance_per_rev
Millimeters/rev.
Definition: gcode.h:555
bool file_run
Tracks % command.
Definition: gcode.h:566
spindle_t spindle
RPM.
Definition: gcode.h:553
int32_t line_number
Last line number sent.
Definition: gcode.h:561
gc_canned_t canned
Definition: gcode.h:552
bool tool_change
Definition: gcode.h:569
bool g92_coord_offset_applied
true when G92 offset applied
Definition: gcode.h:573
bool skip_blocks
true if skipping conditional blocks
Definition: gcode.h:570
bool is_laser_ppi_mode
Definition: gcode.h:567
tool_id_t tool_pending
Tool to be selected on next M6.
Definition: gcode.h:562
float feed_rate
Millimeters/min.
Definition: gcode.h:554
bool is_rpm_rate_adjusted
Definition: gcode.h:568
gc_modal_t modal
Definition: gcode.h:551
Definition: gcode.h:581
Data used for Constant Surface Speed (CSS) mode calculations.
Definition: spindle_control.h:295
Definition: gcode.h:468
spindle_state_t state
{M3,M4,M5}
Definition: gcode.h:469
spindle_rpm_mode_t rpm_mode
{G96,G97}
Definition: gcode.h:470
Handlers and data for spindle support.
Definition: spindle_control.h:267
Definition: gcode.h:540
float rpm
Spindle speed.
Definition: gcode.h:541
spindle_state_t state
Definition: gcode.h:542
spindle_ptrs_t * hal
Definition: gcode.h:544
spindle_css_data_t * css
Data used for Constant Surface Speed Mode calculations.
Definition: gcode.h:543
Tool data.
Definition: gcode.h:534
float radius
Radius of tool (currently unsupported)
Definition: gcode.h:536
tool_id_t tool_id
Tool number.
Definition: gcode.h:537
Definition: nuts_bolts.h:130
Definition: coolant_control.h:26
Coordinate data.
Definition: gcode.h:331
float y
Definition: gcode.h:335
float x
Definition: gcode.h:334
float z
Definition: gcode.h:336
Override flags.
Definition: gcode.h:318
uint8_t feed_hold_disable
Definition: gcode.h:322
uint8_t value
Definition: gcode.h:319
uint8_t spindle_rpm_disable
Definition: gcode.h:323
uint8_t parking_disable
Definition: gcode.h:324
uint8_t feed_rate_disable
Definition: gcode.h:321
uint8_t reserved
Definition: gcode.h:325
uint8_t sync
Definition: gcode.h:326
Parser flags for special cases.
Definition: gcode.h:300
uint16_t set_coolant
Definition: gcode.h:311
uint16_t spindle_force_sync
Definition: gcode.h:308
uint16_t laser_disable
Definition: gcode.h:309
uint16_t canned_cycle_change
Definition: gcode.h:304
uint16_t probe_is_away
Definition: gcode.h:306
uint16_t jog_motion
Definition: gcode.h:303
uint16_t reserved
Definition: gcode.h:313
uint16_t probe_is_no_error
Definition: gcode.h:307
uint16_t laser_is_motion
Definition: gcode.h:310
uint16_t value
Definition: gcode.h:301
uint16_t motion_mode_changed
Definition: gcode.h:312
uint16_t arc_is_clockwise
Definition: gcode.h:305
Parameter words found by parser - do not change order!
Definition: gcode.h:421
uint32_t a
A-axis.
Definition: gcode.h:426
uint32_t l
Number of repetitions in canned cycles, wait mode for M66.
Definition: gcode.h:437
uint32_t g
Unused (placeholder).
Definition: gcode.h:435
uint32_t b
B-axis.
Definition: gcode.h:427
uint32_t s
Spindle speed.
Definition: gcode.h:444
uint32_t d
Tool radius compensation.
Definition: gcode.h:432
uint32_t n
Line number.
Definition: gcode.h:439
uint32_t h
Tool length offset index.
Definition: gcode.h:436
uint32_t j
Y-axis offset for arcs.
Definition: gcode.h:430
uint32_t i
X-axis offset for arcs.
Definition: gcode.h:429
uint32_t e
Analog port number for M66 - M68.
Definition: gcode.h:433
uint32_t m
G65 argument.
Definition: gcode.h:438
uint32_t o
Subroutine identifier.
Definition: gcode.h:440
uint32_t p
Dwell time for G4 or in canned cycles, port number for M62 - M66.
Definition: gcode.h:441
uint32_t q
Feed increment for G83 canned cycle, tool number for M61, timeout for M66.
Definition: gcode.h:442
uint32_t y
Y-axis.
Definition: gcode.h:450
uint32_t v
V-axis.
Definition: gcode.h:447
uint32_t u
U-axis.
Definition: gcode.h:446
uint32_t x
X-axis.
Definition: gcode.h:449
uint32_t c
C-axis.
Definition: gcode.h:428
uint32_t w
W-axis.
Definition: gcode.h:448
uint32_t mask
All flags as a bitmap.
Definition: gcode.h:422
uint32_t z
Z-axis.
Definition: gcode.h:451
uint32_t k
Z-axis offset for arcs.
Definition: gcode.h:431
uint32_t r
Arc radius, canned cycle retract level.
Definition: gcode.h:443
uint32_t f
Feedrate.
Definition: gcode.h:434
uint32_t value
Synonymous with mask.
Definition: gcode.h:423
uint32_t t
Tool number.
Definition: gcode.h:445
Axis index to plane assignment.
Definition: gcode.h:362
uint8_t axis_linear
Definition: gcode.h:367
uint8_t axis_0
Definition: gcode.h:365
uint8_t axis_1
Definition: gcode.h:366
Definition: spindle_control.h:57