33 static void report_util_line_feed() {
printPgmString(PSTR(
"\r\n")); }
34 static void report_util_feedback_line_feed() {
serial_write(
']'); report_util_line_feed(); }
35 static void report_util_gcode_modes_G() {
printPgmString(PSTR(
" G")); }
36 static void report_util_gcode_modes_M() {
printPgmString(PSTR(
" M")); }
38 static void report_util_axis_values(
float *axis_value) {
40 for (idx=0; idx<
N_AXIS; idx++) {
93 static void report_util_uint8_setting(uint8_t n,
int val) {
96 report_util_line_feed();
98 static void report_util_float_setting(uint8_t n,
float val, uint8_t n_decimal) {
101 report_util_line_feed();
112 switch(status_code) {
118 report_util_line_feed();
126 report_util_line_feed();
138 switch(message_code) {
162 report_util_feedback_line_feed();
172 printPgmString(PSTR(
"[HLP:$$ $# $G $I $N $x=val $Nx=line $J=line $SLP $C $X $H ~ ! ? ctrl-x]\r\n"));
203 uint8_t idx, set_idx;
206 for (idx=0; idx<
N_AXIS; idx++) {
225 float print_position[
N_AXIS];
227 report_util_axis_values(print_position);
230 report_util_feedback_line_feed();
237 uint8_t coord_select;
244 switch (coord_select) {
250 report_util_axis_values(coord_data);
251 report_util_feedback_line_feed();
255 report_util_feedback_line_feed();
258 report_util_feedback_line_feed();
273 report_util_gcode_modes_G();
276 report_util_gcode_modes_G();
279 report_util_gcode_modes_G();
282 report_util_gcode_modes_G();
285 report_util_gcode_modes_G();
289 report_util_gcode_modes_M();
300 report_util_gcode_modes_M();
307 report_util_gcode_modes_M();
322 report_util_feedback_line_feed();
331 report_util_line_feed();
346 report_util_feedback_line_feed();
354 #ifdef PARKING_ENABLE
357 #ifdef HOMING_FORCE_SET_ORIGIN
360 #ifdef HOMING_SINGLE_AXIS_COMMANDS
363 #ifdef LIMITS_TWO_SWITCHES_ON_AXES
366 #ifdef ALLOW_FEED_OVERRIDE_DURING_PROBE_CYCLES
369 #ifndef ENABLE_RESTORE_EEPROM_WIPE_ALL
373 #ifndef ENABLE_RESTORE_EEPROM_DEFAULT_SETTINGS
377 #ifndef ENABLE_RESTORE_EEPROM_CLEAR_PARAMETERS
381 #ifndef ENABLE_BUILD_INFO_WRITE_COMMAND
385 #ifndef FORCE_BUFFER_SYNC_DURING_EEPROM_WRITE
389 #ifndef FORCE_BUFFER_SYNC_DURING_WCO_CHANGE
397 report_util_feedback_line_feed();
405 report_util_feedback_line_feed();
417 int32_t current_position[
N_AXIS];
419 float print_position[
N_AXIS];
460 for (idx=0; idx<
N_AXIS; idx++) {
465 print_position[idx] -= wco[idx];
476 report_util_axis_values(print_position);
479 #ifdef REPORT_FIELD_BUFFER_STATE
488 #ifdef REPORT_FIELD_LINE_NUMBERS
491 if (cur_block != NULL) {
501 #ifdef REPORT_FIELD_CURRENT_FEED_SPEED
508 #ifdef REPORT_FIELD_PIN_STATE
512 if (lim_pin_state | ctrl_pin_state | prb_pin_state) {
520 if (ctrl_pin_state) {
521 #ifdef ENABLE_SAFETY_DOOR_INPUT_PIN
531 #ifdef REPORT_FIELD_WORK_COORD_OFFSET
539 report_util_axis_values(wco);
543 #ifdef REPORT_FIELD_OVERRIDES
558 if (sp_state || cl_state) {
571 report_util_line_feed();
576 void report_realtime_debug()
#define BITFLAG_INVERT_ST_ENABLE
plan_block_t * plan_get_current_block()
Returns address of first planner block, if available. Called by various main program functions...
void report_init_message()
Welcome message.
int32_t line_number
Block line number for real-time reporting. Copied from pl_line_data.
#define N_AXIS
Axis array index values. Must start with 0 and be continuous.
void report_grbl_help()
Grbl help message.
uint8_t probe_get_state()
Returns the probe pin state. Triggered = true. Called by gcode parser and probe state monitor...
void report_grbl_settings()
Grbl global settings print out.
#define STATE_HOLD
Active feed hold.
#define SPINDLE_ENABLE_CCW
NOTE: Uses planner condition bit flag)
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 spindle_speed_ovr
Spindle speed value in percent.
#define MESSAGE_SLEEP_MODE
#define SUSPEND_SAFETY_DOOR_AJAR
Tracks safety door state for resuming.
void printFloat_RateValue(float n)
void printFloat(float n, uint8_t decimal_places)
Convert float to string by immediately converting to a long integer, which contains.
#define PROGRAM_FLOW_PAUSED
M0.
float acceleration[N_AXIS]
uint8_t plane_select
NOTE: Don't track. Only default supported.
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 BITFLAG_RT_STATUS_POSITION_TYPE
Define status reporting boolean enable bit flags in settings.status_report_mask.
#define CONTROL_PIN_INDEX_FEED_HOLD
void report_alarm_message(uint8_t alarm_code)
Prints alarm messages.
#define BITFLAG_RT_STATUS_BUFFER_STATE
float tool_length_offset
Tracks tool length offset value when enabled.
void report_realtime_status()
Prints realtime status report.
#define SUSPEND_INITIATE_RESTORE
(Safety door only) Flag to initiate resume procedures from a cycle start.
#define REPORT_OVR_REFRESH_BUSY_COUNT
Some status report data isn't necessary for realtime, only intermittently, because the values don't...
void print_uint8_base10(uint8_t n)
void printIntegerInBase(unsigned long n, unsigned long base)
void printInteger(long n)
void report_ngc_parameters()
Prints Grbl NGC parameters (coordinate offsets, probing)
uint8_t suspend
System suspend bitflag variable that manages holds, cancels, and safety door.
#define MESSAGE_PROGRAM_END
void report_feedback_message(uint8_t message_code)
Prints feedback messages. This serves as a centralized method to provide additional.
#define PL_COND_FLAG_COOLANT_MIST
uint8_t status_report_mask
Mask to indicate desired report data.
uint8_t system_control_get_state()
Returns control pin state as a uint8 bitfield. Each bit indicates the input pin state, where.
#define MESSAGE_ALARM_LOCK
#define BITFLAG_SOFT_LIMIT_ENABLE
#define TOOL_LENGTH_OFFSET_AXIS
Sets the maximum step rate allowed to be written as a Grbl setting. This option enables an error...
#define REPORT_WCO_REFRESH_IDLE_COUNT
(2-255) Must be less than or equal to the busy count
float st_get_realtime_rate()
Called by realtime status reporting to fetch the current speed being executed. This value...
uint8_t state
Tracks the current system state of Grbl.
#define MOTION_MODE_PROBE_TOWARD
G38.2 (Do not alter value)
#define PROGRAM_FLOW_COMPLETED_M2
NOTE: Not supported, but valid and ignored.
float feed_rate
Millimeters/min.
#define MESSAGE_RESTORE_DEFAULTS
#define AXIS_SETTINGS_START_VAL
uint8_t spindle_get_state()
Returns current spindle output state. Overrides may alter it from programmed states.
#define PROGRAM_FLOW_COMPLETED_M30
M30 (Do not alter value)
uint8_t distance
{G90,G91}
#define BITFLAG_LASER_MODE
#define SUSPEND_RETRACT_COMPLETE
(Safety door only) Indicates retraction and de-energizing is complete.
uint8_t f_override
Feed rate override value in percent.
#define COOLANT_STATE_MIST
#define BITFLAG_HOMING_ENABLE
#define GRBL_VERSION_BUILD
#define REPORT_WCO_REFRESH_BUSY_COUNT
(2-255)
#define MESSAGE_CHECK_LIMITS
#define X_AXIS
Axis indexing value.
uint8_t report_wco_counter
Tracks when to add work coordinate offset data to status reports.
#define SPINDLE_DISABLE
Modal Group M7: Spindle control.
#define bit(n)
Bit field and masking macros.
#define AXIS_N_SETTINGS
Define Grbl axis settings numbering scheme. Starts at START_VAL, every INCREMENT, over N_SETTINGS...
uint8_t feed_rate
{G93,G94}
void printString(const char *s)
void serial_write(uint8_t data)
Writes one byte to the TX serial buffer. Called by main program.
#define STATE_SLEEP
Sleep state.
#define GRBL_VERSION
Grbl versioning system.
void report_startup_line(uint8_t n, char *line)
Prints specified startup line.
#define STATE_CYCLE
Cycle is running or motions are being executed.
#define CONTROL_PIN_INDEX_CYCLE_START
void report_build_info(char *line)
Prints build info line.
uint8_t flags
Contains default boolean settings.
uint8_t coord_select
{G54,G55,G56,G57,G58,G59}
#define STATE_CHECK_MODE
G-code check mode. Locks out planner and motion only.
#define PL_COND_FLAG_COOLANT_FLOOD
void report_probe_parameters()
Prints current probe parameters. Upon a probe command, these parameters are updated upon a...
void report_gcode_modes()
Print current gcode parser mode state.
uint8_t probe_succeeded
Tracks if last probing cycle was successful.
uint8_t coolant_get_state()
Returns current coolant output state. Overrides may alter it from programmed state.
#define MESSAGE_ALARM_UNLOCK
#define STATE_ALARM
In alarm state. Locks out all g-code processes. Allows settings access.
#define CONTROL_PIN_INDEX_RESET
#define N_DECIMAL_SETTINGVALUE
Decimals for floating point setting values.
void report_echo_line_received(char *line)
Prints the character string line Grbl has received from the user, which has been pre-parsed,.
system_t sys
Declare system global variable structure.
uint16_t homing_debounce_delay
int32_t sys_position[N_AXIS]
NOTE: These position variables may need to be declared as volatiles, if problems arise.
uint8_t report_ovr_counter
Tracks when to add override data to status reports.
#define MESSAGE_SAFETY_DOOR_AJAR
uint8_t coolant
{M7,M8,M9}
#define N_DECIMAL_RPMVALUE
RPM value in rotations per min.
float steps_per_mm[N_AXIS]
#define SPINDLE_ENABLE_CW
M3 (.
#define bit_isfalse(x, mask)
void printPgmString(const char *s)
Print a string stored in PGM-memory.
uint8_t plan_get_block_buffer_available()
Returns the number of available blocks are in the planner buffer.
#define BITFLAG_REPORT_INCHES
NOTE: Check settings_reset() when moving to next version.
#define CONTROL_PIN_INDEX_SAFETY_DOOR
#define BITFLAG_HARD_LIMIT_ENABLE
uint8_t spindle
{M3,M4,M5}
uint8_t serial_get_rx_buffer_available()
Returns the number of bytes available in the RX serial buffer.
memcpy(block_coord_system, gc_state.coord_system, sizeof(gc_state.coord_system))
uint8_t r_override
Rapids override value in percent.
#define MESSAGE_CRITICAL_EVENT
Define Grbl feedback message codes. Valid values (0-255).
uint8_t pulse_microseconds
void printFloat_CoordValue(float n)
Floating value printing handlers for special variables types used in Grbl and are defined...
void report_execute_startup_message(char *line, uint8_t status_code)
#define MESSAGE_SPINDLE_RESTORE
void report_util_setting_prefix(uint8_t n)
Internal report utilities to reduce flash with repetitive tasks turned into functions.
float coord_system[N_AXIS]
Current work coordinate system (G54+). Stores offset from absolute machine.
uint8_t program_flow
NOTE: Don't track. Only default supported.
#define COOLANT_STATE_FLOOD
uint8_t tool
Tracks tool number. NOT USED.
#define STATE_JOG
Jogging mode.
uint8_t motion
{G0,G1,G2,G3,G38.2,G80}
#define STATE_HOMING
Performing homing cycle.
int32_t sys_probe_position[N_AXIS]
Last probe position in machine coordinates and steps.
float coord_offset[N_AXIS]
Retains the G92 coordinate offset (work coordinates) relative to.
#define BITFLAG_INVERT_LIMIT_PINS
#define AXIS_SETTINGS_INCREMENT
NOTE: Reserving settings values >= 100 for axis settings. Up to 255.
#define SUSPEND_HOLD_COMPLETE
Indicates initial feed hold is complete.
#define SUSPEND_JOG_CANCEL
Indicates a jog cancel in process and to reset buffers when complete.
#define STATUS_SETTING_READ_FAIL
This struct stores a linear movement of a g-code block motion with its critical "nominal" values...
void delay_ms(uint16_t ms)
Delays variable defined milliseconds. Compiler compatibility fix for _delay_ms(),.
parser_state_t gc_state
Declare gc extern struct.
#define REPORT_OVR_REFRESH_IDLE_COUNT
(1-255) Must be less than or equal to the busy count
#define STATUS_OK
Define Grbl status codes. Valid values (0-255)
#define SETTING_INDEX_NCOORD
Total number of system stored (from index 0)
uint8_t limits_get_state()
Returns limit state as a bit-wise uint8 variable. Each bit indicates an axis limit, where.
uint8_t stepper_idle_lock_time
If max value 255, steppers do not disable.
#define STATE_IDLE
Define system state bit map. The state variable primarily tracks the individual functions.
#define bit_istrue(x, mask)
#define BITFLAG_INVERT_PROBE_PIN
#define STATE_SAFETY_DOOR
Safety door is ajar. Feed holds and de-energizes system.