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:
Sonny Jeon 2018-06-14 10:10:58 -06:00
parent a84aa1800c
commit 332acada88
13 changed files with 157 additions and 112 deletions

View file

@ -445,8 +445,10 @@ void protocol_exec_rt_system()
last_s_override = max(last_s_override,MIN_SPINDLE_SPEED_OVERRIDE);
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;
// 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
}
@ -461,8 +463,9 @@ void protocol_exec_rt_system()
// NOTE: Since coolant state always performs a planner sync whenever it changes, the current
// 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 ((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;
#ifdef ENABLE_M7
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_spindle_speed = gc_state.spindle_speed;
} else {
restore_condition = block->condition;
restore_condition = (block->condition & PL_COND_SPINDLE_MASK) | coolant_get_state();
restore_spindle_speed = block->spindle_speed;
}
#ifdef DISABLE_LASER_DURING_HOLD
@ -537,7 +540,7 @@ static void protocol_exec_rt_suspend()
#endif
#else
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
while (sys.suspend) {