Fix SD_FINISHED_RELEASECOMMAND bug

Fixes #17401 bug that was introduced in 8f26c3a
This commit is contained in:
Scott Lahteine 2020-04-11 21:27:49 -05:00
parent a97ae51cc7
commit 7aed32df00
6 changed files with 21 additions and 18 deletions

View file

@ -1035,8 +1035,8 @@
// Enable this option and set to HIGH if your SD cards are incorrectly detected. // Enable this option and set to HIGH if your SD cards are incorrectly detected.
//#define SD_DETECT_STATE HIGH //#define SD_DETECT_STATE HIGH
#define SD_FINISHED_STEPPERRELEASE true // Disable steppers when SD Print is finished #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_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. // 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. // Since the FAT gets out of order with usage, SDCARD_SORT_ALPHA is recommended.

View file

@ -27,6 +27,10 @@
#include "../gcode.h" #include "../gcode.h"
#include "../../module/printcounter.h" #include "../../module/printcounter.h"
#ifdef SD_FINISHED_RELEASECOMMAND
#include "../queue.h"
#endif
#if EITHER(LCD_SET_PROGRESS_MANUALLY, SD_REPRINT_LAST_SELECTED_FILE) #if EITHER(LCD_SET_PROGRESS_MANUALLY, SD_REPRINT_LAST_SELECTED_FILE)
#include "../../lcd/ultralcd.h" #include "../../lcd/ultralcd.h"
#endif #endif
@ -47,10 +51,6 @@
#include "../../feature/host_actions.h" #include "../../feature/host_actions.h"
#endif #endif
#if ENABLED(SD_FINISHED_STEPPERRELEASE) && defined(SD_FINISHED_RELEASECOMMAND)
#include "../../module/planner.h"
#endif
#ifndef PE_LEDS_COMPLETED_TIME #ifndef PE_LEDS_COMPLETED_TIME
#define PE_LEDS_COMPLETED_TIME (30*60) #define PE_LEDS_COMPLETED_TIME (30*60)
#endif #endif
@ -95,9 +95,9 @@ void GcodeSuite::M1001() {
} }
#endif #endif
// Wait for the queue to empty (and "clean"), inject SD_FINISHED_RELEASECOMMAND // Inject SD_FINISHED_RELEASECOMMAND, if any
#if ENABLED(SD_FINISHED_STEPPERRELEASE) && defined(SD_FINISHED_RELEASECOMMAND) #ifdef SD_FINISHED_RELEASECOMMAND
planner.finish_and_disable(); queue.inject_P(PSTR(SD_FINISHED_RELEASECOMMAND));
#endif #endif
// Re-select the last printed file in the UI // Re-select the last printed file in the UI

View file

@ -68,6 +68,15 @@
#define HAS_FILAMENT_SENSOR 1 #define HAS_FILAMENT_SENSOR 1
#endif #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) #if EITHER(SDSUPPORT, LCD_SET_PROGRESS_MANUALLY)
#define HAS_PRINT_PROGRESS 1 #define HAS_PRINT_PROGRESS 1
#endif #endif

View file

@ -1601,8 +1601,8 @@ void Planner::quick_stop() {
clear_block_buffer_runtime(); clear_block_buffer_runtime();
#endif #endif
// Make sure to drop any attempt of queuing moves for at least 1 second // Make sure to drop any attempt of queuing moves for 1 second
cleaning_buffer_counter = 1000; cleaning_buffer_counter = TEMP_TIMER_FREQUENCY;
// Reenable Stepper ISR // Reenable Stepper ISR
if (was_enabled) stepper.wake_up(); if (was_enabled) stepper.wake_up();

View file

@ -807,12 +807,7 @@ class Planner {
// Periodic tick to handle cleaning timeouts // Periodic tick to handle cleaning timeouts
// Called from the Temperature ISR at ~1kHz // Called from the Temperature ISR at ~1kHz
static void tick() { static void tick() {
if (cleaning_buffer_counter) { if (cleaning_buffer_counter) --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
}
} }
/** /**

View file

@ -47,7 +47,6 @@ public:
static bool set_deployed(const bool deploy); static bool set_deployed(const bool deploy);
#if IS_KINEMATIC #if IS_KINEMATIC
#if HAS_PROBE_XY_OFFSET #if HAS_PROBE_XY_OFFSET