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

Go to the source code of this file.

Macros

#define SLEEP_SEC_PER_OVERFLOW   (65535.0*64.0/F_CPU)
 With 16-bit timer size and prescaler. More...
 
#define SLEEP_COUNT_MAX   (SLEEP_DURATION/SLEEP_SEC_PER_OVERFLOW)
 

Functions

void sleep_init ()
 Initialization routine for sleep timer. More...
 
 ISR (TIMER3_OVF_vect)
 Increment sleep counter with each timer overflow. More...
 
void sleep_check ()
 Checks running conditions for sleep. If satisfied, enables sleep countdown and executes. More...
 

Variables

volatile uint8_t sleep_counter
 

Macro Definition Documentation

#define SLEEP_COUNT_MAX   (SLEEP_DURATION/SLEEP_SEC_PER_OVERFLOW)

Definition at line 25 of file sleep.c.

#define SLEEP_SEC_PER_OVERFLOW   (65535.0*64.0/F_CPU)

With 16-bit timer size and prescaler.

Definition at line 24 of file sleep.c.

Function Documentation

ISR ( TIMER3_OVF_vect  )

Increment sleep counter with each timer overflow.

Definition at line 56 of file sleep.c.

void sleep_check ( )

Checks running conditions for sleep. If satisfied, enables sleep countdown and executes.

NOTE: Sleep procedures can be blocking, since Grbl isn't receiving any commands, nor moving.

NOTE: With overrides or in laser mode, modal spindle and coolant state are not guaranteed. Need

Definition at line 88 of file sleep.c.

void sleep_init ( )

Initialization routine for sleep timer.

Initialize sleep timer.

NOTE: By using an overflow interrupt, the timer is automatically reloaded upon overflow.

< Normal operation. Overflow.

< Stop timer

< Enable timer with 1/64 prescaler. ~66.8sec max with uint8 and 0.262sec/tick

Definition at line 40 of file sleep.c.

Variable Documentation

volatile uint8_t sleep_counter

Definition at line 27 of file sleep.c.