27 #define MAX_LINE_NUMBER 10000000
28 #define MAX_TOOL_NUMBER 255
30 #define AXIS_COMMAND_NONE 0
31 #define AXIS_COMMAND_NON_MODAL 1
32 #define AXIS_COMMAND_MOTION_MODE 2
33 #define AXIS_COMMAND_TOOL_LENGTH_OFFSET 3
34 parser_state_t gc_state;
38 #define FAIL(status) return(status);
76 uint8_t axis_0, axis_1, axis_linear;
77 uint8_t coord_select = 0;
80 uint8_t axis_words = 0;
81 uint8_t ijk_words = 0;
84 uint16_t command_words = 0;
85 uint16_t value_words = 0;
105 uint8_t char_counter;
108 uint8_t int_value = 0;
109 uint16_t mantissa = 0;
111 else { char_counter = 0; }
113 while (line[char_counter] != 0) {
116 letter = line[char_counter];
129 int_value = trunc(value);
130 mantissa = round(100*(value - int_value));
#define GC_PARSER_JOG_MOTION
void system_convert_array_steps_to_mpos(float *position, int32_t *steps)
Updates a machine 'position' array based on the 'step' array sent.
uint8_t read_float(char *line, uint8_t *char_counter, float *float_ptr)
Extracts a floating point value from a string. The following code is based loosely on...
void gc_sync_position()
Sets g-code parser position in mm. Input in steps. Called by the system abort and hard...
uint8_t gc_execute_line(char *line)
Executes one line of 0-terminated G-Code. The line is assumed to contain only uppercase.
void report_status_message(uint8_t status_code)
Handles the primary confirmation protocol response for streaming interfaces and human-feedback.
uint8_t settings_read_coord_data(uint8_t coord_select, float *coord_data)
Read selected coordinate data from EEPROM. Updates pointed coord_data value.
#define STATUS_BAD_NUMBER_FORMAT
#define STATUS_EXPECTED_COMMAND_LETTER
#define MOTION_MODE_LINEAR
G1 (Do not alter value)
NOTE: When this struct is zeroed, the above defines set the defaults for the system.
#define JOG_LINE_NUMBER
System motion line numbers must be zero.
uint8_t feed_rate
{G93,G94}
void gc_init()
Initialize the parser.
uint8_t coord_select
{G54,G55,G56,G57,G58,G59}
#define FEED_RATE_MODE_UNITS_PER_MIN
Modal Group G5: Feed rate mode.
int32_t sys_position[N_AXIS]
NOTE: These position variables may need to be declared as volatiles, if problems arise.
memset(pl_data, 0, sizeof(plan_line_data_t))
Zero pl_data struct.
memcpy(block_coord_system, gc_state.coord_system, sizeof(gc_state.coord_system))
#define GC_PARSER_NONE
Define gcode parser flags for handling special cases.
float coord_system[N_AXIS]
Current work coordinate system (G54+). Stores offset from absolute machine.
float position[N_AXIS]
Where the interpreter considers the tool to be at this point in the code.
uint8_t motion
{G0,G1,G2,G3,G38.2,G80}
#define STATUS_SETTING_READ_FAIL
parser_state_t gc_state
Declare gc extern struct.
#define AXIS_COMMAND_NONE