From ff9a27ee9fc862d8592f9bec86cbe7deccc21515 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 19 Oct 2020 04:24:57 -0500 Subject: [PATCH] Use PGM serial strings --- Marlin/src/feature/runout.cpp | 15 +++------ Marlin/src/gcode/gcode.cpp | 4 +-- .../extui/lib/anycubic_chiron/chiron_tft.cpp | 2 +- Marlin/src/lcd/tft/touch.cpp | 4 +-- Marlin/src/module/tool_change.cpp | 31 ++++++------------- Marlin/src/module/tool_change.h | 2 ++ 6 files changed, 22 insertions(+), 36 deletions(-) diff --git a/Marlin/src/feature/runout.cpp b/Marlin/src/feature/runout.cpp index 71f31f2145..50e18e52ef 100644 --- a/Marlin/src/feature/runout.cpp +++ b/Marlin/src/feature/runout.cpp @@ -40,8 +40,9 @@ bool FilamentMonitorBase::enabled = true, #endif #if ENABLED(TOOLCHANGE_MIGRATION_FEATURE) - //#define DEBUG_TOOLCHANGE_MIGRATION_FEATURE #include "../module/tool_change.h" + #define DEBUG_OUT ENABLED(DEBUG_TOOLCHANGE_MIGRATION_FEATURE) + #include "../core/debug_out.h" #endif #if HAS_FILAMENT_RUNOUT_DISTANCE @@ -74,15 +75,11 @@ void event_filament_runout() { #if ENABLED(TOOLCHANGE_MIGRATION_FEATURE) if (migration.in_progress) { - #if ENABLED(DEBUG_TOOLCHANGE_MIGRATION_FEATURE) - SERIAL_ECHOLN("Migration Already In Progress"); - #endif + DEBUG_ECHOLNPGM("Migration Already In Progress"); return; // Action already in progress. Purge triggered repeated runout. } if (migration.automode) { - #if ENABLED(DEBUG_TOOLCHANGE_MIGRATION_FEATURE) - SERIAL_ECHOLN("Migration Starting"); - #endif + DEBUG_ECHOLNPGM("Migration Starting"); if (extruder_migration()) return; } #endif @@ -109,9 +106,7 @@ void event_filament_runout() { if (run_runout_script && ( strstr(FILAMENT_RUNOUT_SCRIPT, "M600") || strstr(FILAMENT_RUNOUT_SCRIPT, "M125") - #if ENABLED(ADVANCED_PAUSE_FEATURE) - || strstr(FILAMENT_RUNOUT_SCRIPT, "M25") - #endif + || TERN0(ADVANCED_PAUSE_FEATURE, strstr(FILAMENT_RUNOUT_SCRIPT, "M25")) ) ) { host_action_paused(false); diff --git a/Marlin/src/gcode/gcode.cpp b/Marlin/src/gcode/gcode.cpp index f2bd81e670..852d389b13 100644 --- a/Marlin/src/gcode/gcode.cpp +++ b/Marlin/src/gcode/gcode.cpp @@ -754,8 +754,8 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) { case 511: M511(); break; // M511: Unlock Printer #endif #if ENABLED(PASSWORD_CHANGE_GCODE) - case 512: M512(); break; - #endif // M512: Set/Change/Remove Password + case 512: M512(); break; // M512: Set/Change/Remove Password + #endif #endif #if ENABLED(SDSUPPORT) diff --git a/Marlin/src/lcd/extui/lib/anycubic_chiron/chiron_tft.cpp b/Marlin/src/lcd/extui/lib/anycubic_chiron/chiron_tft.cpp index 5e492573e7..109d82b2a2 100644 --- a/Marlin/src/lcd/extui/lib/anycubic_chiron/chiron_tft.cpp +++ b/Marlin/src/lcd/extui/lib/anycubic_chiron/chiron_tft.cpp @@ -294,7 +294,7 @@ namespace Anycubic { void ChironTFT::SendtoTFTLN(PGM_P str = nullptr) { if (str != nullptr) { #if ACDEBUG(AC_SOME) - SERIAL_ECHO("> "); + SERIAL_ECHOPGM("> "); #endif SendtoTFT(str); #if ACDEBUG(AC_SOME) diff --git a/Marlin/src/lcd/tft/touch.cpp b/Marlin/src/lcd/tft/touch.cpp index 6dcddc5d56..3e0945b227 100644 --- a/Marlin/src/lcd/tft/touch.cpp +++ b/Marlin/src/lcd/tft/touch.cpp @@ -189,12 +189,12 @@ void Touch::touch(touch_control_t *control) { } if (calibration_state == CALIBRATION_SUCCESS) { - SERIAL_ECHOLN("Touch screen calibration completed"); + SERIAL_ECHOLNPGM("Touch screen calibration completed"); SERIAL_ECHOLNPAIR("TOUCH_CALIBRATION_X ", calibration.x); SERIAL_ECHOLNPAIR("TOUCH_CALIBRATION_Y ", calibration.y); SERIAL_ECHOLNPAIR("TOUCH_OFFSET_X ", calibration.offset_x); SERIAL_ECHOLNPAIR("TOUCH_OFFSET_Y ", calibration.offset_y); - SERIAL_ECHO("TOUCH_ORIENTATION "); if (calibration.orientation == TOUCH_LANDSCAPE) SERIAL_ECHOLN("TOUCH_LANDSCAPE"); else SERIAL_ECHOLN("TOUCH_PORTRAIT"); + SERIAL_ECHOPGM("TOUCH_ORIENTATION "); if (calibration.orientation == TOUCH_LANDSCAPE) SERIAL_ECHOLNPGM("TOUCH_LANDSCAPE"); else SERIAL_ECHOLNPGM("TOUCH_PORTRAIT"); } break; default: break; diff --git a/Marlin/src/module/tool_change.cpp b/Marlin/src/module/tool_change.cpp index 2c1a1a6017..1cdafe019d 100644 --- a/Marlin/src/module/tool_change.cpp +++ b/Marlin/src/module/tool_change.cpp @@ -1209,25 +1209,22 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) { #if ENABLED(TOOLCHANGE_MIGRATION_FEATURE) + #define DEBUG_OUT ENABLED(DEBUG_TOOLCHANGE_MIGRATION_FEATURE) + #include "../core/debug_out.h" + bool extruder_migration() { #if ENABLED(PREVENT_COLD_EXTRUSION) if (thermalManager.targetTooColdToExtrude(active_extruder)) { - #if ENABLED(DEBUG_TOOLCHANGE_MIGRATION_FEATURE) - SERIAL_ECHOLN("Migration Source Too Cold"); - #endif + DEBUG_ECHOLNPGM("Migration Source Too Cold"); return false; } #endif // No auto-migration or specified target? if (!migration.target && active_extruder >= migration.last) { - #if ENABLED(DEBUG_TOOLCHANGE_MIGRATION_FEATURE) - SERIAL_ECHO_MSG("No Migration Target"); - SERIAL_ECHO_MSG("Target: ", migration.target, - " Last: ", migration.last, - " Active: ", active_extruder); - #endif + DEBUG_ECHO_MSG("No Migration Target"); + DEBUG_ECHO_MSG("Target: ", migration.target, " Last: ", migration.last, " Active: ", active_extruder); migration.automode = false; return false; } @@ -1237,9 +1234,7 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) { uint8_t migration_extruder = active_extruder; if (migration.target) { - #if ENABLED(DEBUG_TOOLCHANGE_MIGRATION_FEATURE) - SERIAL_ECHOLN("Migration using fixed target"); - #endif + DEBUG_ECHOLNPGM("Migration using fixed target"); // Specified target ok? const int16_t t = migration.target - 1; if (t != active_extruder) migration_extruder = t; @@ -1248,16 +1243,12 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) { migration_extruder++; if (migration_extruder == active_extruder) { - #if ENABLED(DEBUG_TOOLCHANGE_MIGRATION_FEATURE) - SERIAL_ECHOLN("Migration source matches active"); - #endif + DEBUG_ECHOLNPGM("Migration source matches active"); return false; } // Migration begins - #if ENABLED(DEBUG_TOOLCHANGE_MIGRATION_FEATURE) - SERIAL_ECHOLN("Beginning migration"); - #endif + DEBUG_ECHOLNPGM("Beginning migration"); migration.in_progress = true; // Prevent runout script planner.synchronize(); @@ -1303,9 +1294,7 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) { planner.synchronize(); planner.set_e_position_mm(current_position.e); // New extruder primed and ready - #if ENABLED(DEBUG_TOOLCHANGE_MIGRATION_FEATURE) - SERIAL_ECHOLN("Migration Complete"); - #endif + DEBUG_ECHOLNPGM("Migration Complete"); return true; } diff --git a/Marlin/src/module/tool_change.h b/Marlin/src/module/tool_change.h index 38347191d3..0b22f8b6f1 100644 --- a/Marlin/src/module/tool_change.h +++ b/Marlin/src/module/tool_change.h @@ -24,6 +24,8 @@ #include "../inc/MarlinConfigPre.h" #include "../core/types.h" +//#define DEBUG_TOOLCHANGE_MIGRATION_FEATURE + #if HAS_MULTI_EXTRUDER typedef struct {