🐛 Prevent stepper sleep during long UBL idle (#22137)

This commit is contained in:
Scott Lahteine 2021-06-14 18:44:27 -05:00 committed by Scott Lahteine
parent dec083dcc1
commit 781257bc64
3 changed files with 10 additions and 11 deletions

View File

@ -421,19 +421,18 @@ void startOrResumeJob() {
* - Check if an idle but hot extruder needs filament extruded (EXTRUDER_RUNOUT_PREVENT) * - Check if an idle but hot extruder needs filament extruded (EXTRUDER_RUNOUT_PREVENT)
* - Pulse FET_SAFETY_PIN if it exists * - Pulse FET_SAFETY_PIN if it exists
*/ */
inline void manage_inactivity(const bool ignore_stepper_queue=false) { inline void manage_inactivity(const bool no_stepper_sleep=false) {
queue.get_available_commands(); queue.get_available_commands();
const millis_t ms = millis(); const millis_t ms = millis();
// Prevent steppers timing-out in the middle of M600 // Prevent steppers timing-out
// unless PAUSE_PARK_NO_STEPPER_TIMEOUT is disabled const bool do_reset_timeout = no_stepper_sleep
const bool parked_or_ignoring = ignore_stepper_queue
|| TERN0(PAUSE_PARK_NO_STEPPER_TIMEOUT, did_pause_print); || TERN0(PAUSE_PARK_NO_STEPPER_TIMEOUT, did_pause_print);
// Reset both the M18/M84 activity timeout and the M85 max 'kill' timeout // Reset both the M18/M84 activity timeout and the M85 max 'kill' timeout
if (parked_or_ignoring) gcode.reset_stepper_timeout(ms); if (do_reset_timeout) gcode.reset_stepper_timeout(ms);
if (gcode.stepper_max_timed_out(ms)) { if (gcode.stepper_max_timed_out(ms)) {
SERIAL_ERROR_MSG(STR_KILL_INACTIVE_TIME, parser.command_ptr); SERIAL_ERROR_MSG(STR_KILL_INACTIVE_TIME, parser.command_ptr);
@ -449,7 +448,7 @@ inline void manage_inactivity(const bool ignore_stepper_queue=false) {
// activity timeout and the M85 max 'kill' timeout // 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 (!parked_or_ignoring && gcode.stepper_inactive_timeout()) { else if (!do_reset_timeout && 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
@ -732,14 +731,14 @@ inline void manage_inactivity(const bool ignore_stepper_queue=false) {
* - Update the Průša MMU2 * - Update the Průša MMU2
* - Handle Joystick jogging * - Handle Joystick jogging
*/ */
void idle(TERN_(ADVANCED_PAUSE_FEATURE, bool no_stepper_sleep/*=false*/)) { void idle(bool no_stepper_sleep/*=false*/) {
#if ENABLED(MARLIN_DEV_MODE) #if ENABLED(MARLIN_DEV_MODE)
static uint16_t idle_depth = 0; static uint16_t idle_depth = 0;
if (++idle_depth > 5) SERIAL_ECHOLNPAIR("idle() call depth: ", idle_depth); if (++idle_depth > 5) SERIAL_ECHOLNPAIR("idle() call depth: ", idle_depth);
#endif #endif
// Core Marlin activities // Core Marlin activities
manage_inactivity(TERN_(ADVANCED_PAUSE_FEATURE, no_stepper_sleep)); manage_inactivity(no_stepper_sleep);
// Manage Heaters (and Watchdog) // Manage Heaters (and Watchdog)
thermalManager.manage_heater(); thermalManager.manage_heater();

View File

@ -34,8 +34,8 @@
void stop(); void stop();
// Pass true to keep steppers from timing out // Pass true to keep steppers from timing out
void idle(TERN_(ADVANCED_PAUSE_FEATURE, bool no_stepper_sleep=false)); void idle(bool no_stepper_sleep=false);
inline void idle_no_sleep() { idle(TERN_(ADVANCED_PAUSE_FEATURE, true)); } inline void idle_no_sleep() { idle(true); }
#if ENABLED(G38_PROBE_TARGET) #if ENABLED(G38_PROBE_TARGET)
extern uint8_t G38_move; // Flag to tell the ISR that G38 is in progress, and the type extern uint8_t G38_move; // Flag to tell the ISR that G38 is in progress, and the type

View File

@ -1025,7 +1025,7 @@ void set_message_with_feedback(PGM_P const msg_P) {
SET_SOFT_ENDSTOP_LOOSE(true); SET_SOFT_ENDSTOP_LOOSE(true);
do { do {
idle(); idle_no_sleep();
new_z = ui.ubl_mesh_value(); new_z = ui.ubl_mesh_value();
TERN_(UBL_MESH_EDIT_MOVES_Z, do_blocking_move_to_z(h_offset + new_z)); // Move the nozzle as the point is edited TERN_(UBL_MESH_EDIT_MOVES_Z, do_blocking_move_to_z(h_offset + new_z)); // Move the nozzle as the point is edited
SERIAL_FLUSH(); // Prevent host M105 buffer overrun. SERIAL_FLUSH(); // Prevent host M105 buffer overrun.