Spindle/coolant rare bug fixes. Free more flash.
[new] Altered the way default settings are stored and restored. Saved about 300 bytes(!) of flashed size. Should free up enough for certain configurations of CoreXY machines. [fix] When the optional M7 mist coolant IO was enabled, coolant overrides was not disabling correctly. [fix] Coolant override states was not restored correctly after a parking motion in certain situations. It would restore programmed state, rather than current overridden state. [fix] Now allow coolant overrides to operate during jogging motion. [fix] Invert control pin mask typo. [new] Added a new build info feedback mechanism for enabling the safety door input pin.
This commit is contained in:
parent
a84aa1800c
commit
332acada88
13 changed files with 157 additions and 112 deletions
|
|
@ -1,21 +1,22 @@
|
||||||
"OPT: Code"," Build-Option Description","State"
|
OPT: Code, Build-Option Description,State
|
||||||
"V","Variable spindle","Enabled"
|
V,Variable spindle,Enabled
|
||||||
"N","Line numbers","Enabled"
|
N,Line numbers,Enabled
|
||||||
"M","Mist coolant M7","Enabled"
|
M,Mist coolant M7,Enabled
|
||||||
"C","CoreXY","Enabled"
|
C,CoreXY,Enabled
|
||||||
"P","Parking motion","Enabled"
|
P,Parking motion,Enabled
|
||||||
"Z","Homing force origin","Enabled"
|
Z,Homing force origin,Enabled
|
||||||
"H","Homing single axis commands","Enabled"
|
H,Homing single axis commands,Enabled
|
||||||
"T","Two limit switches on axis","Enabled"
|
T,Two limit switches on axis,Enabled
|
||||||
"A","Allow feed rate overrides in probe cycles","Enabled"
|
A,Allow feed rate overrides in probe cycles,Enabled
|
||||||
"D","Use spindle direction as enable pin","Enabled"
|
D,Use spindle direction as enable pin,Enabled
|
||||||
"0","Spindle enable off when speed is zero","Enabled"
|
0,Spindle enable off when speed is zero,Enabled
|
||||||
"S","Software limit pin debouncing","Enabled"
|
S,Software limit pin debouncing,Enabled
|
||||||
"R","Parking override control","Enabled"
|
R,Parking override control,Enabled
|
||||||
"*","Restore all EEPROM command","Disabled"
|
+,Safety door input pin,Enabled
|
||||||
"$","Restore EEPROM `$` settings command","Disabled"
|
*,Restore all EEPROM command,Disabled
|
||||||
"#","Restore EEPROM parameter data command","Disabled"
|
$,Restore EEPROM `$` settings command,Disabled
|
||||||
"I","Build info write user string command","Disabled"
|
#,Restore EEPROM parameter data command,Disabled
|
||||||
"E","Force sync upon EEPROM write","Disabled"
|
I,Build info write user string command,Disabled
|
||||||
"W","Force sync upon work coordinate offset change","Disabled"
|
E,Force sync upon EEPROM write,Disabled
|
||||||
"L","Homing initialization auto-lock","Disabled"
|
W,Force sync upon work coordinate offset change,Disabled
|
||||||
|
L,Homing initialization auto-lock,Disabled
|
||||||
|
|
|
@ -1,3 +1,30 @@
|
||||||
|
----------------
|
||||||
|
Date: 2018-06-09
|
||||||
|
Author: Jon
|
||||||
|
Subject: Fix apparent error in restore masking that causes the call to coolant_set_state to not re-enable the mist (M7) output if it was previously enabled. (#469)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
----------------
|
||||||
|
Date: 2018-04-06
|
||||||
|
Author: Sonny Jeon
|
||||||
|
Subject: Updated instructions in fit_nonlinear_spindle.py
|
||||||
|
|
||||||
|
- repl.it has changed since the last time fit_nonlinear_spindle.py was tested. Updated instructions.
|
||||||
|
|
||||||
|
|
||||||
|
----------------
|
||||||
|
Date: 2017-08-01
|
||||||
|
Author: Sonny Jeon
|
||||||
|
Subject: Improved fix for rare lowering feed/rapid override bug.
|
||||||
|
|
||||||
|
[fix] In the previous hot fix, there was still (rarer) potential for
|
||||||
|
very small floating point errors incorrectly handle an override
|
||||||
|
deceleration and crash Grbl. Re-factored the if-then statement in terms
|
||||||
|
of speed changes, rather than distance, to completely eliminate the
|
||||||
|
issue.
|
||||||
|
|
||||||
|
|
||||||
----------------
|
----------------
|
||||||
Date: 2017-07-31
|
Date: 2017-07-31
|
||||||
Author: Sonny Jeon
|
Author: Sonny Jeon
|
||||||
|
|
|
||||||
|
|
@ -433,6 +433,7 @@ Feedback messages provide non-critical information on what Grbl is doing, what i
|
||||||
| **`S`** | Software limit pin debouncing enabled |
|
| **`S`** | Software limit pin debouncing enabled |
|
||||||
| **`R`** | Parking override control enabled |
|
| **`R`** | Parking override control enabled |
|
||||||
| **`A`** | Allow feed rate overrides in probe cycles |
|
| **`A`** | Allow feed rate overrides in probe cycles |
|
||||||
|
| **`+`** | Safety door input pin enabled |
|
||||||
| **`*`** | Restore all EEPROM disabled |
|
| **`*`** | Restore all EEPROM disabled |
|
||||||
| **`$`** | Restore EEPROM `$` settings disabled |
|
| **`$`** | Restore EEPROM `$` settings disabled |
|
||||||
| **`#`** | Restore EEPROM parameter data disabled |
|
| **`#`** | Restore EEPROM parameter data disabled |
|
||||||
|
|
|
||||||
|
|
@ -193,7 +193,7 @@
|
||||||
// NOTE: The top option will mask and invert all control pins. The bottom option is an example of
|
// NOTE: The top option will mask and invert all control pins. The bottom option is an example of
|
||||||
// inverting only two control pins, the safety door and reset. See cpu_map.h for other bit definitions.
|
// inverting only two control pins, the safety door and reset. See cpu_map.h for other bit definitions.
|
||||||
// #define INVERT_CONTROL_PIN_MASK CONTROL_MASK // Default disabled. Uncomment to disable.
|
// #define INVERT_CONTROL_PIN_MASK CONTROL_MASK // Default disabled. Uncomment to disable.
|
||||||
// #define INVERT_CONTROL_PIN_MASK ((1<<CONTROL_SAFETY_DOOR_BIT)|(CONTROL_RESET_BIT)) // Default disabled.
|
// #define INVERT_CONTROL_PIN_MASK ((1<<CONTROL_SAFETY_DOOR_BIT)|(1<<CONTROL_RESET_BIT)) // Default disabled.
|
||||||
|
|
||||||
// Inverts select limit pin states based on the following mask. This effects all limit pin functions,
|
// Inverts select limit pin states based on the following mask. This effects all limit pin functions,
|
||||||
// such as hard limits and homing. However, this is different from overall invert limits setting.
|
// such as hard limits and homing. However, this is different from overall invert limits setting.
|
||||||
|
|
|
||||||
|
|
@ -82,31 +82,36 @@ void coolant_set_state(uint8_t mode)
|
||||||
{
|
{
|
||||||
if (sys.abort) { return; } // Block during abort.
|
if (sys.abort) { return; } // Block during abort.
|
||||||
|
|
||||||
if (mode == COOLANT_DISABLE) {
|
if (mode & COOLANT_FLOOD_ENABLE) {
|
||||||
|
#ifdef INVERT_COOLANT_FLOOD_PIN
|
||||||
|
COOLANT_FLOOD_PORT &= ~(1 << COOLANT_FLOOD_BIT);
|
||||||
|
#else
|
||||||
|
COOLANT_FLOOD_PORT |= (1 << COOLANT_FLOOD_BIT);
|
||||||
|
#endif
|
||||||
|
} else {
|
||||||
|
#ifdef INVERT_COOLANT_FLOOD_PIN
|
||||||
|
COOLANT_FLOOD_PORT |= (1 << COOLANT_FLOOD_BIT);
|
||||||
|
#else
|
||||||
|
COOLANT_FLOOD_PORT &= ~(1 << COOLANT_FLOOD_BIT);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
coolant_stop();
|
#ifdef ENABLE_M7
|
||||||
|
if (mode & COOLANT_MIST_ENABLE) {
|
||||||
} else {
|
#ifdef INVERT_COOLANT_MIST_PIN
|
||||||
|
COOLANT_MIST_PORT &= ~(1 << COOLANT_MIST_BIT);
|
||||||
if (mode & COOLANT_FLOOD_ENABLE) {
|
#else
|
||||||
#ifdef INVERT_COOLANT_FLOOD_PIN
|
COOLANT_MIST_PORT |= (1 << COOLANT_MIST_BIT);
|
||||||
COOLANT_FLOOD_PORT &= ~(1 << COOLANT_FLOOD_BIT);
|
#endif
|
||||||
#else
|
} else {
|
||||||
COOLANT_FLOOD_PORT |= (1 << COOLANT_FLOOD_BIT);
|
#ifdef INVERT_COOLANT_MIST_PIN
|
||||||
#endif
|
COOLANT_MIST_PORT |= (1 << COOLANT_MIST_BIT);
|
||||||
}
|
#else
|
||||||
|
COOLANT_MIST_PORT &= ~(1 << COOLANT_MIST_BIT);
|
||||||
#ifdef ENABLE_M7
|
#endif
|
||||||
if (mode & COOLANT_MIST_ENABLE) {
|
}
|
||||||
#ifdef INVERT_COOLANT_MIST_PIN
|
#endif
|
||||||
COOLANT_MIST_PORT &= ~(1 << COOLANT_MIST_BIT);
|
|
||||||
#else
|
|
||||||
COOLANT_MIST_PORT |= (1 << COOLANT_MIST_BIT);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
}
|
|
||||||
sys.report_ovr_counter = 0; // Set to report change immediately
|
sys.report_ovr_counter = 0; // Set to report change immediately
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,8 +25,8 @@
|
||||||
#define COOLANT_FORCE_SYNC true
|
#define COOLANT_FORCE_SYNC true
|
||||||
|
|
||||||
#define COOLANT_STATE_DISABLE 0 // Must be zero
|
#define COOLANT_STATE_DISABLE 0 // Must be zero
|
||||||
#define COOLANT_STATE_FLOOD bit(0)
|
#define COOLANT_STATE_FLOOD PL_COND_FLAG_COOLANT_FLOOD
|
||||||
#define COOLANT_STATE_MIST bit(1)
|
#define COOLANT_STATE_MIST PL_COND_FLAG_COOLANT_MIST
|
||||||
|
|
||||||
|
|
||||||
// Initializes coolant control pins.
|
// Initializes coolant control pins.
|
||||||
|
|
|
||||||
|
|
@ -268,10 +268,10 @@ uint8_t gc_execute_line(char *line)
|
||||||
word_bit = MODAL_GROUP_M8;
|
word_bit = MODAL_GROUP_M8;
|
||||||
switch(int_value) {
|
switch(int_value) {
|
||||||
#ifdef ENABLE_M7
|
#ifdef ENABLE_M7
|
||||||
case 7: gc_block.modal.coolant = COOLANT_MIST_ENABLE; break;
|
case 7: gc_block.modal.coolant |= COOLANT_MIST_ENABLE; break;
|
||||||
#endif
|
#endif
|
||||||
case 8: gc_block.modal.coolant = COOLANT_FLOOD_ENABLE; break;
|
case 8: gc_block.modal.coolant |= COOLANT_FLOOD_ENABLE; break;
|
||||||
case 9: gc_block.modal.coolant = COOLANT_DISABLE; break;
|
case 9: gc_block.modal.coolant = COOLANT_DISABLE; break; // M9 disables both M7 and M8.
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#ifdef ENABLE_PARKING_OVERRIDE_CONTROL
|
#ifdef ENABLE_PARKING_OVERRIDE_CONTROL
|
||||||
|
|
@ -953,8 +953,7 @@ uint8_t gc_execute_line(char *line)
|
||||||
// NOTE: Coolant M-codes are modal. Only one command per line is allowed. But, multiple states
|
// NOTE: Coolant M-codes are modal. Only one command per line is allowed. But, multiple states
|
||||||
// can exist at the same time, while coolant disable clears all states.
|
// can exist at the same time, while coolant disable clears all states.
|
||||||
coolant_sync(gc_block.modal.coolant);
|
coolant_sync(gc_block.modal.coolant);
|
||||||
if (gc_block.modal.coolant == COOLANT_DISABLE) { gc_state.modal.coolant = COOLANT_DISABLE; }
|
gc_state.modal.coolant = gc_block.modal.coolant;
|
||||||
else { gc_state.modal.coolant |= gc_block.modal.coolant; }
|
|
||||||
}
|
}
|
||||||
pl_data->condition |= gc_state.modal.coolant; // Set condition flag for planner use.
|
pl_data->condition |= gc_state.modal.coolant; // Set condition flag for planner use.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,8 +22,8 @@
|
||||||
#define grbl_h
|
#define grbl_h
|
||||||
|
|
||||||
// Grbl versioning system
|
// Grbl versioning system
|
||||||
#define GRBL_VERSION "1.1f"
|
#define GRBL_VERSION "1.1g"
|
||||||
#define GRBL_VERSION_BUILD "20170801"
|
#define GRBL_VERSION_BUILD "20180614"
|
||||||
|
|
||||||
// Define standard libraries used by Grbl.
|
// Define standard libraries used by Grbl.
|
||||||
#include <avr/io.h>
|
#include <avr/io.h>
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,7 @@
|
||||||
#define PL_COND_FLAG_COOLANT_FLOOD bit(6)
|
#define PL_COND_FLAG_COOLANT_FLOOD bit(6)
|
||||||
#define PL_COND_FLAG_COOLANT_MIST bit(7)
|
#define PL_COND_FLAG_COOLANT_MIST bit(7)
|
||||||
#define PL_COND_MOTION_MASK (PL_COND_FLAG_RAPID_MOTION|PL_COND_FLAG_SYSTEM_MOTION|PL_COND_FLAG_NO_FEED_OVERRIDE)
|
#define PL_COND_MOTION_MASK (PL_COND_FLAG_RAPID_MOTION|PL_COND_FLAG_SYSTEM_MOTION|PL_COND_FLAG_NO_FEED_OVERRIDE)
|
||||||
|
#define PL_COND_SPINDLE_MASK (PL_COND_FLAG_SPINDLE_CW|PL_COND_FLAG_SPINDLE_CCW)
|
||||||
#define PL_COND_ACCESSORY_MASK (PL_COND_FLAG_SPINDLE_CW|PL_COND_FLAG_SPINDLE_CCW|PL_COND_FLAG_COOLANT_FLOOD|PL_COND_FLAG_COOLANT_MIST)
|
#define PL_COND_ACCESSORY_MASK (PL_COND_FLAG_SPINDLE_CW|PL_COND_FLAG_SPINDLE_CCW|PL_COND_FLAG_COOLANT_FLOOD|PL_COND_FLAG_COOLANT_MIST)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -445,8 +445,10 @@ void protocol_exec_rt_system()
|
||||||
last_s_override = max(last_s_override,MIN_SPINDLE_SPEED_OVERRIDE);
|
last_s_override = max(last_s_override,MIN_SPINDLE_SPEED_OVERRIDE);
|
||||||
|
|
||||||
if (last_s_override != sys.spindle_speed_ovr) {
|
if (last_s_override != sys.spindle_speed_ovr) {
|
||||||
bit_true(sys.step_control, STEP_CONTROL_UPDATE_SPINDLE_PWM);
|
|
||||||
sys.spindle_speed_ovr = last_s_override;
|
sys.spindle_speed_ovr = last_s_override;
|
||||||
|
// NOTE: Spindle speed overrides during HOLD state are taken care of by suspend function.
|
||||||
|
if (sys.state == STATE_IDLE) { spindle_set_state(gc_state.modal.spindle, gc_state.spindle_speed); }
|
||||||
|
else { bit_true(sys.step_control, STEP_CONTROL_UPDATE_SPINDLE_PWM); }
|
||||||
sys.report_ovr_counter = 0; // Set to report change immediately
|
sys.report_ovr_counter = 0; // Set to report change immediately
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -461,8 +463,9 @@ void protocol_exec_rt_system()
|
||||||
|
|
||||||
// NOTE: Since coolant state always performs a planner sync whenever it changes, the current
|
// NOTE: Since coolant state always performs a planner sync whenever it changes, the current
|
||||||
// run state can be determined by checking the parser state.
|
// run state can be determined by checking the parser state.
|
||||||
|
// NOTE: Coolant overrides only operate during IDLE, CYCLE, HOLD, and JOG states. Ignored otherwise.
|
||||||
if (rt_exec & (EXEC_COOLANT_FLOOD_OVR_TOGGLE | EXEC_COOLANT_MIST_OVR_TOGGLE)) {
|
if (rt_exec & (EXEC_COOLANT_FLOOD_OVR_TOGGLE | EXEC_COOLANT_MIST_OVR_TOGGLE)) {
|
||||||
if ((sys.state == STATE_IDLE) || (sys.state & (STATE_CYCLE | STATE_HOLD))) {
|
if ((sys.state == STATE_IDLE) || (sys.state & (STATE_CYCLE | STATE_HOLD | STATE_JOG))) {
|
||||||
uint8_t coolant_state = gc_state.modal.coolant;
|
uint8_t coolant_state = gc_state.modal.coolant;
|
||||||
#ifdef ENABLE_M7
|
#ifdef ENABLE_M7
|
||||||
if (rt_exec & EXEC_COOLANT_MIST_OVR_TOGGLE) {
|
if (rt_exec & EXEC_COOLANT_MIST_OVR_TOGGLE) {
|
||||||
|
|
@ -527,7 +530,7 @@ static void protocol_exec_rt_suspend()
|
||||||
restore_condition = (gc_state.modal.spindle | gc_state.modal.coolant);
|
restore_condition = (gc_state.modal.spindle | gc_state.modal.coolant);
|
||||||
restore_spindle_speed = gc_state.spindle_speed;
|
restore_spindle_speed = gc_state.spindle_speed;
|
||||||
} else {
|
} else {
|
||||||
restore_condition = block->condition;
|
restore_condition = (block->condition & PL_COND_SPINDLE_MASK) | coolant_get_state();
|
||||||
restore_spindle_speed = block->spindle_speed;
|
restore_spindle_speed = block->spindle_speed;
|
||||||
}
|
}
|
||||||
#ifdef DISABLE_LASER_DURING_HOLD
|
#ifdef DISABLE_LASER_DURING_HOLD
|
||||||
|
|
@ -537,7 +540,7 @@ static void protocol_exec_rt_suspend()
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
if (block == NULL) { restore_condition = (gc_state.modal.spindle | gc_state.modal.coolant); }
|
if (block == NULL) { restore_condition = (gc_state.modal.spindle | gc_state.modal.coolant); }
|
||||||
else { restore_condition = block->condition; }
|
else { restore_condition = (block->condition & PL_COND_SPINDLE_MASK) | coolant_get_state(); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
while (sys.suspend) {
|
while (sys.suspend) {
|
||||||
|
|
|
||||||
|
|
@ -412,6 +412,12 @@ void report_build_info(char *line)
|
||||||
#ifdef ENABLE_PARKING_OVERRIDE_CONTROL
|
#ifdef ENABLE_PARKING_OVERRIDE_CONTROL
|
||||||
serial_write('R');
|
serial_write('R');
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef HOMING_INIT_LOCK
|
||||||
|
serial_write('L');
|
||||||
|
#endif
|
||||||
|
#ifdef ENABLE_SAFETY_DOOR_INPUT_PIN
|
||||||
|
serial_write('+');
|
||||||
|
#endif
|
||||||
#ifndef ENABLE_RESTORE_EEPROM_WIPE_ALL // NOTE: Shown when disabled.
|
#ifndef ENABLE_RESTORE_EEPROM_WIPE_ALL // NOTE: Shown when disabled.
|
||||||
serial_write('*');
|
serial_write('*');
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -430,10 +436,6 @@ void report_build_info(char *line)
|
||||||
#ifndef FORCE_BUFFER_SYNC_DURING_WCO_CHANGE // NOTE: Shown when disabled.
|
#ifndef FORCE_BUFFER_SYNC_DURING_WCO_CHANGE // NOTE: Shown when disabled.
|
||||||
serial_write('W');
|
serial_write('W');
|
||||||
#endif
|
#endif
|
||||||
#ifndef HOMING_INIT_LOCK
|
|
||||||
serial_write('L');
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// NOTE: Compiled values, like override increments/max/min values, may be added at some point later.
|
// NOTE: Compiled values, like override increments/max/min values, may be added at some point later.
|
||||||
serial_write(',');
|
serial_write(',');
|
||||||
print_uint8_base10(BLOCK_BUFFER_SIZE-1);
|
print_uint8_base10(BLOCK_BUFFER_SIZE-1);
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,42 @@
|
||||||
|
|
||||||
settings_t settings;
|
settings_t settings;
|
||||||
|
|
||||||
|
const __flash settings_t defaults = {\
|
||||||
|
.pulse_microseconds = DEFAULT_STEP_PULSE_MICROSECONDS,
|
||||||
|
.stepper_idle_lock_time = DEFAULT_STEPPER_IDLE_LOCK_TIME,
|
||||||
|
.step_invert_mask = DEFAULT_STEPPING_INVERT_MASK,
|
||||||
|
.dir_invert_mask = DEFAULT_DIRECTION_INVERT_MASK,
|
||||||
|
.status_report_mask = DEFAULT_STATUS_REPORT_MASK,
|
||||||
|
.junction_deviation = DEFAULT_JUNCTION_DEVIATION,
|
||||||
|
.arc_tolerance = DEFAULT_ARC_TOLERANCE,
|
||||||
|
.rpm_max = DEFAULT_SPINDLE_RPM_MAX,
|
||||||
|
.rpm_min = DEFAULT_SPINDLE_RPM_MIN,
|
||||||
|
.homing_dir_mask = DEFAULT_HOMING_DIR_MASK,
|
||||||
|
.homing_feed_rate = DEFAULT_HOMING_FEED_RATE,
|
||||||
|
.homing_seek_rate = DEFAULT_HOMING_SEEK_RATE,
|
||||||
|
.homing_debounce_delay = DEFAULT_HOMING_DEBOUNCE_DELAY,
|
||||||
|
.homing_pulloff = DEFAULT_HOMING_PULLOFF,
|
||||||
|
.flags = (DEFAULT_REPORT_INCHES << BIT_REPORT_INCHES) | \
|
||||||
|
(DEFAULT_LASER_MODE << BIT_LASER_MODE) | \
|
||||||
|
(DEFAULT_INVERT_ST_ENABLE << BIT_INVERT_ST_ENABLE) | \
|
||||||
|
(DEFAULT_HARD_LIMIT_ENABLE << BIT_HARD_LIMIT_ENABLE) | \
|
||||||
|
(DEFAULT_HOMING_ENABLE << BIT_HOMING_ENABLE) | \
|
||||||
|
(DEFAULT_SOFT_LIMIT_ENABLE << BIT_SOFT_LIMIT_ENABLE) | \
|
||||||
|
(DEFAULT_INVERT_LIMIT_PINS << BIT_INVERT_LIMIT_PINS) | \
|
||||||
|
(DEFAULT_INVERT_PROBE_PIN << BIT_INVERT_PROBE_PIN),
|
||||||
|
.steps_per_mm[X_AXIS] = DEFAULT_X_STEPS_PER_MM,
|
||||||
|
.steps_per_mm[Y_AXIS] = DEFAULT_Y_STEPS_PER_MM,
|
||||||
|
.steps_per_mm[Z_AXIS] = DEFAULT_Z_STEPS_PER_MM,
|
||||||
|
.max_rate[X_AXIS] = DEFAULT_X_MAX_RATE,
|
||||||
|
.max_rate[Y_AXIS] = DEFAULT_Y_MAX_RATE,
|
||||||
|
.max_rate[Z_AXIS] = DEFAULT_Z_MAX_RATE,
|
||||||
|
.acceleration[X_AXIS] = DEFAULT_X_ACCELERATION,
|
||||||
|
.acceleration[Y_AXIS] = DEFAULT_Y_ACCELERATION,
|
||||||
|
.acceleration[Z_AXIS] = DEFAULT_Z_ACCELERATION,
|
||||||
|
.max_travel[X_AXIS] = (-DEFAULT_X_MAX_TRAVEL),
|
||||||
|
.max_travel[Y_AXIS] = (-DEFAULT_Y_MAX_TRAVEL),
|
||||||
|
.max_travel[Z_AXIS] = (-DEFAULT_Z_MAX_TRAVEL)};
|
||||||
|
|
||||||
|
|
||||||
// Method to store startup lines into EEPROM
|
// Method to store startup lines into EEPROM
|
||||||
void settings_store_startup_line(uint8_t n, char *line)
|
void settings_store_startup_line(uint8_t n, char *line)
|
||||||
|
|
@ -66,47 +102,8 @@ void write_global_settings()
|
||||||
|
|
||||||
// Method to restore EEPROM-saved Grbl global settings back to defaults.
|
// Method to restore EEPROM-saved Grbl global settings back to defaults.
|
||||||
void settings_restore(uint8_t restore_flag) {
|
void settings_restore(uint8_t restore_flag) {
|
||||||
if (restore_flag & SETTINGS_RESTORE_DEFAULTS) {
|
if (restore_flag & SETTINGS_RESTORE_DEFAULTS) {
|
||||||
settings.pulse_microseconds = DEFAULT_STEP_PULSE_MICROSECONDS;
|
settings = defaults;
|
||||||
settings.stepper_idle_lock_time = DEFAULT_STEPPER_IDLE_LOCK_TIME;
|
|
||||||
settings.step_invert_mask = DEFAULT_STEPPING_INVERT_MASK;
|
|
||||||
settings.dir_invert_mask = DEFAULT_DIRECTION_INVERT_MASK;
|
|
||||||
settings.status_report_mask = DEFAULT_STATUS_REPORT_MASK;
|
|
||||||
settings.junction_deviation = DEFAULT_JUNCTION_DEVIATION;
|
|
||||||
settings.arc_tolerance = DEFAULT_ARC_TOLERANCE;
|
|
||||||
|
|
||||||
settings.rpm_max = DEFAULT_SPINDLE_RPM_MAX;
|
|
||||||
settings.rpm_min = DEFAULT_SPINDLE_RPM_MIN;
|
|
||||||
|
|
||||||
settings.homing_dir_mask = DEFAULT_HOMING_DIR_MASK;
|
|
||||||
settings.homing_feed_rate = DEFAULT_HOMING_FEED_RATE;
|
|
||||||
settings.homing_seek_rate = DEFAULT_HOMING_SEEK_RATE;
|
|
||||||
settings.homing_debounce_delay = DEFAULT_HOMING_DEBOUNCE_DELAY;
|
|
||||||
settings.homing_pulloff = DEFAULT_HOMING_PULLOFF;
|
|
||||||
|
|
||||||
settings.flags = 0;
|
|
||||||
if (DEFAULT_REPORT_INCHES) { settings.flags |= BITFLAG_REPORT_INCHES; }
|
|
||||||
if (DEFAULT_LASER_MODE) { settings.flags |= BITFLAG_LASER_MODE; }
|
|
||||||
if (DEFAULT_INVERT_ST_ENABLE) { settings.flags |= BITFLAG_INVERT_ST_ENABLE; }
|
|
||||||
if (DEFAULT_HARD_LIMIT_ENABLE) { settings.flags |= BITFLAG_HARD_LIMIT_ENABLE; }
|
|
||||||
if (DEFAULT_HOMING_ENABLE) { settings.flags |= BITFLAG_HOMING_ENABLE; }
|
|
||||||
if (DEFAULT_SOFT_LIMIT_ENABLE) { settings.flags |= BITFLAG_SOFT_LIMIT_ENABLE; }
|
|
||||||
if (DEFAULT_INVERT_LIMIT_PINS) { settings.flags |= BITFLAG_INVERT_LIMIT_PINS; }
|
|
||||||
if (DEFAULT_INVERT_PROBE_PIN) { settings.flags |= BITFLAG_INVERT_PROBE_PIN; }
|
|
||||||
|
|
||||||
settings.steps_per_mm[X_AXIS] = DEFAULT_X_STEPS_PER_MM;
|
|
||||||
settings.steps_per_mm[Y_AXIS] = DEFAULT_Y_STEPS_PER_MM;
|
|
||||||
settings.steps_per_mm[Z_AXIS] = DEFAULT_Z_STEPS_PER_MM;
|
|
||||||
settings.max_rate[X_AXIS] = DEFAULT_X_MAX_RATE;
|
|
||||||
settings.max_rate[Y_AXIS] = DEFAULT_Y_MAX_RATE;
|
|
||||||
settings.max_rate[Z_AXIS] = DEFAULT_Z_MAX_RATE;
|
|
||||||
settings.acceleration[X_AXIS] = DEFAULT_X_ACCELERATION;
|
|
||||||
settings.acceleration[Y_AXIS] = DEFAULT_Y_ACCELERATION;
|
|
||||||
settings.acceleration[Z_AXIS] = DEFAULT_Z_ACCELERATION;
|
|
||||||
settings.max_travel[X_AXIS] = (-DEFAULT_X_MAX_TRAVEL);
|
|
||||||
settings.max_travel[Y_AXIS] = (-DEFAULT_Y_MAX_TRAVEL);
|
|
||||||
settings.max_travel[Z_AXIS] = (-DEFAULT_Z_MAX_TRAVEL);
|
|
||||||
|
|
||||||
write_global_settings();
|
write_global_settings();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,14 +30,23 @@
|
||||||
#define SETTINGS_VERSION 10 // NOTE: Check settings_reset() when moving to next version.
|
#define SETTINGS_VERSION 10 // NOTE: Check settings_reset() when moving to next version.
|
||||||
|
|
||||||
// Define bit flag masks for the boolean settings in settings.flag.
|
// Define bit flag masks for the boolean settings in settings.flag.
|
||||||
#define BITFLAG_REPORT_INCHES bit(0)
|
#define BIT_REPORT_INCHES 0
|
||||||
#define BITFLAG_LASER_MODE bit(1)
|
#define BIT_LASER_MODE 1
|
||||||
#define BITFLAG_INVERT_ST_ENABLE bit(2)
|
#define BIT_INVERT_ST_ENABLE 2
|
||||||
#define BITFLAG_HARD_LIMIT_ENABLE bit(3)
|
#define BIT_HARD_LIMIT_ENABLE 3
|
||||||
#define BITFLAG_HOMING_ENABLE bit(4)
|
#define BIT_HOMING_ENABLE 4
|
||||||
#define BITFLAG_SOFT_LIMIT_ENABLE bit(5)
|
#define BIT_SOFT_LIMIT_ENABLE 5
|
||||||
#define BITFLAG_INVERT_LIMIT_PINS bit(6)
|
#define BIT_INVERT_LIMIT_PINS 6
|
||||||
#define BITFLAG_INVERT_PROBE_PIN bit(7)
|
#define BIT_INVERT_PROBE_PIN 7
|
||||||
|
|
||||||
|
#define BITFLAG_REPORT_INCHES bit(BIT_REPORT_INCHES)
|
||||||
|
#define BITFLAG_LASER_MODE bit(BIT_LASER_MODE)
|
||||||
|
#define BITFLAG_INVERT_ST_ENABLE bit(BIT_INVERT_ST_ENABLE)
|
||||||
|
#define BITFLAG_HARD_LIMIT_ENABLE bit(BIT_HARD_LIMIT_ENABLE)
|
||||||
|
#define BITFLAG_HOMING_ENABLE bit(BIT_HOMING_ENABLE)
|
||||||
|
#define BITFLAG_SOFT_LIMIT_ENABLE bit(BIT_SOFT_LIMIT_ENABLE)
|
||||||
|
#define BITFLAG_INVERT_LIMIT_PINS bit(BIT_INVERT_LIMIT_PINS)
|
||||||
|
#define BITFLAG_INVERT_PROBE_PIN bit(BIT_INVERT_PROBE_PIN)
|
||||||
|
|
||||||
// Define status reporting boolean enable bit flags in settings.status_report_mask
|
// Define status reporting boolean enable bit flags in settings.status_report_mask
|
||||||
#define BITFLAG_RT_STATUS_POSITION_TYPE bit(0)
|
#define BITFLAG_RT_STATUS_POSITION_TYPE bit(0)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue