Browse Source

Tweak stepper shutdown test

Scott Lahteine 4 years ago
parent
commit
e25da63721
1 changed files with 14 additions and 4 deletions
  1. 14
    4
      Marlin/src/MarlinCore.cpp

+ 14
- 4
Marlin/src/MarlinCore.cpp View File

@@ -466,10 +466,12 @@ inline void manage_inactivity(const bool ignore_stepper_queue=false) {
466 466
   const millis_t ms = millis();
467 467
 
468 468
   // Prevent steppers timing-out in the middle of M600
469
-  #define STAY_TEST (BOTH(ADVANCED_PAUSE_FEATURE, PAUSE_PARK_NO_STEPPER_TIMEOUT) && did_pause_print)
469
+  // unless PAUSE_PARK_NO_STEPPER_TIMEOUT is disabled
470
+  const bool parked_or_ignoring = ignore_stepper_queue ||
471
+     (BOTH(ADVANCED_PAUSE_FEATURE, PAUSE_PARK_NO_STEPPER_TIMEOUT) && did_pause_print);
470 472
 
471
-  if (STAY_TEST || ignore_stepper_queue)
472
-    gcode.reset_stepper_timeout(ms);
473
+  // Reset both the M18/M84 activity timeout and the M85 max 'kill' timeout
474
+  if (parked_or_ignoring) gcode.reset_stepper_timeout(ms);
473 475
 
474 476
   if (gcode.stepper_max_timed_out(ms)) {
475 477
     SERIAL_ERROR_START();
@@ -477,17 +479,25 @@ inline void manage_inactivity(const bool ignore_stepper_queue=false) {
477 479
     kill();
478 480
   }
479 481
 
482
+  // M18 / M94 : Handle steppers inactive time timeout
480 483
   if (gcode.stepper_inactive_time) {
484
+
481 485
     static bool already_shutdown_steppers; // = false
486
+
487
+    // Any moves in the planner? Resets both the M18/M84
488
+    // activity timeout and the M85 max 'kill' timeout
482 489
     if (planner.has_blocks_queued())
483 490
       gcode.reset_stepper_timeout(ms);
484
-    else if (!STAY_TEST && !ignore_stepper_queue && gcode.stepper_inactive_timeout()) {
491
+    else if (!parked_or_ignoring && gcode.stepper_inactive_timeout()) {
485 492
       if (!already_shutdown_steppers) {
486 493
         already_shutdown_steppers = true;  // L6470 SPI will consume 99% of free time without this
494
+
495
+        // Individual axes will be disabled if configured
487 496
         if (ENABLED(DISABLE_INACTIVE_X)) DISABLE_AXIS_X();
488 497
         if (ENABLED(DISABLE_INACTIVE_Y)) DISABLE_AXIS_Y();
489 498
         if (ENABLED(DISABLE_INACTIVE_Z)) DISABLE_AXIS_Z();
490 499
         if (ENABLED(DISABLE_INACTIVE_E)) disable_e_steppers();
500
+
491 501
         #if BOTH(HAS_LCD_MENU, AUTO_BED_LEVELING_UBL)
492 502
           if (ubl.lcd_map_control) {
493 503
             ubl.lcd_map_control = false;

Loading…
Cancel
Save