Tweak stepper shutdown test

This commit is contained in:
Scott Lahteine 2020-07-01 22:28:37 -05:00
parent 652c75ceb9
commit e25da63721

View file

@ -466,10 +466,12 @@ inline void manage_inactivity(const bool ignore_stepper_queue=false) {
const millis_t ms = millis(); const millis_t ms = millis();
// Prevent steppers timing-out in the middle of M600 // Prevent steppers timing-out in the middle of M600
#define STAY_TEST (BOTH(ADVANCED_PAUSE_FEATURE, PAUSE_PARK_NO_STEPPER_TIMEOUT) && did_pause_print) // unless PAUSE_PARK_NO_STEPPER_TIMEOUT is disabled
const bool parked_or_ignoring = ignore_stepper_queue ||
(BOTH(ADVANCED_PAUSE_FEATURE, PAUSE_PARK_NO_STEPPER_TIMEOUT) && did_pause_print);
if (STAY_TEST || ignore_stepper_queue) // Reset both the M18/M84 activity timeout and the M85 max 'kill' timeout
gcode.reset_stepper_timeout(ms); if (parked_or_ignoring) gcode.reset_stepper_timeout(ms);
if (gcode.stepper_max_timed_out(ms)) { if (gcode.stepper_max_timed_out(ms)) {
SERIAL_ERROR_START(); SERIAL_ERROR_START();
@ -477,17 +479,25 @@ inline void manage_inactivity(const bool ignore_stepper_queue=false) {
kill(); kill();
} }
// M18 / M94 : Handle steppers inactive time timeout
if (gcode.stepper_inactive_time) { if (gcode.stepper_inactive_time) {
static bool already_shutdown_steppers; // = false static bool already_shutdown_steppers; // = false
// Any moves in the planner? Resets both the M18/M84
// activity timeout and the M85 max 'kill' timeout
if (planner.has_blocks_queued()) if (planner.has_blocks_queued())
gcode.reset_stepper_timeout(ms); gcode.reset_stepper_timeout(ms);
else if (!STAY_TEST && !ignore_stepper_queue && gcode.stepper_inactive_timeout()) { else if (!parked_or_ignoring && gcode.stepper_inactive_timeout()) {
if (!already_shutdown_steppers) { if (!already_shutdown_steppers) {
already_shutdown_steppers = true; // L6470 SPI will consume 99% of free time without this already_shutdown_steppers = true; // L6470 SPI will consume 99% of free time without this
// Individual axes will be disabled if configured
if (ENABLED(DISABLE_INACTIVE_X)) DISABLE_AXIS_X(); if (ENABLED(DISABLE_INACTIVE_X)) DISABLE_AXIS_X();
if (ENABLED(DISABLE_INACTIVE_Y)) DISABLE_AXIS_Y(); if (ENABLED(DISABLE_INACTIVE_Y)) DISABLE_AXIS_Y();
if (ENABLED(DISABLE_INACTIVE_Z)) DISABLE_AXIS_Z(); if (ENABLED(DISABLE_INACTIVE_Z)) DISABLE_AXIS_Z();
if (ENABLED(DISABLE_INACTIVE_E)) disable_e_steppers(); if (ENABLED(DISABLE_INACTIVE_E)) disable_e_steppers();
#if BOTH(HAS_LCD_MENU, AUTO_BED_LEVELING_UBL) #if BOTH(HAS_LCD_MENU, AUTO_BED_LEVELING_UBL)
if (ubl.lcd_map_control) { if (ubl.lcd_map_control) {
ubl.lcd_map_control = false; ubl.lcd_map_control = false;