24 #define SLEEP_SEC_PER_OVERFLOW (65535.0*64.0/F_CPU)
25 #define SLEEP_COUNT_MAX (SLEEP_DURATION/SLEEP_SEC_PER_OVERFLOW)
30 static void sleep_enable() {
37 static void sleep_disable() { TIMSK3 &= ~(1<<TOIE3); }
47 TCCR3B = (TCCR3B & ~((1<<CS32) | (1<<CS31))) | (1<<CS30);
50 TCCR3B |= (1<<CS31)|(1<<CS30);
59 static void sleep_execute()
ISR(TIMER3_OVF_vect)
Increment sleep counter with each timer overflow.
#define STATE_HOLD
Active feed hold.
#define MESSAGE_SLEEP_MODE
void system_set_exec_state_flag(uint8_t mask)
Special handlers for setting and clearing Grbl's real-time execution flags.
uint8_t suspend
System suspend bitflag variable that manages holds, cancels, and safety door.
void report_feedback_message(uint8_t message_code)
Prints feedback messages. This serves as a centralized method to provide additional.
volatile uint8_t sleep_counter
void sleep_check()
Checks running conditions for sleep. If satisfied, enables sleep countdown and executes.
volatile uint8_t sys_rt_exec_alarm
Global realtime executor bitflag variable for setting various alarms.
uint8_t state
Tracks the current system state of Grbl.
#define SUSPEND_RETRACT_COMPLETE
(Safety door only) Indicates retraction and de-energizing is complete.
system_t sys
Declare system global variable structure.
uint8_t coolant
{M7,M8,M9}
uint8_t serial_get_rx_buffer_count()
Returns the number of bytes used in the RX serial buffer.
#define EXEC_SLEEP
bitmask 10000000
volatile uint8_t sys_rt_exec_state
Global realtime executor bitflag variable for state management. See EXEC bitmasks.
uint8_t spindle
{M3,M4,M5}
void sleep_init()
Initialization routine for sleep timer.
#define SUSPEND_HOLD_COMPLETE
Indicates initial feed hold is complete.
parser_state_t gc_state
Declare gc extern struct.
#define STATE_IDLE
Define system state bit map. The state variable primarily tracks the individual functions.
#define STATE_SAFETY_DOOR
Safety door is ajar. Feed holds and de-energizes system.