gnea\grbl-Mega  1.0f
Source Code Documentation ( Internal Workings )
system.c File Reference
#include "grbl.h"

Go to the source code of this file.

Functions

void system_init ()
 Initialize the serial protocol. More...
 
uint8_t system_control_get_state ()
 Returns control pin state as a uint8 bitfield. Each bit indicates the input pin state, where. More...
 
 ISR (CONTROL_INT_vect)
 Pin change interrupt for pin-out commands, i.e. cycle start, feed hold, and reset. Sets. More...
 
uint8_t system_check_safety_door_ajar ()
 Returns if safety door is ajar(T) or closed(F), based on pin state. More...
 
void system_execute_startup (char *line)
 Executes user startup script, if stored. More...
 
uint8_t system_execute_line (char *line)
 Directs and executes one line of formatted input from protocol_process. While mostly. More...
 
void system_flag_wco_change ()
 
float system_convert_axis_steps_to_mpos (int32_t *steps, uint8_t idx)
 Returns machine position of axis 'idx'. Must be sent a 'step' array. More...
 
void system_convert_array_steps_to_mpos (float *position, int32_t *steps)
 Updates a machine 'position' array based on the 'step' array sent. More...
 
uint8_t system_check_travel_limits (float *target)
 CoreXY calculation only. Returns x or y-axis "steps" based on CoreXY motor steps. More...
 
void system_set_exec_state_flag (uint8_t mask)
 Special handlers for setting and clearing Grbl's real-time execution flags. More...
 
void system_clear_exec_state_flag (uint8_t mask)
 
void system_set_exec_alarm (uint8_t code)
 
void system_clear_exec_alarm ()
 
void system_set_exec_motion_override_flag (uint8_t mask)
 
void system_set_exec_accessory_override_flag (uint8_t mask)
 
void system_clear_exec_motion_overrides ()
 
void system_clear_exec_accessory_overrides ()
 

Function Documentation

ISR ( CONTROL_INT_vect  )

Pin change interrupt for pin-out commands, i.e. cycle start, feed hold, and reset. Sets.

Definition at line 59 of file system.c.

uint8_t system_check_safety_door_ajar ( )

Returns if safety door is ajar(T) or closed(F), based on pin state.

Returns if safety door is open or closed, based on pin state.

Definition at line 76 of file system.c.

uint8_t system_check_travel_limits ( float *  target)

CoreXY calculation only. Returns x or y-axis "steps" based on CoreXY motor steps.

Checks and reports if target array exceeds machine travel limits.

NOTE: max_travel is stored as negative

Definition at line 317 of file system.c.

void system_clear_exec_accessory_overrides ( )

Definition at line 389 of file system.c.

void system_clear_exec_alarm ( )

Definition at line 361 of file system.c.

void system_clear_exec_motion_overrides ( )

Definition at line 382 of file system.c.

void system_clear_exec_state_flag ( uint8_t  mask)

Definition at line 347 of file system.c.

uint8_t system_control_get_state ( )

Returns control pin state as a uint8 bitfield. Each bit indicates the input pin state, where.

Returns bitfield of control pin states, organized by CONTROL_PIN_INDEX. (1=triggered, 0=not triggered).

Definition at line 39 of file system.c.

void system_convert_array_steps_to_mpos ( float *  position,
int32_t *  steps 
)

Updates a machine 'position' array based on the 'step' array sent.

Definition at line 295 of file system.c.

float system_convert_axis_steps_to_mpos ( int32_t *  steps,
uint8_t  idx 
)

Returns machine position of axis 'idx'. Must be sent a 'step' array.

NOTE: If motor steps and machine position are not in the same coordinate frame, this function

Definition at line 277 of file system.c.

uint8_t system_execute_line ( char *  line)

Directs and executes one line of formatted input from protocol_process. While mostly.

Executes an internal system command, defined as a string starting with a '$'.

< Helper variable

< Jogging

<

NOTE: $J= is ignored inside g-code parser and used to detect jog motions.

< Prints Grbl settings

< Prints gcode parser state

Todo:
Move this to realtime commands for GUIs to request this data during suspend-state.

< Set check g-code mode [IDLE/CHECK]

< Disable alarm lock [ALARM]

< Print Grbl NGC parameters

< Perform homing cycle [IDLE/ALARM]

< Set system state variable

< Execute startup scripts after successful homing.

< Set to IDLE when complete.

< Set steppers to the settings idle state before returning.

< Puts Grbl to sleep [IDLE/ALARM]

< Set to execute sleep mode immediately

< Print or store build info. [IDLE/ALARM]

< Store startup line [IDLE/ALARM]

< Set helper variable as counter to start of user info line.

< Restore defaults [IDLE/ALARM]

< Force reset to ensure settings are initialized correctly.

< Startup lines. [IDLE/ALARM]

< Print startup lines

< Store startup line [IDLE Only] Prevents motion during ALARM.

< Set helper_var to flag storing method.

< Storing setting methods [IDLE/ALARM]

< Store startup line

< Set helper variable as counter to start of gcode block

< Set helper_var to returned status code.

< Set helper_var to int value of parameter

< Store global setting.

< If '$' command makes it to here, then everything's ok.

Definition at line 106 of file system.c.

void system_execute_startup ( char *  line)

Executes user startup script, if stored.

Execute the startup script lines stored in EEPROM upon initialization.

Definition at line 82 of file system.c.

void system_flag_wco_change ( )

Definition at line 265 of file system.c.

void system_init ( )

Initialize the serial protocol.

< Configure as input pins

< Enable internal pull-up resistors. Normal high operation.

< Enable specific pins of the Pin Change Interrupt

< Enable Pin Change Interrupt

Definition at line 24 of file system.c.

void system_set_exec_accessory_override_flag ( uint8_t  mask)

Definition at line 375 of file system.c.

void system_set_exec_alarm ( uint8_t  code)

Definition at line 354 of file system.c.

void system_set_exec_motion_override_flag ( uint8_t  mask)

Definition at line 368 of file system.c.

void system_set_exec_state_flag ( uint8_t  mask)

Special handlers for setting and clearing Grbl's real-time execution flags.

Definition at line 340 of file system.c.