From f83bc0aa13e8cf2d92ec138576cc3a620e74a982 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Fri, 29 Nov 2019 04:45:07 -0600 Subject: [PATCH] Optimize common strings Saves 128 bytes in testing with `mftest mega 1 -y` --- Marlin/src/Marlin.cpp | 8 +- Marlin/src/Marlin.h | 3 +- Marlin/src/core/serial.cpp | 4 +- Marlin/src/core/serial.h | 74 +++++- Marlin/src/core/utility.cpp | 2 +- Marlin/src/feature/bedlevel/ubl/ubl.cpp | 2 +- Marlin/src/feature/host_actions.cpp | 4 +- Marlin/src/feature/host_actions.h | 2 + Marlin/src/feature/joystick.cpp | 6 +- Marlin/src/feature/pause.cpp | 10 +- Marlin/src/feature/prusa_MMU2/mmu2.cpp | 2 +- Marlin/src/gcode/bedlevel/abl/G29.cpp | 2 +- Marlin/src/gcode/calibrate/G34_M422.cpp | 4 +- Marlin/src/gcode/calibrate/G425.cpp | 18 +- Marlin/src/gcode/calibrate/M48.cpp | 4 +- Marlin/src/gcode/config/M217.cpp | 12 +- Marlin/src/gcode/config/M43.cpp | 2 +- Marlin/src/gcode/config/M92.cpp | 12 +- Marlin/src/gcode/feature/mixing/M166.cpp | 2 +- Marlin/src/gcode/lcd/M0_M1.cpp | 2 +- Marlin/src/gcode/motion/M290.cpp | 24 +- Marlin/src/gcode/probe/M851.cpp | 4 +- Marlin/src/lcd/menu/menu_delta_calibrate.cpp | 2 +- Marlin/src/libs/vector_3.cpp | 6 +- Marlin/src/module/configuration_store.cpp | 225 ++++++++++--------- Marlin/src/module/delta.cpp | 2 +- Marlin/src/module/probe.cpp | 4 +- buildroot/share/tests/megaatmega2560-tests | 2 +- 28 files changed, 272 insertions(+), 172 deletions(-) diff --git a/Marlin/src/Marlin.cpp b/Marlin/src/Marlin.cpp index 1e1199c5b..03210f03d 100644 --- a/Marlin/src/Marlin.cpp +++ b/Marlin/src/Marlin.cpp @@ -181,11 +181,15 @@ #include "libs/L6470/L6470_Marlin.h" #endif -const char G28_STR[] PROGMEM = "G28", +const char NUL_STR[] PROGMEM = "", + G28_STR[] PROGMEM = "G28", M21_STR[] PROGMEM = "M21", M23_STR[] PROGMEM = "M23 %s", M24_STR[] PROGMEM = "M24", - NUL_STR[] PROGMEM = ""; + SP_X_STR[] PROGMEM = " X", + SP_Y_STR[] PROGMEM = " Y", + SP_Z_STR[] PROGMEM = " Z", + SP_E_STR[] PROGMEM = " E"; bool Running = true; diff --git a/Marlin/src/Marlin.h b/Marlin/src/Marlin.h index b15ca3d5c..8b44298a9 100644 --- a/Marlin/src/Marlin.h +++ b/Marlin/src/Marlin.h @@ -377,4 +377,5 @@ void protected_pin_err(); void event_probe_failure(); #endif -extern const char G28_STR[], M21_STR[], M23_STR[], M24_STR[], NUL_STR[]; +extern const char NUL_STR[], G28_STR[], M21_STR[], M23_STR[], M24_STR[], + SP_X_STR[], SP_Y_STR[], SP_Z_STR[], SP_E_STR[]; diff --git a/Marlin/src/core/serial.cpp b/Marlin/src/core/serial.cpp index 2369c3acb..4a5214f5c 100644 --- a/Marlin/src/core/serial.cpp +++ b/Marlin/src/core/serial.cpp @@ -67,8 +67,10 @@ void print_bin(const uint16_t val) { } } +extern const char SP_X_STR[], SP_Y_STR[], SP_Z_STR[]; + void print_xyz(const float &x, const float &y, const float &z, PGM_P const prefix/*=nullptr*/, PGM_P const suffix/*=nullptr*/) { serialprintPGM(prefix); - SERIAL_ECHOPAIR(" " MSG_X, x, " " MSG_Y, y, " " MSG_Z, z); + SERIAL_ECHOPAIR_P(SP_X_STR, x, SP_Y_STR, y, SP_Z_STR, z); if (suffix) serialprintPGM(suffix); else SERIAL_EOL(); } diff --git a/Marlin/src/core/serial.h b/Marlin/src/core/serial.h index f4c2570ca..0db7bb9e4 100644 --- a/Marlin/src/core/serial.h +++ b/Marlin/src/core/serial.h @@ -83,7 +83,7 @@ extern uint8_t marlin_debug_flags; #define SERIAL_FLUSHTX() #endif -// Print up to 12 pairs of values +// Print up to 12 pairs of values. Odd elements auto-wrapped in PSTR(). #define __SEP_N(N,V...) _SEP_##N(V) #define _SEP_N(N,V...) __SEP_N(N,V) #define _SEP_1(PRE) SERIAL_ECHOPGM(PRE) @@ -113,6 +113,36 @@ extern uint8_t marlin_debug_flags; #define SERIAL_ECHOPAIR(V...) _SEP_N(NUM_ARGS(V),V) +// Print up to 12 pairs of values. Odd elements must be PSTR pointers. +#define __SEP_N_P(N,V...) _SEP_##N##_P(V) +#define _SEP_N_P(N,V...) __SEP_N_P(N,V) +#define _SEP_1_P(PRE) serialprintPGM(PRE) +#define _SEP_2_P(PRE,V) serial_echopair_PGM(PRE,V) +#define _SEP_3_P(a,b,c) do{ _SEP_2_P(a,b); serialprintPGM(c); }while(0) +#define _SEP_4_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_2_P(V); }while(0) +#define _SEP_5_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_3_P(V); }while(0) +#define _SEP_6_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_4_P(V); }while(0) +#define _SEP_7_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_5_P(V); }while(0) +#define _SEP_8_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_6_P(V); }while(0) +#define _SEP_9_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_7_P(V); }while(0) +#define _SEP_10_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_8_P(V); }while(0) +#define _SEP_11_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_9_P(V); }while(0) +#define _SEP_12_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_10_P(V); }while(0) +#define _SEP_13_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_11_P(V); }while(0) +#define _SEP_14_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_12_P(V); }while(0) +#define _SEP_15_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_13_P(V); }while(0) +#define _SEP_16_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_14_P(V); }while(0) +#define _SEP_17_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_15_P(V); }while(0) +#define _SEP_18_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_16_P(V); }while(0) +#define _SEP_19_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_17_P(V); }while(0) +#define _SEP_20_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_18_P(V); }while(0) +#define _SEP_21_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_19_P(V); }while(0) +#define _SEP_22_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_20_P(V); }while(0) +#define _SEP_23_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_21_P(V); }while(0) +#define _SEP_24_P(a,b,V...) do{ _SEP_2_P(a,b); _SEP_22_P(V); }while(0) + +#define SERIAL_ECHOPAIR_P(V...) _SEP_N_P(NUM_ARGS(V),V) + // Print up to 12 pairs of values followed by newline #define __SELP_N(N,V...) _SELP_##N(V) #define _SELP_N(N,V...) __SELP_N(N,V) @@ -139,10 +169,40 @@ extern uint8_t marlin_debug_flags; #define _SELP_21(a,b,V...) do{ _SEP_2(a,b); _SELP_19(V); }while(0) #define _SELP_22(a,b,V...) do{ _SEP_2(a,b); _SELP_20(V); }while(0) #define _SELP_23(a,b,V...) do{ _SEP_2(a,b); _SELP_21(V); }while(0) -#define _SELP_24(a,b,V...) do{ _SEP_2(a,b); _SELP_22(V); }while(0) // Use up two, pass the rest up +#define _SELP_24(a,b,V...) do{ _SEP_2(a,b); _SELP_22(V); }while(0) // Eat two args, pass the rest up #define SERIAL_ECHOLNPAIR(V...) _SELP_N(NUM_ARGS(V),V) +// Print up to 12 pairs of values followed by newline +#define __SELP_N_P(N,V...) _SELP_##N##_P(V) +#define _SELP_N_P(N,V...) __SELP_N_P(N,V) +#define _SELP_1_P(PRE) serialprintPGM(PRE) +#define _SELP_2_P(PRE,V) do{ serial_echopair_PGM(PRE,V); SERIAL_EOL(); }while(0) +#define _SELP_3_P(a,b,c) do{ _SEP_2_P(a,b); serialprintPGM(c); }while(0) +#define _SELP_4_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_2_P(V); }while(0) +#define _SELP_5_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_3_P(V); }while(0) +#define _SELP_6_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_4_P(V); }while(0) +#define _SELP_7_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_5_P(V); }while(0) +#define _SELP_8_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_6_P(V); }while(0) +#define _SELP_9_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_7_P(V); }while(0) +#define _SELP_10_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_8_P(V); }while(0) +#define _SELP_11_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_9_P(V); }while(0) +#define _SELP_12_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_10_P(V); }while(0) +#define _SELP_13_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_11_P(V); }while(0) +#define _SELP_14_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_12_P(V); }while(0) +#define _SELP_15_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_13_P(V); }while(0) +#define _SELP_16_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_14_P(V); }while(0) +#define _SELP_17_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_15_P(V); }while(0) +#define _SELP_18_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_16_P(V); }while(0) +#define _SELP_19_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_17_P(V); }while(0) +#define _SELP_20_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_18_P(V); }while(0) +#define _SELP_21_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_19_P(V); }while(0) +#define _SELP_22_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_20_P(V); }while(0) +#define _SELP_23_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_21_P(V); }while(0) +#define _SELP_24_P(a,b,V...) do{ _SEP_2_P(a,b); _SELP_22_P(V); }while(0) // Eat two args, pass the rest up + +#define SERIAL_ECHOLNPAIR_P(V...) _SELP_N_P(NUM_ARGS(V),V) + // Print up to 20 comma-separated pairs of values #define __SLST_N(N,V...) _SLST_##N(V) #define _SLST_N(N,V...) __SLST_N(N,V) @@ -165,15 +225,21 @@ extern uint8_t marlin_debug_flags; #define _SLST_17(a,b,V...) do{ SERIAL_ECHO(a); _SEP_2(", ",b); _SLST_15(V); }while(0) #define _SLST_18(a,b,V...) do{ SERIAL_ECHO(a); _SEP_2(", ",b); _SLST_16(V); }while(0) #define _SLST_19(a,b,V...) do{ SERIAL_ECHO(a); _SEP_2(", ",b); _SLST_17(V); }while(0) -#define _SLST_20(a,b,V...) do{ SERIAL_ECHO(a); _SEP_2(", ",b); _SLST_18(V); }while(0) // Use up two, pass the rest up +#define _SLST_20(a,b,V...) do{ SERIAL_ECHO(a); _SEP_2(", ",b); _SLST_18(V); }while(0) // Eat two args, pass the rest up #define SERIAL_ECHOLIST(pre,V...) do{ SERIAL_ECHOPGM(pre); _SLST_N(NUM_ARGS(V),V); }while(0) #define SERIAL_ECHOLIST_N(N,V...) _SLST_N(N,LIST_N(N,V)) +#define SERIAL_ECHOPGM_P(P) (serialprintPGM(P)) +#define SERIAL_ECHOLNPGM_P(P) (serialprintPGM(P "\n")) + #define SERIAL_ECHOPGM(S) (serialprintPGM(PSTR(S))) #define SERIAL_ECHOLNPGM(S) (serialprintPGM(PSTR(S "\n"))) -#define SERIAL_ECHOPAIR_F(S,V...) do{ SERIAL_ECHOPGM(S); SERIAL_ECHO_F(V); }while(0) +#define SERIAL_ECHOPAIR_F_P(P,V...) do{ serialprintPGM(P); SERIAL_ECHO_F(V); }while(0) +#define SERIAL_ECHOLNPAIR_F_P(V...) do{ SERIAL_ECHOPAIR_F_P(V); SERIAL_EOL(); }while(0) + +#define SERIAL_ECHOPAIR_F(S,V...) SERIAL_ECHOPAIR_F_P(PSTR(S),V) #define SERIAL_ECHOLNPAIR_F(V...) do{ SERIAL_ECHOPAIR_F(V); SERIAL_EOL(); }while(0) #define SERIAL_ECHO_START() serial_echo_start() diff --git a/Marlin/src/core/utility.cpp b/Marlin/src/core/utility.cpp index ca8cd67cc..189a505cc 100644 --- a/Marlin/src/core/utility.cpp +++ b/Marlin/src/core/utility.cpp @@ -79,7 +79,7 @@ void safe_delay(millis_t ms) { ); #if HAS_BED_PROBE - SERIAL_ECHOPAIR("Probe Offset X", probe_offset.x, " Y", probe_offset.y, " Z", probe_offset.z); + SERIAL_ECHOPAIR_P(PSTR("Probe Offset X"), probe_offset.x, SP_Y_STR, probe_offset.y, SP_Z_STR, probe_offset.z); if (probe_offset.x > 0) SERIAL_ECHOPGM(" (Right"); else if (probe_offset.x < 0) diff --git a/Marlin/src/feature/bedlevel/ubl/ubl.cpp b/Marlin/src/feature/bedlevel/ubl/ubl.cpp index 259ee1096..66eff703c 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl.cpp +++ b/Marlin/src/feature/bedlevel/ubl/ubl.cpp @@ -51,7 +51,7 @@ if (!isnan(z_values[x][y])) { SERIAL_ECHO_START(); SERIAL_ECHOPAIR(" M421 I", int(x), " J", int(y)); - SERIAL_ECHOLNPAIR_F(" Z", z_values[x][y], 4); + SERIAL_ECHOLNPAIR_F_P(SP_Z_STR, z_values[x][y], 4); serial_delay(75); // Prevent Printrun from exploding } } diff --git a/Marlin/src/feature/host_actions.cpp b/Marlin/src/feature/host_actions.cpp index 4c36b76c7..f40478b76 100644 --- a/Marlin/src/feature/host_actions.cpp +++ b/Marlin/src/feature/host_actions.cpp @@ -64,6 +64,8 @@ void host_action(const char * const pstr, const bool eol) { #if ENABLED(HOST_PROMPT_SUPPORT) + const char CONTINUE_STR[] PROGMEM = "Continue"; + #if HAS_RESUME_CONTINUE extern bool wait_for_user; #endif @@ -126,7 +128,7 @@ void host_action(const char * const pstr, const bool eol) { host_action_prompt_button(PSTR("DisableRunout")); else { host_prompt_reason = PROMPT_FILAMENT_RUNOUT; - host_action_prompt_button(PSTR("Continue")); + host_action_prompt_button(CONTINUE_STR); } host_action_prompt_show(); } diff --git a/Marlin/src/feature/host_actions.h b/Marlin/src/feature/host_actions.h index 7477b6e6d..b742d0f08 100644 --- a/Marlin/src/feature/host_actions.h +++ b/Marlin/src/feature/host_actions.h @@ -46,6 +46,8 @@ void host_action(const char * const pstr, const bool eol=true); #if ENABLED(HOST_PROMPT_SUPPORT) + extern const char CONTINUE_STR[]; + enum PromptReason : uint8_t { PROMPT_NOT_DEFINED, PROMPT_FILAMENT_RUNOUT, diff --git a/Marlin/src/feature/joystick.cpp b/Marlin/src/feature/joystick.cpp index 404d5406d..abfd77f43 100644 --- a/Marlin/src/feature/joystick.cpp +++ b/Marlin/src/feature/joystick.cpp @@ -54,13 +54,13 @@ Joystick joystick; void Joystick::report() { SERIAL_ECHOPGM("Joystick"); #if HAS_JOY_ADC_X - SERIAL_ECHOPAIR(" X", x.raw); + SERIAL_ECHOPAIR_P(SP_X_STR, x.raw); #endif #if HAS_JOY_ADC_Y - SERIAL_ECHOPAIR(" Y", y.raw); + SERIAL_ECHOPAIR_P(SP_Y_STR, y.raw); #endif #if HAS_JOY_ADC_Z - SERIAL_ECHOPAIR(" Z", z.raw); + SERIAL_ECHOPAIR_P(SP_Z_STR, z.raw); #endif #if HAS_JOY_ADC_EN SERIAL_ECHO_TERNARY(READ(JOY_EN_PIN), " EN=", "HIGH (dis", "LOW (en", "abled)"); diff --git a/Marlin/src/feature/pause.cpp b/Marlin/src/feature/pause.cpp index 47722c87e..ce6c5a626 100644 --- a/Marlin/src/feature/pause.cpp +++ b/Marlin/src/feature/pause.cpp @@ -191,7 +191,7 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l host_action_prompt_begin(PSTR("Load Filament T"), false); SERIAL_CHAR(tool); SERIAL_EOL(); - host_action_prompt_button(PSTR("Continue")); + host_action_prompt_button(CONTINUE_STR); host_action_prompt_show(); #endif #if ENABLED(EXTENSIBLE_UI) @@ -247,7 +247,7 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l wait_for_user = true; #if ENABLED(HOST_PROMPT_SUPPORT) - host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Filament Purge Running..."), PSTR("Continue")); + host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Filament Purge Running..."), CONTINUE_STR); #endif #if ENABLED(EXTENSIBLE_UI) ExtUI::onUserConfirmRequired_P(PSTR("Filament Purge Running...")); @@ -283,7 +283,7 @@ bool load_filament(const float &slow_load_length/*=0*/, const float &fast_load_l host_action_prompt_button(PSTR("DisableRunout")); else { host_prompt_reason = PROMPT_FILAMENT_RUNOUT; - host_action_prompt_button(PSTR("Continue")); + host_action_prompt_button(CONTINUE_STR); } host_action_prompt_show(); #endif @@ -523,7 +523,7 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep KEEPALIVE_STATE(PAUSED_FOR_USER); wait_for_user = true; // LCD click or M108 will clear this #if ENABLED(HOST_PROMPT_SUPPORT) - host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Nozzle Parked"), PSTR("Continue")); + host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Nozzle Parked"), CONTINUE_STR); #endif #if ENABLED(EXTENSIBLE_UI) ExtUI::onUserConfirmRequired_P(PSTR("Nozzle Parked")); @@ -577,7 +577,7 @@ void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep HOTEND_LOOP() thermalManager.hotend_idle[e].start(nozzle_timeout); #if ENABLED(HOST_PROMPT_SUPPORT) - host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Reheat Done"), PSTR("Continue")); + host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Reheat Done"), CONTINUE_STR); #endif #if ENABLED(EXTENSIBLE_UI) ExtUI::onUserConfirmRequired_P(PSTR("Reheat finished.")); diff --git a/Marlin/src/feature/prusa_MMU2/mmu2.cpp b/Marlin/src/feature/prusa_MMU2/mmu2.cpp index d101cf7f9..2fdd6c09c 100644 --- a/Marlin/src/feature/prusa_MMU2/mmu2.cpp +++ b/Marlin/src/feature/prusa_MMU2/mmu2.cpp @@ -709,7 +709,7 @@ void MMU2::filament_runout() { BUZZ(200, 404); wait_for_user = true; #if ENABLED(HOST_PROMPT_SUPPORT) - host_prompt_do(PROMPT_USER_CONTINUE, PSTR("MMU2 Eject Recover"), PSTR("Continue")); + host_prompt_do(PROMPT_USER_CONTINUE, PSTR("MMU2 Eject Recover"), CONTINUE_STR); #endif #if ENABLED(EXTENSIBLE_UI) ExtUI::onUserConfirmRequired_P(PSTR("MMU2 Eject Recover")); diff --git a/Marlin/src/gcode/bedlevel/abl/G29.cpp b/Marlin/src/gcode/bedlevel/abl/G29.cpp index 1a9fa4bc7..41e5fce4d 100644 --- a/Marlin/src/gcode/bedlevel/abl/G29.cpp +++ b/Marlin/src/gcode/bedlevel/abl/G29.cpp @@ -560,7 +560,7 @@ G29_TYPE GcodeSuite::G29() { ExtUI::onMeshUpdate(meshCount, newz); #endif - if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("Save X", meshCount.x, " Y", meshCount.y, " Z", measured_z + zoffset); + if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR_P(PSTR("Save X"), meshCount.x, SP_Y_STR, meshCount.y, SP_Z_STR, measured_z + zoffset); #endif } diff --git a/Marlin/src/gcode/calibrate/G34_M422.cpp b/Marlin/src/gcode/calibrate/G34_M422.cpp index d74a9ce5d..704d370c4 100644 --- a/Marlin/src/gcode/calibrate/G34_M422.cpp +++ b/Marlin/src/gcode/calibrate/G34_M422.cpp @@ -362,10 +362,10 @@ void GcodeSuite::G34() { void GcodeSuite::M422() { if (!parser.seen_any()) { for (uint8_t i = 0; i < G34_PROBE_COUNT; ++i) - SERIAL_ECHOLNPAIR("M422 S", i + 1, " X", z_auto_align_pos[i].x, " Y", z_auto_align_pos[i].y); + SERIAL_ECHOLNPAIR_P(PSTR("M422 S"), i + 1, SP_X_STR, z_auto_align_pos[i].x, SP_Y_STR, z_auto_align_pos[i].y); #if ENABLED(Z_STEPPER_ALIGN_KNOWN_STEPPER_POSITIONS) for (uint8_t i = 0; i < Z_STEPPER_COUNT; ++i) - SERIAL_ECHOLNPAIR("M422 W", i + 1, " X", z_stepper_pos[i].x, " Y", z_stepper_pos[i].y); + SERIAL_ECHOLNPAIR_P(PSTR("M422 W"), i + 1, SP_X_STR, z_stepper_pos[i].x, SP_Y_STR, z_stepper_pos[i].y); #endif return; } diff --git a/Marlin/src/gcode/calibrate/G425.cpp b/Marlin/src/gcode/calibrate/G425.cpp index 2b2c16657..d251e89f8 100644 --- a/Marlin/src/gcode/calibrate/G425.cpp +++ b/Marlin/src/gcode/calibrate/G425.cpp @@ -326,12 +326,12 @@ inline void probe_sides(measurements_t &m, const float uncertainty) { inline void report_measured_center(const measurements_t &m) { SERIAL_ECHOLNPGM("Center:"); #if HAS_X_CENTER - SERIAL_ECHOLNPAIR(" X", m.obj_center.x); + SERIAL_ECHOLNPAIR_P(SP_X_STR, m.obj_center.x); #endif #if HAS_Y_CENTER - SERIAL_ECHOLNPAIR(" Y", m.obj_center.y); + SERIAL_ECHOLNPAIR_P(SP_Y_STR, m.obj_center.y); #endif - SERIAL_ECHOLNPAIR(" Z", m.obj_center.z); + SERIAL_ECHOLNPAIR_P(SP_Z_STR, m.obj_center.z); SERIAL_EOL(); } @@ -358,12 +358,12 @@ inline void probe_sides(measurements_t &m, const float uncertainty) { SERIAL_ECHO(int(active_extruder)); SERIAL_ECHOLNPGM(" Positional Error:"); #if HAS_X_CENTER - SERIAL_ECHOLNPAIR(" X", m.pos_error.x); + SERIAL_ECHOLNPAIR_P(SP_X_STR, m.pos_error.x); #endif #if HAS_Y_CENTER - SERIAL_ECHOLNPAIR(" Y", m.pos_error.y); + SERIAL_ECHOLNPAIR_P(SP_Y_STR, m.pos_error.y); #endif - SERIAL_ECHOLNPAIR(" Z", m.pos_error.z); + SERIAL_ECHOLNPAIR_P(SP_Z_STR, m.pos_error.z); SERIAL_EOL(); } @@ -371,10 +371,10 @@ inline void probe_sides(measurements_t &m, const float uncertainty) { SERIAL_ECHOLNPGM("Nozzle Tip Outer Dimensions:"); #if HAS_X_CENTER || HAS_Y_CENTER #if HAS_X_CENTER - SERIAL_ECHOLNPAIR(" X", m.nozzle_outer_dimension.x); + SERIAL_ECHOLNPAIR_P(SP_X_STR, m.nozzle_outer_dimension.x); #endif #if HAS_Y_CENTER - SERIAL_ECHOLNPAIR(" Y", m.nozzle_outer_dimension.y); + SERIAL_ECHOLNPAIR_P(SP_Y_STR, m.nozzle_outer_dimension.y); #endif #else UNUSED(m); @@ -388,7 +388,7 @@ inline void probe_sides(measurements_t &m, const float uncertainty) { // inline void report_hotend_offsets() { for (uint8_t e = 1; e < HOTENDS; e++) - SERIAL_ECHOLNPAIR("T", int(e), " Hotend Offset X", hotend_offset[e].x, " Y", hotend_offset[e].y, " Z", hotend_offset[e].z); + SERIAL_ECHOLNPAIR_P(PSTR("T"), int(e), PSTR(" Hotend Offset X"), hotend_offset[e].x, SP_Y_STR, hotend_offset[e].y, SP_Z_STR, hotend_offset[e].z); } #endif diff --git a/Marlin/src/gcode/calibrate/M48.cpp b/Marlin/src/gcode/calibrate/M48.cpp index ca3011067..86b25d824 100644 --- a/Marlin/src/gcode/calibrate/M48.cpp +++ b/Marlin/src/gcode/calibrate/M48.cpp @@ -178,12 +178,12 @@ void GcodeSuite::M48() { while (!position_is_reachable_by_probe(next_pos)) { next_pos *= 0.8f; if (verbose_level > 3) - SERIAL_ECHOLNPAIR("Moving inward: X", next_pos.x, " Y", next_pos.y); + SERIAL_ECHOLNPAIR_P(PSTR("Moving inward: X"), next_pos.x, SP_Y_STR, next_pos.y); } #endif if (verbose_level > 3) - SERIAL_ECHOLNPAIR("Going to: X", next_pos.x, " Y", next_pos.y); + SERIAL_ECHOLNPAIR_P(PSTR("Going to: X"), next_pos.x, SP_Y_STR, next_pos.y); do_blocking_move_to_xy(next_pos); } // n_legs loop diff --git a/Marlin/src/gcode/config/M217.cpp b/Marlin/src/gcode/config/M217.cpp index ade8c280f..3fe3feb0d 100644 --- a/Marlin/src/gcode/config/M217.cpp +++ b/Marlin/src/gcode/config/M217.cpp @@ -27,18 +27,22 @@ #include "../gcode.h" #include "../../module/tool_change.h" +#include "../../Marlin.h" // for SP_X_STR, etc. + +extern const char SP_X_STR[], SP_Y_STR[], SP_Z_STR[]; + void M217_report(const bool eeprom=false) { #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) serialprintPGM(eeprom ? PSTR(" M217") : PSTR("Toolchange:")); SERIAL_ECHOPAIR(" S", LINEAR_UNIT(toolchange_settings.swap_length)); - SERIAL_ECHOPAIR(" E", LINEAR_UNIT(toolchange_settings.extra_prime)); + SERIAL_ECHOPAIR_P(SP_E_STR, LINEAR_UNIT(toolchange_settings.extra_prime)); SERIAL_ECHOPAIR(" P", LINEAR_UNIT(toolchange_settings.prime_speed)); SERIAL_ECHOPAIR(" R", LINEAR_UNIT(toolchange_settings.retract_speed)); #if ENABLED(TOOLCHANGE_PARK) - SERIAL_ECHOPAIR(" X", LINEAR_UNIT(toolchange_settings.change_point.x)); - SERIAL_ECHOPAIR(" Y", LINEAR_UNIT(toolchange_settings.change_point.y)); + SERIAL_ECHOPAIR_P(SP_X_STR, LINEAR_UNIT(toolchange_settings.change_point.x)); + SERIAL_ECHOPAIR_P(SP_Y_STR, LINEAR_UNIT(toolchange_settings.change_point.y)); #endif #else @@ -47,7 +51,7 @@ void M217_report(const bool eeprom=false) { #endif - SERIAL_ECHOPAIR(" Z", LINEAR_UNIT(toolchange_settings.z_raise)); + SERIAL_ECHOPAIR_P(SP_Z_STR, LINEAR_UNIT(toolchange_settings.z_raise)); SERIAL_EOL(); } diff --git a/Marlin/src/gcode/config/M43.cpp b/Marlin/src/gcode/config/M43.cpp index 0fd213886..29fc0bdff 100644 --- a/Marlin/src/gcode/config/M43.cpp +++ b/Marlin/src/gcode/config/M43.cpp @@ -331,7 +331,7 @@ void GcodeSuite::M43() { KEEPALIVE_STATE(PAUSED_FOR_USER); wait_for_user = true; #if ENABLED(HOST_PROMPT_SUPPORT) - host_prompt_do(PROMPT_USER_CONTINUE, PSTR("M43 Wait Called"), PSTR("Continue")); + host_prompt_do(PROMPT_USER_CONTINUE, PSTR("M43 Wait Called"), CONTINUE_STR); #endif #if ENABLED(EXTENSIBLE_UI) ExtUI::onUserConfirmRequired_P(PSTR("M43 Wait Called")); diff --git a/Marlin/src/gcode/config/M92.cpp b/Marlin/src/gcode/config/M92.cpp index 8a98f4c5e..212b6f83b 100644 --- a/Marlin/src/gcode/config/M92.cpp +++ b/Marlin/src/gcode/config/M92.cpp @@ -25,11 +25,11 @@ void report_M92(const bool echo=true, const int8_t e=-1) { if (echo) SERIAL_ECHO_START(); else SERIAL_CHAR(' '); - SERIAL_ECHOPAIR(" M92 X", LINEAR_UNIT(planner.settings.axis_steps_per_mm[X_AXIS]), - " Y", LINEAR_UNIT(planner.settings.axis_steps_per_mm[Y_AXIS]), - " Z", LINEAR_UNIT(planner.settings.axis_steps_per_mm[Z_AXIS])); + SERIAL_ECHOPAIR_P(PSTR(" M92 X"), LINEAR_UNIT(planner.settings.axis_steps_per_mm[X_AXIS]), + SP_Y_STR, LINEAR_UNIT(planner.settings.axis_steps_per_mm[Y_AXIS]), + SP_Z_STR, LINEAR_UNIT(planner.settings.axis_steps_per_mm[Z_AXIS])); #if DISABLED(DISTINCT_E_FACTORS) - SERIAL_ECHOPAIR(" E", VOLUMETRIC_UNIT(planner.settings.axis_steps_per_mm[E_AXIS])); + SERIAL_ECHOPAIR_P(SP_E_STR, VOLUMETRIC_UNIT(planner.settings.axis_steps_per_mm[E_AXIS])); #endif SERIAL_EOL(); @@ -37,8 +37,8 @@ void report_M92(const bool echo=true, const int8_t e=-1) { for (uint8_t i = 0; i < E_STEPPERS; i++) { if (e >= 0 && i != e) continue; if (echo) SERIAL_ECHO_START(); else SERIAL_CHAR(' '); - SERIAL_ECHOLNPAIR(" M92 T", (int)i, - " E", VOLUMETRIC_UNIT(planner.settings.axis_steps_per_mm[E_AXIS_N(i)])); + SERIAL_ECHOLNPAIR_P(PSTR(" M92 T"), (int)i, + SP_E_STR, VOLUMETRIC_UNIT(planner.settings.axis_steps_per_mm[E_AXIS_N(i)])); } #endif diff --git a/Marlin/src/gcode/feature/mixing/M166.cpp b/Marlin/src/gcode/feature/mixing/M166.cpp index 8b74182cd..cb3541eb8 100644 --- a/Marlin/src/gcode/feature/mixing/M166.cpp +++ b/Marlin/src/gcode/feature/mixing/M166.cpp @@ -35,7 +35,7 @@ inline void echo_mix() { inline void echo_zt(const int t, const float &z) { mixer.update_mix_from_vtool(t); - SERIAL_ECHOPAIR(" Z", z, " T", t); + SERIAL_ECHOPAIR_P(SP_Z_STR, z, PSTR(" T"), t); echo_mix(); } diff --git a/Marlin/src/gcode/lcd/M0_M1.cpp b/Marlin/src/gcode/lcd/M0_M1.cpp index 42129edce..5bf9e9432 100644 --- a/Marlin/src/gcode/lcd/M0_M1.cpp +++ b/Marlin/src/gcode/lcd/M0_M1.cpp @@ -98,7 +98,7 @@ void GcodeSuite::M0_M1() { wait_for_user = true; #if ENABLED(HOST_PROMPT_SUPPORT) - host_prompt_do(PROMPT_USER_CONTINUE, PSTR("M0/1 Break Called"), PSTR("Continue")); + host_prompt_do(PROMPT_USER_CONTINUE, PSTR("M0/1 Break Called"), CONTINUE_STR); #endif if (ms > 0) { diff --git a/Marlin/src/gcode/motion/M290.cpp b/Marlin/src/gcode/motion/M290.cpp index 895060fcf..31411a069 100644 --- a/Marlin/src/gcode/motion/M290.cpp +++ b/Marlin/src/gcode/motion/M290.cpp @@ -103,12 +103,17 @@ void GcodeSuite::M290() { #if ENABLED(BABYSTEP_HOTEND_Z_OFFSET) { - SERIAL_ECHOLNPAIR("Hotend ", int(active_extruder), "Offset" + #error "Hey!" + SERIAL_ECHOLNPAIR_P( + PSTR("Hotend "), int(active_extruder) #if ENABLED(BABYSTEP_XY) - " X", hotend_offset[active_extruder].x, - " Y", hotend_offset[active_extruder].y, + , PSTR("Offset X"), hotend_offset[active_extruder].x + , SP_Y_STR, hotend_offset[active_extruder].y + , SP_Z_STR + #else + , PSTR("Offset Z") #endif - " Z", hotend_offset[active_extruder].z + , hotend_offset[active_extruder].z ); } #endif @@ -119,12 +124,15 @@ void GcodeSuite::M290() { #if ENABLED(BABYSTEP_DISPLAY_TOTAL) { - SERIAL_ECHOLNPAIR("Babystep" + SERIAL_ECHOLNPAIR_P( #if ENABLED(BABYSTEP_XY) - " X", babystep.axis_total[X_AXIS], - " Y", babystep.axis_total[Y_AXIS], + PSTR("Babystep X"), babystep.axis_total[X_AXIS] + , SP_Y_STR, babystep.axis_total[Y_AXIS] + , SP_Z_STR + #else + , PSTR("Babystep Z") #endif - " Z", babystep.axis_total[BS_TODO_AXIS(Z_AXIS)] + , babystep.axis_total[BS_TODO_AXIS(Z_AXIS)] ); } #endif diff --git a/Marlin/src/gcode/probe/M851.cpp b/Marlin/src/gcode/probe/M851.cpp index 19f96eecd..431fe6fa0 100644 --- a/Marlin/src/gcode/probe/M851.cpp +++ b/Marlin/src/gcode/probe/M851.cpp @@ -28,6 +28,8 @@ #include "../../feature/bedlevel/bedlevel.h" #include "../../module/probe.h" +extern const char SP_Y_STR[], SP_Z_STR[]; + /** * M851: Set the nozzle-to-probe offsets in current units */ @@ -35,7 +37,7 @@ void GcodeSuite::M851() { // Show usage with no parameters if (!parser.seen("XYZ")) { - SERIAL_ECHOLNPAIR(MSG_PROBE_OFFSET " X", probe_offset.x, " Y", probe_offset.y, " Z", probe_offset.z); + SERIAL_ECHOLNPAIR_P(PSTR(MSG_PROBE_OFFSET " X"), probe_offset.x, SP_Y_STR, probe_offset.y, SP_Z_STR, probe_offset.z); return; } diff --git a/Marlin/src/lcd/menu/menu_delta_calibrate.cpp b/Marlin/src/lcd/menu/menu_delta_calibrate.cpp index 3a6aa711d..75c427baf 100644 --- a/Marlin/src/lcd/menu/menu_delta_calibrate.cpp +++ b/Marlin/src/lcd/menu/menu_delta_calibrate.cpp @@ -61,7 +61,7 @@ void _man_probe_pt(const xy_pos_t &xy) { ui.defer_status_screen(); wait_for_user = true; #if ENABLED(HOST_PROMPT_SUPPORT) - host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Delta Calibration in progress"), PSTR("Continue")); + host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Delta Calibration in progress"), CONTINUE_STR); #endif #if ENABLED(EXTENSIBLE_UI) ExtUI::onUserConfirmRequired_P(PSTR("Delta Calibration in progress")); diff --git a/Marlin/src/libs/vector_3.cpp b/Marlin/src/libs/vector_3.cpp index f50fde5ed..53057906c 100644 --- a/Marlin/src/libs/vector_3.cpp +++ b/Marlin/src/libs/vector_3.cpp @@ -78,9 +78,9 @@ void vector_3::apply_rotation(const matrix_3x3 &matrix) { void vector_3::debug(PGM_P const title) { serialprintPGM(title); - SERIAL_ECHOPAIR_F(" X", x, 6); - SERIAL_ECHOPAIR_F(" Y", y, 6); - SERIAL_ECHOLNPAIR_F(" Z", z, 6); + SERIAL_ECHOPAIR_F_P(SP_X_STR, x, 6); + SERIAL_ECHOPAIR_F_P(SP_Y_STR, y, 6); + SERIAL_ECHOLNPAIR_F_P(SP_Z_STR, z, 6); } /** diff --git a/Marlin/src/module/configuration_store.cpp b/Marlin/src/module/configuration_store.cpp index 80a7c4ffc..fdd851c17 100644 --- a/Marlin/src/module/configuration_store.cpp +++ b/Marlin/src/module/configuration_store.cpp @@ -129,6 +129,8 @@ static const uint32_t _DMA[] PROGMEM = DEFAULT_MAX_ACCELERATION; static const float _DASU[] PROGMEM = DEFAULT_AXIS_STEPS_PER_UNIT; static const feedRate_t _DMF[] PROGMEM = DEFAULT_MAX_FEEDRATE; +extern const char SP_X_STR[], SP_Y_STR[], SP_Z_STR[], SP_E_STR[]; + /** * Current EEPROM Layout * @@ -2728,40 +2730,40 @@ void MarlinSettings::reset() { CONFIG_ECHO_HEADING("Maximum feedrates (units/s):"); CONFIG_ECHO_START(); - SERIAL_ECHOLNPAIR( - " M203 X", LINEAR_UNIT(planner.settings.max_feedrate_mm_s[X_AXIS]) - , " Y", LINEAR_UNIT(planner.settings.max_feedrate_mm_s[Y_AXIS]) - , " Z", LINEAR_UNIT(planner.settings.max_feedrate_mm_s[Z_AXIS]) + SERIAL_ECHOLNPAIR_P( + PSTR(" M203 X"), LINEAR_UNIT(planner.settings.max_feedrate_mm_s[X_AXIS]) + , SP_Y_STR, LINEAR_UNIT(planner.settings.max_feedrate_mm_s[Y_AXIS]) + , SP_Z_STR, LINEAR_UNIT(planner.settings.max_feedrate_mm_s[Z_AXIS]) #if DISABLED(DISTINCT_E_FACTORS) - , " E", VOLUMETRIC_UNIT(planner.settings.max_feedrate_mm_s[E_AXIS]) + , SP_E_STR, VOLUMETRIC_UNIT(planner.settings.max_feedrate_mm_s[E_AXIS]) #endif ); #if ENABLED(DISTINCT_E_FACTORS) CONFIG_ECHO_START(); for (uint8_t i = 0; i < E_STEPPERS; i++) { - SERIAL_ECHOLNPAIR( - " M203 T", (int)i - , " E", VOLUMETRIC_UNIT(planner.settings.max_feedrate_mm_s[E_AXIS_N(i)]) + SERIAL_ECHOLNPAIR_P( + PSTR(" M203 T"), (int)i + , SP_E_STR, VOLUMETRIC_UNIT(planner.settings.max_feedrate_mm_s[E_AXIS_N(i)]) ); } #endif CONFIG_ECHO_HEADING("Maximum Acceleration (units/s2):"); CONFIG_ECHO_START(); - SERIAL_ECHOLNPAIR( - " M201 X", LINEAR_UNIT(planner.settings.max_acceleration_mm_per_s2[X_AXIS]) - , " Y", LINEAR_UNIT(planner.settings.max_acceleration_mm_per_s2[Y_AXIS]) - , " Z", LINEAR_UNIT(planner.settings.max_acceleration_mm_per_s2[Z_AXIS]) + SERIAL_ECHOLNPAIR_P( + PSTR(" M201 X"), LINEAR_UNIT(planner.settings.max_acceleration_mm_per_s2[X_AXIS]) + , SP_Y_STR, LINEAR_UNIT(planner.settings.max_acceleration_mm_per_s2[Y_AXIS]) + , SP_Z_STR, LINEAR_UNIT(planner.settings.max_acceleration_mm_per_s2[Z_AXIS]) #if DISABLED(DISTINCT_E_FACTORS) - , " E", VOLUMETRIC_UNIT(planner.settings.max_acceleration_mm_per_s2[E_AXIS]) + , SP_E_STR, VOLUMETRIC_UNIT(planner.settings.max_acceleration_mm_per_s2[E_AXIS]) #endif ); #if ENABLED(DISTINCT_E_FACTORS) CONFIG_ECHO_START(); for (uint8_t i = 0; i < E_STEPPERS; i++) - SERIAL_ECHOLNPAIR( - " M201 T", (int)i - , " E", VOLUMETRIC_UNIT(planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(i)]) + SERIAL_ECHOLNPAIR_P( + PSTR(" M201 T"), (int)i + , SP_E_STR, VOLUMETRIC_UNIT(planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(i)]) ); #endif @@ -2788,19 +2790,19 @@ void MarlinSettings::reset() { SERIAL_EOL(); } CONFIG_ECHO_START(); - SERIAL_ECHOLNPAIR( - " M205 B", LINEAR_UNIT(planner.settings.min_segment_time_us) - , " S", LINEAR_UNIT(planner.settings.min_feedrate_mm_s) - , " T", LINEAR_UNIT(planner.settings.min_travel_feedrate_mm_s) + SERIAL_ECHOLNPAIR_P( + PSTR(" M205 B"), LINEAR_UNIT(planner.settings.min_segment_time_us) + , PSTR(" S"), LINEAR_UNIT(planner.settings.min_feedrate_mm_s) + , PSTR(" T"), LINEAR_UNIT(planner.settings.min_travel_feedrate_mm_s) #if DISABLED(CLASSIC_JERK) - , " J", LINEAR_UNIT(planner.junction_deviation_mm) + , PSTR(" J"), LINEAR_UNIT(planner.junction_deviation_mm) #endif #if HAS_CLASSIC_JERK - , " X", LINEAR_UNIT(planner.max_jerk.x) - , " Y", LINEAR_UNIT(planner.max_jerk.y) - , " Z", LINEAR_UNIT(planner.max_jerk.z) + , SP_X_STR, LINEAR_UNIT(planner.max_jerk.x) + , SP_Y_STR, LINEAR_UNIT(planner.max_jerk.y) + , SP_Z_STR, LINEAR_UNIT(planner.max_jerk.z) #if HAS_CLASSIC_E_JERK - , " E", LINEAR_UNIT(planner.max_jerk.e) + , SP_E_STR, LINEAR_UNIT(planner.max_jerk.e) #endif #endif ); @@ -2808,12 +2810,15 @@ void MarlinSettings::reset() { #if HAS_M206_COMMAND CONFIG_ECHO_HEADING("Home offset:"); CONFIG_ECHO_START(); - SERIAL_ECHOLNPAIR(" M206" + SERIAL_ECHOLNPAIR_P( #if IS_CARTESIAN - " X", LINEAR_UNIT(home_offset.x), - " Y", LINEAR_UNIT(home_offset.y), + PSTR(" M206 X"), LINEAR_UNIT(home_offset.x) + , SP_Y_STR, LINEAR_UNIT(home_offset.y) + , SP_Z_STR + #else + PSTR(" M206 Z") #endif - " Z", LINEAR_UNIT(home_offset.z) + , LINEAR_UNIT(home_offset.z) ); #endif @@ -2821,11 +2826,12 @@ void MarlinSettings::reset() { CONFIG_ECHO_HEADING("Hotend offsets:"); CONFIG_ECHO_START(); for (uint8_t e = 1; e < HOTENDS; e++) { - SERIAL_ECHOPAIR( - " M218 T", (int)e, - " X", LINEAR_UNIT(hotend_offset[e].x), " Y", LINEAR_UNIT(hotend_offset[e].y) + SERIAL_ECHOPAIR_P( + PSTR(" M218 T"), (int)e, + SP_X_STR, LINEAR_UNIT(hotend_offset[e].x), + SP_Y_STR, LINEAR_UNIT(hotend_offset[e].y) ); - SERIAL_ECHOLNPAIR_F(" Z", LINEAR_UNIT(hotend_offset[e].z), 3); + SERIAL_ECHOLNPAIR_F_P(SP_Z_STR, LINEAR_UNIT(hotend_offset[e].z), 3); } #endif @@ -2853,10 +2859,10 @@ void MarlinSettings::reset() { #endif CONFIG_ECHO_START(); - SERIAL_ECHOLNPAIR( - " M420 S", planner.leveling_active ? 1 : 0 + SERIAL_ECHOLNPAIR_P( + PSTR(" M420 S"), planner.leveling_active ? 1 : 0 #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) - , " Z", LINEAR_UNIT(planner.z_fade_height) + , SP_Z_STR, LINEAR_UNIT(planner.z_fade_height) #endif ); @@ -2866,8 +2872,8 @@ void MarlinSettings::reset() { for (uint8_t py = 0; py < GRID_MAX_POINTS_Y; py++) { for (uint8_t px = 0; px < GRID_MAX_POINTS_X; px++) { CONFIG_ECHO_START(); - SERIAL_ECHOPAIR(" G29 S3 X", (int)px + 1, " Y", (int)py + 1); - SERIAL_ECHOLNPAIR_F(" Z", LINEAR_UNIT(mbl.z_values[px][py]), 5); + SERIAL_ECHOPAIR_P(PSTR(" G29 S3 X"), (int)px + 1, SP_Y_STR, (int)py + 1); + SERIAL_ECHOLNPAIR_F_P(SP_Z_STR, LINEAR_UNIT(mbl.z_values[px][py]), 5); } } } @@ -2890,7 +2896,7 @@ void MarlinSettings::reset() { for (uint8_t px = 0; px < GRID_MAX_POINTS_X; px++) { CONFIG_ECHO_START(); SERIAL_ECHOPAIR(" G29 W I", (int)px, " J", (int)py); - SERIAL_ECHOLNPAIR_F(" Z", LINEAR_UNIT(z_values[px][py]), 5); + SERIAL_ECHOLNPAIR_F_P(SP_Z_STR, LINEAR_UNIT(z_values[px][py]), 5); } } } @@ -2926,33 +2932,33 @@ void MarlinSettings::reset() { CONFIG_ECHO_HEADING("SCARA settings: S P T"); CONFIG_ECHO_START(); - SERIAL_ECHOLNPAIR( - " M665 S", delta_segments_per_second - , " P", scara_home_offset.a - , " T", scara_home_offset.b - , " Z", LINEAR_UNIT(scara_home_offset.z) + SERIAL_ECHOLNPAIR_P( + PSTR(" M665 S"), delta_segments_per_second + , PSTR(" P"), scara_home_offset.a + , PSTR(" T"), scara_home_offset.b + , SP_Z_STR, LINEAR_UNIT(scara_home_offset.z) ); #elif ENABLED(DELTA) CONFIG_ECHO_HEADING("Endstop adjustment:"); CONFIG_ECHO_START(); - SERIAL_ECHOLNPAIR( - " M666 X", LINEAR_UNIT(delta_endstop_adj.a) - , " Y", LINEAR_UNIT(delta_endstop_adj.b) - , " Z", LINEAR_UNIT(delta_endstop_adj.c) + SERIAL_ECHOLNPAIR_P( + PSTR(" M666 X"), LINEAR_UNIT(delta_endstop_adj.a) + , SP_Y_STR, LINEAR_UNIT(delta_endstop_adj.b) + , SP_Z_STR, LINEAR_UNIT(delta_endstop_adj.c) ); CONFIG_ECHO_HEADING("Delta settings: L R H S XYZ"); CONFIG_ECHO_START(); - SERIAL_ECHOLNPAIR( - " M665 L", LINEAR_UNIT(delta_diagonal_rod) - , " R", LINEAR_UNIT(delta_radius) - , " H", LINEAR_UNIT(delta_height) - , " S", delta_segments_per_second - , " X", LINEAR_UNIT(delta_tower_angle_trim.a) - , " Y", LINEAR_UNIT(delta_tower_angle_trim.b) - , " Z", LINEAR_UNIT(delta_tower_angle_trim.c) + SERIAL_ECHOLNPAIR_P( + PSTR(" M665 L"), LINEAR_UNIT(delta_diagonal_rod) + , PSTR(" R"), LINEAR_UNIT(delta_radius) + , PSTR(" H"), LINEAR_UNIT(delta_height) + , PSTR(" S"), delta_segments_per_second + , SP_X_STR, LINEAR_UNIT(delta_tower_angle_trim.a) + , SP_Y_STR, LINEAR_UNIT(delta_tower_angle_trim.b) + , SP_Z_STR, LINEAR_UNIT(delta_tower_angle_trim.c) ); #elif EITHER(X_DUAL_ENDSTOPS, Y_DUAL_ENDSTOPS) || Z_MULTI_ENDSTOPS @@ -2961,17 +2967,17 @@ void MarlinSettings::reset() { CONFIG_ECHO_START(); SERIAL_ECHOPGM(" M666"); #if ENABLED(X_DUAL_ENDSTOPS) - SERIAL_ECHOPAIR(" X", LINEAR_UNIT(endstops.x2_endstop_adj)); + SERIAL_ECHOPAIR_P(SP_X_STR, LINEAR_UNIT(endstops.x2_endstop_adj)); #endif #if ENABLED(Y_DUAL_ENDSTOPS) - SERIAL_ECHOPAIR(" Y", LINEAR_UNIT(endstops.y2_endstop_adj)); + SERIAL_ECHOPAIR_P(SP_Y_STR, LINEAR_UNIT(endstops.y2_endstop_adj)); #endif #if ENABLED(Z_TRIPLE_ENDSTOPS) SERIAL_ECHOLNPAIR("S1 Z", LINEAR_UNIT(endstops.z2_endstop_adj)); CONFIG_ECHO_START(); SERIAL_ECHOPAIR(" M666 S2 Z", LINEAR_UNIT(endstops.z3_endstop_adj)); #elif ENABLED(Z_DUAL_ENDSTOPS) - SERIAL_ECHOPAIR(" Z", LINEAR_UNIT(endstops.z2_endstop_adj)); + SERIAL_ECHOPAIR_P(SP_Z_STR, LINEAR_UNIT(endstops.z2_endstop_adj)); #endif SERIAL_EOL(); @@ -2999,13 +3005,16 @@ void MarlinSettings::reset() { #if ENABLED(PIDTEMP) HOTEND_LOOP() { CONFIG_ECHO_START(); - SERIAL_ECHOPAIR(" M301" + SERIAL_ECHOPAIR_P( #if HOTENDS > 1 && ENABLED(PID_PARAMS_PER_HOTEND) - " E", e, + PSTR(" M301 E"), e, + PSTR(" P") + #else + PSTR(" M301 P") #endif - " P", PID_PARAM(Kp, e) - , " I", unscalePID_i(PID_PARAM(Ki, e)) - , " D", unscalePID_d(PID_PARAM(Kd, e)) + , PID_PARAM(Kp, e) + , PSTR(" I"), unscalePID_i(PID_PARAM(Ki, e)) + , PSTR(" D"), unscalePID_d(PID_PARAM(Kd, e)) ); #if ENABLED(PID_EXTRUSION_SCALING) SERIAL_ECHOPAIR(" C", PID_PARAM(Kc, e)); @@ -3051,11 +3060,11 @@ void MarlinSettings::reset() { CONFIG_ECHO_HEADING("Retract: S F Z"); CONFIG_ECHO_START(); - SERIAL_ECHOLNPAIR( - " M207 S", LINEAR_UNIT(fwretract.settings.retract_length) - , " W", LINEAR_UNIT(fwretract.settings.swap_retract_length) - , " F", LINEAR_UNIT(MMS_TO_MMM(fwretract.settings.retract_feedrate_mm_s)) - , " Z", LINEAR_UNIT(fwretract.settings.retract_zraise) + SERIAL_ECHOLNPAIR_P( + PSTR(" M207 S"), LINEAR_UNIT(fwretract.settings.retract_length) + , PSTR(" W"), LINEAR_UNIT(fwretract.settings.swap_retract_length) + , PSTR(" F"), LINEAR_UNIT(MMS_TO_MMM(fwretract.settings.retract_feedrate_mm_s)) + , SP_Z_STR, LINEAR_UNIT(fwretract.settings.retract_zraise) ); CONFIG_ECHO_HEADING("Recover: S F"); @@ -3086,9 +3095,9 @@ void MarlinSettings::reset() { say_units(true); } CONFIG_ECHO_START(); - SERIAL_ECHOLNPAIR(" M851 X", LINEAR_UNIT(probe_offset.x), - " Y", LINEAR_UNIT(probe_offset.y), - " Z", LINEAR_UNIT(probe_offset.z)); + SERIAL_ECHOLNPAIR_P(PSTR(" M851 X"), LINEAR_UNIT(probe_offset.x), + SP_Y_STR, LINEAR_UNIT(probe_offset.y), + SP_Z_STR, LINEAR_UNIT(probe_offset.z)); #endif /** @@ -3115,15 +3124,15 @@ void MarlinSettings::reset() { #if AXIS_IS_TMC(X) || AXIS_IS_TMC(Y) || AXIS_IS_TMC(Z) say_M906(forReplay); - SERIAL_ECHOLNPAIR( + SERIAL_ECHOLNPAIR_P( #if AXIS_IS_TMC(X) - " X", stepperX.getMilliamps(), + SP_X_STR, stepperX.getMilliamps(), #endif #if AXIS_IS_TMC(Y) - " Y", stepperY.getMilliamps(), + SP_Y_STR, stepperY.getMilliamps(), #endif #if AXIS_IS_TMC(Z) - " Z", stepperZ.getMilliamps() + SP_Z_STR, stepperZ.getMilliamps() #endif ); #endif @@ -3131,15 +3140,15 @@ void MarlinSettings::reset() { #if AXIS_IS_TMC(X2) || AXIS_IS_TMC(Y2) || AXIS_IS_TMC(Z2) say_M906(forReplay); SERIAL_ECHOPGM(" I1"); - SERIAL_ECHOLNPAIR( + SERIAL_ECHOLNPAIR_P( #if AXIS_IS_TMC(X2) - " X", stepperX2.getMilliamps(), + SP_X_STR, stepperX2.getMilliamps(), #endif #if AXIS_IS_TMC(Y2) - " Y", stepperY2.getMilliamps(), + SP_Y_STR, stepperY2.getMilliamps(), #endif #if AXIS_IS_TMC(Z2) - " Z", stepperZ2.getMilliamps() + SP_Z_STR, stepperZ2.getMilliamps() #endif ); #endif @@ -3184,13 +3193,13 @@ void MarlinSettings::reset() { say_M913(forReplay); #endif #if AXIS_HAS_STEALTHCHOP(X) - SERIAL_ECHOPAIR(" X", stepperX.get_pwm_thrs()); + SERIAL_ECHOPAIR_P(SP_X_STR, stepperX.get_pwm_thrs()); #endif #if AXIS_HAS_STEALTHCHOP(Y) - SERIAL_ECHOPAIR(" Y", stepperY.get_pwm_thrs()); + SERIAL_ECHOPAIR_P(SP_Y_STR, stepperY.get_pwm_thrs()); #endif #if AXIS_HAS_STEALTHCHOP(Z) - SERIAL_ECHOPAIR(" Z", stepperZ.get_pwm_thrs()); + SERIAL_ECHOPAIR_P(SP_Z_STR, stepperZ.get_pwm_thrs()); #endif #if AXIS_HAS_STEALTHCHOP(X) || AXIS_HAS_STEALTHCHOP(Y) || AXIS_HAS_STEALTHCHOP(Z) SERIAL_EOL(); @@ -3201,13 +3210,13 @@ void MarlinSettings::reset() { SERIAL_ECHOPGM(" I1"); #endif #if AXIS_HAS_STEALTHCHOP(X2) - SERIAL_ECHOPAIR(" X", stepperX2.get_pwm_thrs()); + SERIAL_ECHOPAIR_P(SP_X_STR, stepperX2.get_pwm_thrs()); #endif #if AXIS_HAS_STEALTHCHOP(Y2) - SERIAL_ECHOPAIR(" Y", stepperY2.get_pwm_thrs()); + SERIAL_ECHOPAIR_P(SP_Y_STR, stepperY2.get_pwm_thrs()); #endif #if AXIS_HAS_STEALTHCHOP(Z2) - SERIAL_ECHOPAIR(" Z", stepperZ2.get_pwm_thrs()); + SERIAL_ECHOPAIR_P(SP_Z_STR, stepperZ2.get_pwm_thrs()); #endif #if AXIS_HAS_STEALTHCHOP(X2) || AXIS_HAS_STEALTHCHOP(Y2) || AXIS_HAS_STEALTHCHOP(Z2) SERIAL_EOL(); @@ -3254,13 +3263,13 @@ void MarlinSettings::reset() { CONFIG_ECHO_START(); say_M914(); #if X_SENSORLESS - SERIAL_ECHOPAIR(" X", stepperX.homing_threshold()); + SERIAL_ECHOPAIR_P(SP_X_STR, stepperX.homing_threshold()); #endif #if Y_SENSORLESS - SERIAL_ECHOPAIR(" Y", stepperY.homing_threshold()); + SERIAL_ECHOPAIR_P(SP_Y_STR, stepperY.homing_threshold()); #endif #if Z_SENSORLESS - SERIAL_ECHOPAIR(" Z", stepperZ.homing_threshold()); + SERIAL_ECHOPAIR_P(SP_Z_STR, stepperZ.homing_threshold()); #endif SERIAL_EOL(); #endif @@ -3270,13 +3279,13 @@ void MarlinSettings::reset() { say_M914(); SERIAL_ECHOPGM(" I1"); #if X2_SENSORLESS - SERIAL_ECHOPAIR(" X", stepperX2.homing_threshold()); + SERIAL_ECHOPAIR_P(SP_X_STR, stepperX2.homing_threshold()); #endif #if Y2_SENSORLESS - SERIAL_ECHOPAIR(" Y", stepperY2.homing_threshold()); + SERIAL_ECHOPAIR_P(SP_Y_STR, stepperY2.homing_threshold()); #endif #if Z2_SENSORLESS - SERIAL_ECHOPAIR(" Z", stepperZ2.homing_threshold()); + SERIAL_ECHOPAIR_P(SP_Z_STR, stepperZ2.homing_threshold()); #endif SERIAL_EOL(); #endif @@ -3312,9 +3321,9 @@ void MarlinSettings::reset() { if (chop_x || chop_y || chop_z) { say_M569(forReplay); - if (chop_x) SERIAL_ECHOPGM(" X"); - if (chop_y) SERIAL_ECHOPGM(" Y"); - if (chop_z) SERIAL_ECHOPGM(" Z"); + if (chop_x) SERIAL_ECHOPGM_P(SP_X_STR); + if (chop_y) SERIAL_ECHOPGM_P(SP_Y_STR); + if (chop_z) SERIAL_ECHOPGM_P(SP_Z_STR); SERIAL_EOL(); } @@ -3336,9 +3345,9 @@ void MarlinSettings::reset() { if (chop_x2 || chop_y2 || chop_z2) { say_M569(forReplay, PSTR("I1")); - if (chop_x2) SERIAL_ECHOPGM(" X"); - if (chop_y2) SERIAL_ECHOPGM(" Y"); - if (chop_z2) SERIAL_ECHOPGM(" Z"); + if (chop_x2) SERIAL_ECHOPGM_P(SP_X_STR); + if (chop_y2) SERIAL_ECHOPGM_P(SP_Y_STR); + if (chop_z2) SERIAL_ECHOPGM_P(SP_Z_STR); SERIAL_EOL(); } @@ -3386,10 +3395,10 @@ void MarlinSettings::reset() { #if HAS_MOTOR_CURRENT_PWM CONFIG_ECHO_HEADING("Stepper motor currents:"); CONFIG_ECHO_START(); - SERIAL_ECHOLNPAIR( - " M907 X", stepper.motor_current_setting[0] - , " Z", stepper.motor_current_setting[1] - , " E", stepper.motor_current_setting[2] + SERIAL_ECHOLNPAIR_P( + PSTR(" M907 X"), stepper.motor_current_setting[0] + , SP_Z_STR, stepper.motor_current_setting[1] + , SP_E_STR, stepper.motor_current_setting[2] ); #endif @@ -3429,13 +3438,13 @@ void MarlinSettings::reset() { #if ENABLED(BACKLASH_GCODE) CONFIG_ECHO_HEADING("Backlash compensation:"); CONFIG_ECHO_START(); - SERIAL_ECHOLNPAIR( - " M425 F", backlash.get_correction(), - " X", LINEAR_UNIT(backlash.distance_mm.x), - " Y", LINEAR_UNIT(backlash.distance_mm.y), - " Z", LINEAR_UNIT(backlash.distance_mm.z) + SERIAL_ECHOLNPAIR_P( + PSTR(" M425 F"), backlash.get_correction() + , SP_X_STR, LINEAR_UNIT(backlash.distance_mm.x) + , SP_Y_STR, LINEAR_UNIT(backlash.distance_mm.y) + , SP_Z_STR, LINEAR_UNIT(backlash.distance_mm.z) #ifdef BACKLASH_SMOOTHING_MM - , " S", LINEAR_UNIT(backlash.smoothing_mm) + , PSTR(" S"), LINEAR_UNIT(backlash.smoothing_mm) #endif ); #endif diff --git a/Marlin/src/module/delta.cpp b/Marlin/src/module/delta.cpp index d1dc434e5..38d3d8146 100644 --- a/Marlin/src/module/delta.cpp +++ b/Marlin/src/module/delta.cpp @@ -117,7 +117,7 @@ float delta_calibration_radius() { */ #define DELTA_DEBUG(VAR) do { \ - SERIAL_ECHOLNPAIR("Cartesian X", VAR.x, " Y", VAR.y, " Z", VAR.z); \ + SERIAL_ECHOLNPAIR_P(PSTR("Cartesian X"), VAR.x, SP_Y_STR, VAR.y, SP_Z_STR, VAR.z); \ SERIAL_ECHOLNPAIR("Delta A", delta.a, " B", delta.b, " C", delta.c); \ }while(0) diff --git a/Marlin/src/module/probe.cpp b/Marlin/src/module/probe.cpp index cbe6035af..eaabd687f 100644 --- a/Marlin/src/module/probe.cpp +++ b/Marlin/src/module/probe.cpp @@ -129,7 +129,7 @@ xyz_pos_t probe_offset; // Initialized by settings.load() KEEPALIVE_STATE(PAUSED_FOR_USER); wait_for_user = true; // LCD click or M108 will clear this #if ENABLED(HOST_PROMPT_SUPPORT) - host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Deploy TouchMI probe."), PSTR("Continue")); + host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Deploy TouchMI probe."), CONTINUE_STR); #endif while (wait_for_user) idle(); ui.reset_status(); @@ -290,7 +290,7 @@ FORCE_INLINE void probe_specific_action(const bool deploy) { KEEPALIVE_STATE(PAUSED_FOR_USER); wait_for_user = true; #if ENABLED(HOST_PROMPT_SUPPORT) - host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Stow Probe"), PSTR("Continue")); + host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Stow Probe"), CONTINUE_STR); #endif #if ENABLED(EXTENSIBLE_UI) ExtUI::onUserConfirmRequired_P(PSTR("Stow Probe")); diff --git a/buildroot/share/tests/megaatmega2560-tests b/buildroot/share/tests/megaatmega2560-tests index df300cdab..f27005eb3 100755 --- a/buildroot/share/tests/megaatmega2560-tests +++ b/buildroot/share/tests/megaatmega2560-tests @@ -41,7 +41,7 @@ opt_enable REPRAP_DISCOUNT_SMART_CONTROLLER LCD_PROGRESS_BAR LCD_PROGRESS_BAR_TE FWRETRACT ARC_P_CIRCLES CNC_WORKSPACE_PLANES CNC_COORDINATE_SYSTEMS \ PSU_CONTROL AUTO_POWER_CONTROL POWER_LOSS_RECOVERY POWER_LOSS_PIN POWER_LOSS_STATE \ SLOW_PWM_HEATERS THERMAL_PROTECTION_CHAMBER LIN_ADVANCE \ - PINS_DEBUGGING MAX7219_DEBUG M114_DETAIL + HOST_ACTION_COMMANDS HOST_PROMPT_SUPPORT PINS_DEBUGGING MAX7219_DEBUG M114_DETAIL opt_set TEMP_SENSOR_CHAMBER 3 opt_set HEATER_CHAMBER_PIN 45 exec_test $1 $2 "RAMPS | EXTRUDERS 2 | CHAR LCD + SD | FIX Probe | ABL-Linear | Advanced Pause | PLR | LEDs ..."