From 953ea9f16e1be10eeabe11931615fcf944c57cbe Mon Sep 17 00:00:00 2001 From: InsanityAutomation Date: Tue, 22 Aug 2023 20:55:40 -0400 Subject: [PATCH] Revert runout changes --- Marlin/src/feature/runout.cpp | 47 ++++++++++++--------------- Marlin/src/feature/runout.h | 3 +- Marlin/src/gcode/bedlevel/abl/G29.cpp | 2 +- Marlin/src/module/settings.cpp | 14 ++++---- 4 files changed, 30 insertions(+), 36 deletions(-) diff --git a/Marlin/src/feature/runout.cpp b/Marlin/src/feature/runout.cpp index afb75920fa..aae92d423f 100644 --- a/Marlin/src/feature/runout.cpp +++ b/Marlin/src/feature/runout.cpp @@ -82,7 +82,7 @@ void event_filament_runout(const uint8_t extruder) { #endif TERN_(EXTENSIBLE_UI, ExtUI::onFilamentRunout(ExtUI::getTool(extruder))); - TERN_(DWIN_LCD_PROUI, dwinFilamentRunout(extruder)); + TERN_(DWIN_LCD_PROUI, DWIN_FilamentRunout(extruder)); #if ANY(HOST_PROMPT_SUPPORT, HOST_ACTION_COMMANDS, MULTI_FILAMENT_SENSOR) const char tool = '0' + TERN0(MULTI_FILAMENT_SENSOR, extruder); @@ -96,16 +96,12 @@ void event_filament_runout(const uint8_t extruder) { const bool run_runout_script = !runout.host_handling; #if ENABLED(HOST_ACTION_COMMANDS) - - const bool park_or_pause = (false - #ifdef FILAMENT_RUNOUT_SCRIPT - || strstr(FILAMENT_RUNOUT_SCRIPT, "M600") + if (run_runout_script + && ( strstr(FILAMENT_RUNOUT_SCRIPT, "M600") || strstr(FILAMENT_RUNOUT_SCRIPT, "M125") || TERN0(ADVANCED_PAUSE_FEATURE, strstr(FILAMENT_RUNOUT_SCRIPT, "M25")) - #endif - ); - - if (run_runout_script && park_or_pause) { + ) + ) { hostui.paused(false); } else { @@ -122,27 +118,24 @@ void event_filament_runout(const uint8_t extruder) { SERIAL_ECHOPGM(" " ACTION_REASON_ON_FILAMENT_RUNOUT " "); SERIAL_CHAR(tool); SERIAL_EOL(); - #endif // HOST_ACTION_COMMANDS - #ifdef FILAMENT_RUNOUT_SCRIPT - if (run_runout_script) { - #if MULTI_FILAMENT_SENSOR - MString script; - script.setf(F(FILAMENT_RUNOUT_SCRIPT), AS_CHAR(tool)); - #if ENABLED(FILAMENT_RUNOUT_SENSOR_DEBUG) - SERIAL_ECHOLNPGM("Runout Command: ", &script); - #endif - queue.inject(&script); - #else - #if ENABLED(FILAMENT_RUNOUT_SENSOR_DEBUG) - SERIAL_ECHOPGM("Runout Command: "); - SERIAL_ECHOLNPGM(FILAMENT_RUNOUT_SCRIPT); - #endif - queue.inject(F(FILAMENT_RUNOUT_SCRIPT)); + if (run_runout_script) { + #if MULTI_FILAMENT_SENSOR + char script[strlen(FILAMENT_RUNOUT_SCRIPT) + 1]; + sprintf_P(script, PSTR(FILAMENT_RUNOUT_SCRIPT), tool); + #if ENABLED(FILAMENT_RUNOUT_SENSOR_DEBUG) + SERIAL_ECHOLNPGM("Runout Command: ", script); #endif - } - #endif + queue.inject(script); + #else + #if ENABLED(FILAMENT_RUNOUT_SENSOR_DEBUG) + SERIAL_ECHOPGM("Runout Command: "); + SERIAL_ECHOLNPGM(FILAMENT_RUNOUT_SCRIPT); + #endif + queue.inject(F(FILAMENT_RUNOUT_SCRIPT)); + #endif + } } #endif // HAS_FILAMENT_SENSOR diff --git a/Marlin/src/feature/runout.h b/Marlin/src/feature/runout.h index 907f0250cd..ae33a85e4a 100644 --- a/Marlin/src/feature/runout.h +++ b/Marlin/src/feature/runout.h @@ -30,7 +30,8 @@ #include "../module/planner.h" #include "../module/stepper.h" // for block_t #include "../gcode/queue.h" -#include "../feature/pause.h" +#include "../feature/pause.h" // for did_pause_print +#include "../MarlinCore.h" // for printingIsActive() #include "../inc/MarlinConfig.h" diff --git a/Marlin/src/gcode/bedlevel/abl/G29.cpp b/Marlin/src/gcode/bedlevel/abl/G29.cpp index 26d947bb76..4ec87adaa2 100644 --- a/Marlin/src/gcode/bedlevel/abl/G29.cpp +++ b/Marlin/src/gcode/bedlevel/abl/G29.cpp @@ -997,7 +997,7 @@ G29_TYPE GcodeSuite::G29() { TERN_(HAS_DWIN_E3V2_BASIC, DWIN_LevelingDone()); TERN_(EXTENSIBLE_UI, ExtUI::onLevelingDone()); - TERN_(HAS_MULTI_HOTEND, if (abl.tool_index != 0) tool_change(abl.tool_index)); + TERN_(HAS_MULTI_HOTEND, if (active_extruder != 0) tool_change(0)); probe.use_probing_tool(false); report_current_position(); diff --git a/Marlin/src/module/settings.cpp b/Marlin/src/module/settings.cpp index f7fb290a33..1e9e57528a 100644 --- a/Marlin/src/module/settings.cpp +++ b/Marlin/src/module/settings.cpp @@ -41,8 +41,8 @@ // Check the integrity of data offsets. // Can be disabled for production build. -//#define DEBUG_EEPROM_READWRITE -//#define DEBUG_EEPROM_OBSERVE +#define DEBUG_EEPROM_READWRITE +#define DEBUG_EEPROM_OBSERVE #include "settings.h" @@ -895,9 +895,9 @@ void MarlinSettings::postprocess() { #if HAS_FILAMENT_SENSOR { _FIELD_TEST(runout_enabled); - for(int e; e