From 50366b00d570c682316dff2d37642248dd41b18f Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 24 Dec 2017 20:34:50 -0600 Subject: [PATCH] Tweak cleaning buffer / SD finished command --- Marlin/src/module/stepper.cpp | 4 ++-- Marlin/src/sd/cardreader.cpp | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Marlin/src/module/stepper.cpp b/Marlin/src/module/stepper.cpp index 4372db6b2..143e512fd 100644 --- a/Marlin/src/module/stepper.cpp +++ b/Marlin/src/module/stepper.cpp @@ -397,8 +397,8 @@ void Stepper::isr() { else { planner.discard_current_block(); --cleaning_buffer_counter; // Count down for abort print - #ifdef SD_FINISHED_RELEASECOMMAND - if (!cleaning_buffer_counter && (SD_FINISHED_STEPPERRELEASE)) enqueue_and_echo_commands_P(PSTR(SD_FINISHED_RELEASECOMMAND)); + #if ENABLED(SD_FINISHED_STEPPERRELEASE) && defined(SD_FINISHED_RELEASECOMMAND) + if (!cleaning_buffer_counter) enqueue_and_echo_commands_P(PSTR(SD_FINISHED_RELEASECOMMAND)); #endif } current_block = NULL; // Prep to get a new block after cleaning diff --git a/Marlin/src/sd/cardreader.cpp b/Marlin/src/sd/cardreader.cpp index 92954d8d7..dd26b0bc0 100644 --- a/Marlin/src/sd/cardreader.cpp +++ b/Marlin/src/sd/cardreader.cpp @@ -896,8 +896,9 @@ void CardReader::printingHasFinished() { } else { sdprinting = false; - if (SD_FINISHED_STEPPERRELEASE) - enqueue_and_echo_commands_P(PSTR(SD_FINISHED_RELEASECOMMAND)); + #if ENABLED(SD_FINISHED_STEPPERRELEASE) && defined(SD_FINISHED_RELEASECOMMAND) + stepper.cleaning_buffer_counter = 1; // The command will fire from the Stepper ISR + #endif print_job_timer.stop(); if (print_job_timer.duration() > 60) enqueue_and_echo_commands_P(PSTR("M31"));