Go to the source code of this file.
Macros | |
#define | LINE_BUFFER_SIZE 256 |
Line buffer size from the serial input stream to be executed. More... | |
Functions | |
void | protocol_main_loop () |
Starts Grbl main loop. It handles all incoming characters from the serial port and executes. More... | |
void | protocol_execute_realtime () |
Checks and executes a realtime command at various stop points in main program. More... | |
void | protocol_exec_rt_system () |
Executes run-time commands, when required. This function primarily operates as Grbl's state. More... | |
void | protocol_auto_cycle_start () |
Executes the auto cycle feature, if enabled. More... | |
void | protocol_buffer_synchronize () |
Block until all buffered steps are executed. More... | |
#define LINE_BUFFER_SIZE 256 |
Line buffer size from the serial input stream to be executed.
Definition at line 26 of file protocol.h.
void protocol_auto_cycle_start | ( | ) |
Executes the auto cycle feature, if enabled.
Executes the auto cycle feature, if enabled.
NOTE: This function is called from the main loop, buffer sync, and mc_line() only and executes
< Check if there are any blocks in the buffer.
< If so, execute them!
Definition at line 194 of file protocol.c.
void protocol_buffer_synchronize | ( | ) |
Block until all buffered steps are executed.
Block until all buffered steps are executed.
< Check and execute run-time commands
Definition at line 177 of file protocol.c.
void protocol_exec_rt_system | ( | ) |
Executes run-time commands, when required. This function primarily operates as Grbl's state.
NOTE: Do not alter this unless you know exactly what you are doing!
< Temp variable to avoid calling volatile multiple times.
< Copy volatile sys_rt_exec_alarm.
< Enter only if any bit flag is true
< Set system alarm state
< Disable any existing reset
< Clear alarm
< Copy volatile sys_rt_exec_state.
< Only place this is set true.
< Nothing else to do but exit.
NOTE: Once hold is initiated, the system immediately enters a suspend state to block all
< Block, if already holding.
< Notify stepper module to recompute for hold deceleration.
< Initiate suspend state with active flag.
< Jog cancelled upon any hold event, except for sleeping.
NOTE: State is STATE_CYCLE.
NOTE: Safety door differs from feed holds by stopping everything no matter state, disables powered
< Actively restoring
NOTE: This flag doesn't change when the door closes, unlike sys.state. Ensures any parking motions
< Set to IDLE to immediately resume the cycle.
NOTE: For a safety door to resume, the switch must be closed, as indicated by HOLD state, and
< Set to restore in suspend routine and cycle start after.
< Restore step control to normal operation
< Break suspend state.
< Initialize step segment buffer before beginning cycle.
< Otherwise, do nothing. Set and resume IDLE state.
< Break suspend state.
NOTE: Bresenham algorithm variables are still maintained through both the planner and stepper
NOTE: EXEC_CYCLE_STOP is set by the stepper subsystem when a cycle or feed hold completes.
NOTE: Motion and jog cancel both immediately return to idle after the hold completes.
< For jog cancel, flush buffers and sync positions.
< Only occurs when safety door opens during jog.
< Copy volatile sys_rt_exec_motion_override
< Clear all motion override flags.
< Set to report change immediately
< Clear all accessory override flags.
NOTE: Unlike motion overrides, spindle overrides do not require a planner reinitialization.
< Set to report change immediately
NOTE: Report counters are set in spindle_set_state() when spindle stop is executed.
NOTE: Since coolant state always performs a planner sync whenever it changes, the current
< Report counter set in coolant_set_state().
Definition at line 223 of file protocol.c.
void protocol_execute_realtime | ( | ) |
Checks and executes a realtime command at various stop points in main program.
Checks and executes a realtime command at various stop points in main program.
NOTE: The sys_rt_exec_state variable flags are set by any process, step or serial interrupts, pinouts,
Definition at line 213 of file protocol.c.
void protocol_main_loop | ( | ) |
Starts Grbl main loop. It handles all incoming characters from the serial port and executes.
< Ensure alarm state is active.
NOTE: Sleep mode disables the stepper drivers and position can't be guaranteed.
< Ensure alarm state is set.
< Enter safety door mode. Should return as IDLE state.
< Execute startup script.
< End of line reached
< Runtime command check point.
< Set string termination character.
NOTE: If supported, would simply need to check the system if block delete is enabled.
NOTE: This doesn't follow the NIST definition exactly, but is good enough for now.
NOTE: ';' comment to EOL is a LinuxCNC definition. Not NIST.
NOTE: This maybe installed to tell Grbl when a program is running vs manual input,
< Upcase lowercase
< Runtime command check point.
Never reached
Definition at line 37 of file protocol.c.