25 #define MAX_INT_DIGITS 8
35 uint8_t
read_float(
char *line, uint8_t *char_counter,
float *float_ptr)
37 char *ptr = line + *char_counter;
44 bool isnegative =
false;
48 }
else if (c ==
'+') {
56 bool isdecimal =
false;
62 if (isdecimal) { exp--; }
63 intval = (((intval << 2) + intval) << 1) + c;
65 if (!(isdecimal)) { exp++; }
67 }
else if (c == ((
'.'-
'0') & 0xff) && !(isdecimal)) {
76 if (!ndigit) {
return(
false); };
105 *char_counter = ptr - line - 1;
131 while ( ms-- ) { _delay_ms(1); }
143 }
else if (us < 100) {
146 }
else if (us < 1000) {
157 float hypot_f(
float x,
float y) {
return(sqrt(x*x + y*y)); }
163 float magnitude = 0.0;
164 for (idx=0; idx<
N_AXIS; idx++) {
165 if (vector[idx] != 0.0) {
166 magnitude += vector[idx]*vector[idx];
169 magnitude = sqrt(magnitude);
170 float inv_magnitude = 1.0/magnitude;
171 for (idx=0; idx<
N_AXIS; idx++) { vector[idx] *= inv_magnitude; }
180 for (idx=0; idx<
N_AXIS; idx++) {
181 if (unit_vec[idx] != 0) {
182 limit_value =
min(limit_value,fabs(max_value[idx]/unit_vec[idx]));
#define N_AXIS
Axis array index values. Must start with 0 and be continuous.
void delay_sec(float seconds, uint8_t mode)
Non-blocking delay function used for general operation and suspend features.
uint8_t read_float(char *line, uint8_t *char_counter, float *float_ptr)
Extracts a floating point value from a string. The following code is based loosely on...
void delay_us(uint32_t us)
Delays variable defined microseconds. Compiler compatibility fix for _delay_us(),.
#define DWELL_TIME_STEP
Time delay increments performed during a dwell. The default value is set at 50ms, which provides...
uint8_t suspend
System suspend bitflag variable that manages holds, cancels, and safety door.
float convert_delta_vector_to_unit_vector(float *vector)
#define SUSPEND_RESTART_RETRACT
Flag to indicate a retract from a restore parking motion.
uint8_t abort
System abort flag. Forces exit back to main loop for reset.
float limit_value_by_axis_maximum(float *max_value, float *unit_vec)
system_t sys
Declare system global variable structure.
#define MAX_INT_DIGITS
Maximum number of digits in int32 (and float)
void protocol_exec_rt_system()
Executes run-time commands, when required. This function primarily operates as Grbl's state...
float hypot_f(float x, float y)
Simple hypotenuse computation function.
void protocol_execute_realtime()
This function is the general interface to Grbl's real-time command execution system. It is called.
void delay_ms(uint16_t ms)
Delays variable defined milliseconds. Compiler compatibility fix for _delay_ms(),.