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

@ -1036,7 +1036,7 @@
//#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_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.

View File

@ -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

View File

@ -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

View File

@ -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();

View File

@ -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;
}
/**

View File

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