diff --git a/Marlin/Configuration_adv.h b/Marlin/Configuration_adv.h index d06fe732a4..82cf3e1949 100644 --- a/Marlin/Configuration_adv.h +++ b/Marlin/Configuration_adv.h @@ -1035,8 +1035,8 @@ // Enable this option and set to HIGH if your SD cards are incorrectly detected. //#define SD_DETECT_STATE HIGH - #define SD_FINISHED_STEPPERRELEASE true // Disable steppers when SD Print is finished - #define SD_FINISHED_RELEASECOMMAND "M84 X Y Z E" // You might want to keep the Z enabled so your bed stays in place. + #define SD_FINISHED_STEPPERRELEASE true // Disable steppers when SD Print is finished + #define SD_FINISHED_RELEASECOMMAND "M84" // Use "M84XYE" to keep Z enabled so your bed stays in place // Reverse SD sort to show "more recent" files first, according to the card's FAT. // Since the FAT gets out of order with usage, SDCARD_SORT_ALPHA is recommended. diff --git a/Marlin/src/gcode/sd/M1001.cpp b/Marlin/src/gcode/sd/M1001.cpp index 4261b57f97..8f8d4cf56a 100644 --- a/Marlin/src/gcode/sd/M1001.cpp +++ b/Marlin/src/gcode/sd/M1001.cpp @@ -27,6 +27,10 @@ #include "../gcode.h" #include "../../module/printcounter.h" +#ifdef SD_FINISHED_RELEASECOMMAND + #include "../queue.h" +#endif + #if EITHER(LCD_SET_PROGRESS_MANUALLY, SD_REPRINT_LAST_SELECTED_FILE) #include "../../lcd/ultralcd.h" #endif @@ -47,10 +51,6 @@ #include "../../feature/host_actions.h" #endif -#if ENABLED(SD_FINISHED_STEPPERRELEASE) && defined(SD_FINISHED_RELEASECOMMAND) - #include "../../module/planner.h" -#endif - #ifndef PE_LEDS_COMPLETED_TIME #define PE_LEDS_COMPLETED_TIME (30*60) #endif @@ -95,9 +95,9 @@ void GcodeSuite::M1001() { } #endif - // Wait for the queue to empty (and "clean"), inject SD_FINISHED_RELEASECOMMAND - #if ENABLED(SD_FINISHED_STEPPERRELEASE) && defined(SD_FINISHED_RELEASECOMMAND) - planner.finish_and_disable(); + // Inject SD_FINISHED_RELEASECOMMAND, if any + #ifdef SD_FINISHED_RELEASECOMMAND + queue.inject_P(PSTR(SD_FINISHED_RELEASECOMMAND)); #endif // Re-select the last printed file in the UI diff --git a/Marlin/src/inc/Conditionals_adv.h b/Marlin/src/inc/Conditionals_adv.h index cda744d81b..65dac5a004 100644 --- a/Marlin/src/inc/Conditionals_adv.h +++ b/Marlin/src/inc/Conditionals_adv.h @@ -68,6 +68,15 @@ #define HAS_FILAMENT_SENSOR 1 #endif +// Let SD_FINISHED_RELEASECOMMAND stand in for SD_FINISHED_STEPPERRELEASE +#if ENABLED(SD_FINISHED_STEPPERRELEASE) + #ifndef SD_FINISHED_RELEASECOMMAND + #define SD_FINISHED_RELEASECOMMAND "M84" // planner.finish_and_disable() + #endif +#else + #undef SD_FINISHED_RELEASECOMMAND +#endif + #if EITHER(SDSUPPORT, LCD_SET_PROGRESS_MANUALLY) #define HAS_PRINT_PROGRESS 1 #endif diff --git a/Marlin/src/module/planner.cpp b/Marlin/src/module/planner.cpp index 4ad7a79431..f6be8df9c9 100644 --- a/Marlin/src/module/planner.cpp +++ b/Marlin/src/module/planner.cpp @@ -1601,8 +1601,8 @@ void Planner::quick_stop() { clear_block_buffer_runtime(); #endif - // Make sure to drop any attempt of queuing moves for at least 1 second - cleaning_buffer_counter = 1000; + // Make sure to drop any attempt of queuing moves for 1 second + cleaning_buffer_counter = TEMP_TIMER_FREQUENCY; // Reenable Stepper ISR if (was_enabled) stepper.wake_up(); diff --git a/Marlin/src/module/planner.h b/Marlin/src/module/planner.h index a42c84c1fa..97e907e26b 100644 --- a/Marlin/src/module/planner.h +++ b/Marlin/src/module/planner.h @@ -807,12 +807,7 @@ class Planner { // Periodic tick to handle cleaning timeouts // Called from the Temperature ISR at ~1kHz static void tick() { - if (cleaning_buffer_counter) { - --cleaning_buffer_counter; - #if ENABLED(SD_FINISHED_STEPPERRELEASE) && defined(SD_FINISHED_RELEASECOMMAND) - if (!cleaning_buffer_counter) queue.inject_P(PSTR(SD_FINISHED_RELEASECOMMAND)); - #endif - } + if (cleaning_buffer_counter) --cleaning_buffer_counter; } /** diff --git a/Marlin/src/module/probe.h b/Marlin/src/module/probe.h index 083867ab48..7b920ab82c 100644 --- a/Marlin/src/module/probe.h +++ b/Marlin/src/module/probe.h @@ -47,7 +47,6 @@ public: static bool set_deployed(const bool deploy); - #if IS_KINEMATIC #if HAS_PROBE_XY_OFFSET