From fbb30a25701e800deee1ca8296225712bca615af Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 28 Feb 2021 19:43:46 -0600 Subject: [PATCH] Serial macros cleanup --- Marlin/src/HAL/LPC1768/eeprom_sdcard.cpp | 7 +++---- Marlin/src/HAL/shared/Delay.cpp | 11 ++++------- Marlin/src/MarlinCore.cpp | 5 ++--- Marlin/src/core/debug_out.h | 4 ++-- Marlin/src/core/debug_section.h | 4 ++-- Marlin/src/core/utility.cpp | 6 +++--- Marlin/src/feature/bedlevel/ubl/ubl.cpp | 4 ++-- Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp | 6 +++--- Marlin/src/feature/host_actions.cpp | 9 ++++----- Marlin/src/feature/max7219.cpp | 2 +- Marlin/src/feature/meatpack.cpp | 2 +- Marlin/src/feature/pause.cpp | 2 +- Marlin/src/feature/powerloss.cpp | 2 +- Marlin/src/feature/probe_temp_comp.cpp | 2 +- Marlin/src/feature/runout.h | 8 +++----- Marlin/src/feature/tmc_util.cpp | 6 +++--- Marlin/src/feature/twibus.cpp | 4 ++-- Marlin/src/gcode/bedlevel/G35.cpp | 2 +- Marlin/src/gcode/bedlevel/abl/G29.cpp | 2 +- Marlin/src/gcode/calibrate/G28.cpp | 2 +- Marlin/src/gcode/calibrate/G33.cpp | 6 +++--- Marlin/src/gcode/calibrate/M852.cpp | 2 +- Marlin/src/gcode/config/M217.cpp | 2 +- Marlin/src/gcode/config/M302.cpp | 2 +- Marlin/src/gcode/config/M43.cpp | 2 +- Marlin/src/gcode/control/M111.cpp | 2 +- Marlin/src/gcode/control/M80_M81.cpp | 2 +- Marlin/src/gcode/feature/L6470/M122.cpp | 12 ++++++------ Marlin/src/gcode/feature/L6470/M906.cpp | 2 +- Marlin/src/gcode/feature/powerloss/M1000.cpp | 2 +- Marlin/src/gcode/feature/powerloss/M413.cpp | 4 ++-- Marlin/src/gcode/feature/trinamic/M569.cpp | 3 +-- Marlin/src/gcode/geometry/G17-G19.cpp | 2 +- Marlin/src/gcode/host/M115.cpp | 4 ++-- Marlin/src/gcode/host/M360.cpp | 5 ++--- Marlin/src/gcode/queue.cpp | 3 +-- .../src/lcd/extui/lib/anycubic_chiron/chiron_tft.cpp | 2 +- Marlin/src/libs/L64XX/L64XX_Marlin.cpp | 8 ++++---- Marlin/src/libs/stopwatch.cpp | 2 +- Marlin/src/libs/vector_3.cpp | 7 ++----- Marlin/src/module/endstops.cpp | 5 ++--- Marlin/src/module/planner.cpp | 2 +- Marlin/src/module/printcounter.cpp | 6 +++--- Marlin/src/module/probe.cpp | 5 ++--- Marlin/src/module/settings.cpp | 12 ++++++------ Marlin/src/module/temperature.cpp | 10 +++++----- Marlin/src/pins/pinsDebug.h | 10 +++++----- Marlin/src/sd/cardreader.cpp | 4 ++-- 48 files changed, 101 insertions(+), 117 deletions(-) diff --git a/Marlin/src/HAL/LPC1768/eeprom_sdcard.cpp b/Marlin/src/HAL/LPC1768/eeprom_sdcard.cpp index b97b161dc..70395251d 100644 --- a/Marlin/src/HAL/LPC1768/eeprom_sdcard.cpp +++ b/Marlin/src/HAL/LPC1768/eeprom_sdcard.cpp @@ -83,14 +83,13 @@ bool PersistentStore::access_finish() { static void debug_rw(const bool write, int &pos, const uint8_t *value, const size_t size, const FRESULT s, const size_t total=0) { PGM_P const rw_str = write ? PSTR("write") : PSTR("read"); SERIAL_CHAR(' '); - serialprintPGM(rw_str); + SERIAL_ECHOPGM_P(rw_str); SERIAL_ECHOLNPAIR("_data(", pos, ",", value, ",", size, ", ...)"); if (total) { SERIAL_ECHOPGM(" f_"); - serialprintPGM(rw_str); + SERIAL_ECHOPGM_P(rw_str); SERIAL_ECHOPAIR("()=", s, "\n size=", size, "\n bytes_"); - serialprintPGM(write ? PSTR("written=") : PSTR("read=")); - SERIAL_ECHOLN(total); + SERIAL_ECHOLNPAIR_P(write ? PSTR("written=") : PSTR("read="), total); } else SERIAL_ECHOLNPAIR(" f_lseek()=", s); diff --git a/Marlin/src/HAL/shared/Delay.cpp b/Marlin/src/HAL/shared/Delay.cpp index 8a021a215..129698fd3 100644 --- a/Marlin/src/HAL/shared/Delay.cpp +++ b/Marlin/src/HAL/shared/Delay.cpp @@ -109,11 +109,11 @@ void dump_delay_accuracy_check() { auto report_call_time = [](PGM_P const name, PGM_P const unit, const uint32_t cycles, const uint32_t total, const bool do_flush=true) { SERIAL_ECHOPGM("Calling "); - serialprintPGM(name); + SERIAL_ECHOPGM_P(name); SERIAL_ECHOLNPAIR(" for ", cycles); - serialprintPGM(unit); + SERIAL_ECHOPGM_P(unit); SERIAL_ECHOLNPAIR(" took: ", total); - serialprintPGM(unit); + SERIAL_ECHOPGM_P(unit); if (do_flush) SERIAL_FLUSHTX(); }; @@ -169,10 +169,7 @@ void calibrate_delay_loop() {} #if ENABLED(MARLIN_DEV_MODE) - void dump_delay_accuracy_check() { - static PGMSTR(none, "N/A on this platform"); - serialprintPGM(none); - } + void dump_delay_accuracy_check() { SERIAL_ECHOPGM_P(PSTR("N/A on this platform")); } #endif #endif diff --git a/Marlin/src/MarlinCore.cpp b/Marlin/src/MarlinCore.cpp index 464332840..751d09860 100644 --- a/Marlin/src/MarlinCore.cpp +++ b/Marlin/src/MarlinCore.cpp @@ -885,8 +885,7 @@ void setup() { auto log_current_ms = [&](PGM_P const msg) { SERIAL_ECHO_START(); SERIAL_CHAR('['); SERIAL_ECHO(millis()); SERIAL_ECHOPGM("] "); - serialprintPGM(msg); - SERIAL_EOL(); + SERIAL_ECHOLNPGM_P(msg); }; #define SETUP_LOG(M) log_current_ms(PSTR(M)) #else @@ -1003,7 +1002,7 @@ void setup() { if (mcu & RST_SOFTWARE) SERIAL_ECHOLNPGM(STR_SOFTWARE_RESET); HAL_clear_reset_source(); - serialprintPGM(GET_TEXT(MSG_MARLIN)); + SERIAL_ECHOPGM_P(GET_TEXT(MSG_MARLIN)); SERIAL_CHAR(' '); SERIAL_ECHOLNPGM(SHORT_BUILD_VERSION); SERIAL_EOL(); diff --git a/Marlin/src/core/debug_out.h b/Marlin/src/core/debug_out.h index 6ae1b9d8b..d93decf7a 100644 --- a/Marlin/src/core/debug_out.h +++ b/Marlin/src/core/debug_out.h @@ -59,7 +59,7 @@ #include "debug_section.h" #define DEBUG_SECTION(N,S,D) SectionLog N(PSTR(S),D) - #define DEBUG_PRINT_P(P) serialprintPGM(P) + #define DEBUG_ECHOPGM_P(P) SERIAL_ECHOPGM_P(P) #define DEBUG_ECHO_START SERIAL_ECHO_START #define DEBUG_ERROR_START SERIAL_ERROR_START #define DEBUG_CHAR SERIAL_CHAR @@ -89,7 +89,7 @@ #else #define DEBUG_SECTION(...) NOOP - #define DEBUG_PRINT_P(P) NOOP + #define DEBUG_ECHOPGM_P(P) NOOP #define DEBUG_ECHO_START() NOOP #define DEBUG_ERROR_START() NOOP #define DEBUG_CHAR(...) NOOP diff --git a/Marlin/src/core/debug_section.h b/Marlin/src/core/debug_section.h index 7f39bc742..2862d35af 100644 --- a/Marlin/src/core/debug_section.h +++ b/Marlin/src/core/debug_section.h @@ -38,10 +38,10 @@ private: bool debug; void echo_msg(PGM_P const pre) { - serialprintPGM(pre); + SERIAL_ECHOPGM_P(pre); if (the_msg) { SERIAL_CHAR(' '); - serialprintPGM(the_msg); + SERIAL_ECHOPGM_P(the_msg); } SERIAL_CHAR(' '); print_xyz(current_position); diff --git a/Marlin/src/core/utility.cpp b/Marlin/src/core/utility.cpp index f99956816..3d7897f95 100644 --- a/Marlin/src/core/utility.cpp +++ b/Marlin/src/core/utility.cpp @@ -92,9 +92,9 @@ void safe_delay(millis_t ms) { SERIAL_ECHOPGM(" (Aligned With"); if (probe.offset_xy.y > 0) - serialprintPGM(ENABLED(IS_SCARA) ? PSTR("-Distal") : PSTR("-Back")); + SERIAL_ECHOPGM_P(ENABLED(IS_SCARA) ? PSTR("-Distal") : PSTR("-Back")); else if (probe.offset_xy.y < 0) - serialprintPGM(ENABLED(IS_SCARA) ? PSTR("-Proximal") : PSTR("-Front")); + SERIAL_ECHOPGM_P(ENABLED(IS_SCARA) ? PSTR("-Proximal") : PSTR("-Front")); else if (probe.offset_xy.x != 0) SERIAL_ECHOPGM("-Center"); @@ -102,7 +102,7 @@ void safe_delay(millis_t ms) { #endif - serialprintPGM(probe.offset.z < 0 ? PSTR("Below") : probe.offset.z > 0 ? PSTR("Above") : PSTR("Same Z as")); + SERIAL_ECHOPGM_P(probe.offset.z < 0 ? PSTR("Below") : probe.offset.z > 0 ? PSTR("Above") : PSTR("Same Z as")); SERIAL_ECHOLNPGM(" Nozzle)"); #endif diff --git a/Marlin/src/feature/bedlevel/ubl/ubl.cpp b/Marlin/src/feature/bedlevel/ubl/ubl.cpp index 601f0ebb5..05b96daef 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl.cpp +++ b/Marlin/src/feature/bedlevel/ubl/ubl.cpp @@ -181,7 +181,7 @@ void unified_bed_leveling::display_map(const int map_type) { } else { SERIAL_ECHOPGM(" for "); - serialprintPGM(csv ? PSTR("CSV:\n") : PSTR("LCD:\n")); + SERIAL_ECHOPGM_P(csv ? PSTR("CSV:\n") : PSTR("LCD:\n")); } // Add XY probe offset from extruder because probe.probe_at_point() subtracts them when @@ -212,7 +212,7 @@ void unified_bed_leveling::display_map(const int map_type) { // TODO: Display on Graphical LCD } else if (isnan(f)) - serialprintPGM(human ? PSTR(" . ") : PSTR("NAN")); + SERIAL_ECHOPGM_P(human ? PSTR(" . ") : PSTR("NAN")); else if (human || csv) { if (human && f >= 0.0) SERIAL_CHAR(f > 0 ? '+' : ' '); // Display sign also for positive numbers (' ' for 0) SERIAL_ECHO_F(f, 3); // Positive: 5 digits, Negative: 6 digits diff --git a/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp b/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp index 044f6b610..8c70feb66 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp +++ b/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp @@ -908,11 +908,11 @@ void unified_bed_leveling::shift_mesh_height() { if (do_ubl_mesh_map) display_map(g29_map_type); // show user where we're probing if (parser.seen('B')) { - serialprintPGM(GET_TEXT(MSG_UBL_BC_INSERT)); + SERIAL_ECHOPGM_P(GET_TEXT(MSG_UBL_BC_INSERT)); LCD_MESSAGEPGM(MSG_UBL_BC_INSERT); } else { - serialprintPGM(GET_TEXT(MSG_UBL_BC_INSERT2)); + SERIAL_ECHOPGM_P(GET_TEXT(MSG_UBL_BC_INSERT2)); LCD_MESSAGEPGM(MSG_UBL_BC_INSERT2); } @@ -1576,7 +1576,7 @@ void unified_bed_leveling::smart_fill_mesh() { return normal.x * pos.x + normal.y * pos.y + zadd; }; auto debug_pt = [](PGM_P const pre, const xy_pos_t &pos, const float &zadd) { - d_from(); serialprintPGM(pre); + d_from(); SERIAL_ECHOPGM_P(pre); DEBUG_ECHO_F(normed(pos, zadd), 6); DEBUG_ECHOLNPAIR_F(" Z error = ", zadd - get_z_correction(pos), 6); }; diff --git a/Marlin/src/feature/host_actions.cpp b/Marlin/src/feature/host_actions.cpp index 77e4f3b9d..2a0b3dc3d 100644 --- a/Marlin/src/feature/host_actions.cpp +++ b/Marlin/src/feature/host_actions.cpp @@ -40,7 +40,7 @@ void host_action(PGM_P const pstr, const bool eol) { PORT_REDIRECT(SERIAL_ALL); SERIAL_ECHOPGM("//action:"); - serialprintPGM(pstr); + SERIAL_ECHOPGM_P(pstr); if (eol) SERIAL_EOL(); } @@ -86,14 +86,13 @@ void host_action(PGM_P const pstr, const bool eol) { void host_action_notify_P(PGM_P const message) { PORT_REDIRECT(SERIAL_ALL); host_action(PSTR("notification "), false); - serialprintPGM(message); - SERIAL_EOL(); + SERIAL_ECHOLNPGM_P(message); } void host_action_prompt(PGM_P const ptype, const bool eol=true) { PORT_REDIRECT(SERIAL_ALL); host_action(PSTR("prompt_"), false); - serialprintPGM(ptype); + SERIAL_ECHOPGM_P(ptype); if (eol) SERIAL_EOL(); } @@ -101,7 +100,7 @@ void host_action(PGM_P const pstr, const bool eol) { host_action_prompt(ptype, false); PORT_REDIRECT(SERIAL_ALL); SERIAL_CHAR(' '); - serialprintPGM(pstr); + SERIAL_ECHOPGM_P(pstr); if (extra_char != '\0') SERIAL_CHAR(extra_char); SERIAL_EOL(); } diff --git a/Marlin/src/feature/max7219.cpp b/Marlin/src/feature/max7219.cpp index ebcb56490..d7433cb7d 100644 --- a/Marlin/src/feature/max7219.cpp +++ b/Marlin/src/feature/max7219.cpp @@ -127,7 +127,7 @@ uint8_t Max7219::suspended; // = 0; void Max7219::error(const char * const func, const int32_t v1, const int32_t v2/*=-1*/) { #if ENABLED(MAX7219_ERRORS) SERIAL_ECHOPGM("??? Max7219::"); - serialprintPGM(func); + SERIAL_ECHOPGM_P(func); SERIAL_CHAR('('); SERIAL_ECHO(v1); if (v2 > 0) SERIAL_ECHOPAIR(", ", v2); diff --git a/Marlin/src/feature/meatpack.cpp b/Marlin/src/feature/meatpack.cpp index cb3979ea0..7e81dbed7 100644 --- a/Marlin/src/feature/meatpack.cpp +++ b/Marlin/src/feature/meatpack.cpp @@ -179,7 +179,7 @@ void MeatPack::report_state() { SERIAL_ECHOPGM("[MP] "); SERIAL_ECHOPGM(MeatPack_ProtocolVersion " "); serialprint_onoff(TEST(state, MPConfig_Bit_Active)); - serialprintPGM(TEST(state, MPConfig_Bit_NoSpaces) ? PSTR(" NSP\n") : PSTR(" ESP\n")); + SERIAL_ECHOPGM_P(TEST(state, MPConfig_Bit_NoSpaces) ? PSTR(" NSP\n") : PSTR(" ESP\n")); } /** diff --git a/Marlin/src/feature/pause.cpp b/Marlin/src/feature/pause.cpp index e0b4f88f9..c1f951e76 100644 --- a/Marlin/src/feature/pause.cpp +++ b/Marlin/src/feature/pause.cpp @@ -460,7 +460,7 @@ void show_continue_prompt(const bool is_reload) { ui.pause_show_message(is_reload ? PAUSE_MESSAGE_INSERT : PAUSE_MESSAGE_WAITING); SERIAL_ECHO_START(); - serialprintPGM(is_reload ? PSTR(_PMSG(STR_FILAMENT_CHANGE_INSERT) "\n") : PSTR(_PMSG(STR_FILAMENT_CHANGE_WAIT) "\n")); + SERIAL_ECHOPGM_P(is_reload ? PSTR(_PMSG(STR_FILAMENT_CHANGE_INSERT) "\n") : PSTR(_PMSG(STR_FILAMENT_CHANGE_WAIT) "\n")); } void wait_for_confirmation(const bool is_reload/*=false*/, const int8_t max_beep_count/*=0*/ DXC_ARGS) { diff --git a/Marlin/src/feature/powerloss.cpp b/Marlin/src/feature/powerloss.cpp index 46b94dbc1..1b1f2bd68 100644 --- a/Marlin/src/feature/powerloss.cpp +++ b/Marlin/src/feature/powerloss.cpp @@ -531,7 +531,7 @@ void PrintJobRecovery::resume() { #if ENABLED(DEBUG_POWER_LOSS_RECOVERY) void PrintJobRecovery::debug(PGM_P const prefix) { - DEBUG_PRINT_P(prefix); + DEBUG_ECHOPGM_P(prefix); DEBUG_ECHOLNPAIR(" Job Recovery Info...\nvalid_head:", info.valid_head, " valid_foot:", info.valid_foot); if (info.valid_head) { if (info.valid_head == info.valid_foot) { diff --git a/Marlin/src/feature/probe_temp_comp.cpp b/Marlin/src/feature/probe_temp_comp.cpp index af8039d8b..8fdf160d0 100644 --- a/Marlin/src/feature/probe_temp_comp.cpp +++ b/Marlin/src/feature/probe_temp_comp.cpp @@ -73,7 +73,7 @@ void ProbeTempComp::print_offsets() { LOOP_L_N(s, TSI_COUNT) { float temp = cali_info[s].start_temp; for (int16_t i = -1; i < cali_info[s].measurements; ++i) { - serialprintPGM(s == TSI_BED ? PSTR("Bed") : + SERIAL_ECHOPGM_P(s == TSI_BED ? PSTR("Bed") : #if ENABLED(USE_TEMP_EXT_COMPENSATION) s == TSI_EXT ? PSTR("Extruder") : #endif diff --git a/Marlin/src/feature/runout.h b/Marlin/src/feature/runout.h index 60154c5e4..ecf47b22c 100644 --- a/Marlin/src/feature/runout.h +++ b/Marlin/src/feature/runout.h @@ -287,7 +287,7 @@ class FilamentSensorBase { if (out != was_out) { was_out = out; SERIAL_ECHOPGM("Filament "); - serialprintPGM(out ? PSTR("OUT\n") : PSTR("IN\n")); + SERIAL_ECHOPGM_P(out ? PSTR("OUT\n") : PSTR("IN\n")); } #endif } @@ -320,10 +320,8 @@ class FilamentSensorBase { const millis_t ms = millis(); if (ELAPSED(ms, t)) { t = millis() + 1000UL; - LOOP_L_N(i, EXTRUDERS) { - serialprintPGM(i ? PSTR(", ") : PSTR("Remaining mm: ")); - SERIAL_ECHO(runout_mm_countdown[i]); - } + LOOP_L_N(i, EXTRUDERS) + SERIAL_ECHOPAIR_P(i ? PSTR(", ") : PSTR("Remaining mm: "), runout_mm_countdown[i]); SERIAL_EOL(); } #endif diff --git a/Marlin/src/feature/tmc_util.cpp b/Marlin/src/feature/tmc_util.cpp index a16af31e5..a4f71414a 100644 --- a/Marlin/src/feature/tmc_util.cpp +++ b/Marlin/src/feature/tmc_util.cpp @@ -546,7 +546,7 @@ }; template - static void print_vsense(TMC &st) { serialprintPGM(st.vsense() ? PSTR("1=.18") : PSTR("0=.325")); } + static void print_vsense(TMC &st) { SERIAL_ECHOPGM_P(st.vsense() ? PSTR("1=.18") : PSTR("0=.325")); } #if HAS_DRIVER(TMC2130) || HAS_DRIVER(TMC5130) static void _tmc_status(TMC2130Stepper &st, const TMC_debug_enum i) { @@ -717,7 +717,7 @@ SERIAL_ECHO(st.cs()); SERIAL_ECHOPGM("/31"); break; - case TMC_VSENSE: serialprintPGM(st.vsense() ? PSTR("1=.165") : PSTR("0=.310")); break; + case TMC_VSENSE: SERIAL_ECHOPGM_P(st.vsense() ? PSTR("1=.165") : PSTR("0=.310")); break; case TMC_MICROSTEPS: SERIAL_ECHO(st.microsteps()); break; //case TMC_OTPW: serialprint_truefalse(st.otpw()); break; //case TMC_OTPW_TRIGGERED: serialprint_truefalse(st.getOTPW()); break; @@ -1208,7 +1208,7 @@ static bool test_connection(TMC &st) { case 1: stat = PSTR("HIGH"); break; case 2: stat = PSTR("LOW"); break; } - serialprintPGM(stat); + SERIAL_ECHOPGM_P(stat); SERIAL_EOL(); return test_result; diff --git a/Marlin/src/feature/twibus.cpp b/Marlin/src/feature/twibus.cpp index 855a3188d..755224544 100644 --- a/Marlin/src/feature/twibus.cpp +++ b/Marlin/src/feature/twibus.cpp @@ -83,7 +83,7 @@ void TWIBus::send() { // static void TWIBus::echoprefix(uint8_t bytes, const char pref[], uint8_t adr) { SERIAL_ECHO_START(); - serialprintPGM(pref); + SERIAL_ECHOPGM_P(pref); SERIAL_ECHOPAIR(": from:", adr, " bytes:", bytes, " data:"); } @@ -172,7 +172,7 @@ void TWIBus::flush() { // static void TWIBus::prefix(const char func[]) { SERIAL_ECHOPGM("TWIBus::"); - serialprintPGM(func); + SERIAL_ECHOPGM_P(func); SERIAL_ECHOPGM(": "); } void TWIBus::debug(const char func[], uint32_t adr) { diff --git a/Marlin/src/gcode/bedlevel/G35.cpp b/Marlin/src/gcode/bedlevel/G35.cpp index 5195ff87c..88f02e6de 100644 --- a/Marlin/src/gcode/bedlevel/G35.cpp +++ b/Marlin/src/gcode/bedlevel/G35.cpp @@ -114,7 +114,7 @@ void GcodeSuite::G35() { if (DEBUGGING(LEVELING)) { DEBUG_ECHOPAIR("Probing point ", i, " ("); - DEBUG_PRINT_P((char *)pgm_read_ptr(&tramming_point_name[i])); + DEBUG_ECHOPGM_P((char *)pgm_read_ptr(&tramming_point_name[i])); DEBUG_CHAR(')'); DEBUG_ECHOLNPAIR_P(SP_X_STR, screws_tilt_adjust_pos[i].x, SP_Y_STR, screws_tilt_adjust_pos[i].y, SP_Z_STR, z_probed_height); } diff --git a/Marlin/src/gcode/bedlevel/abl/G29.cpp b/Marlin/src/gcode/bedlevel/abl/G29.cpp index 233e7f741..e642c1ccf 100644 --- a/Marlin/src/gcode/bedlevel/abl/G29.cpp +++ b/Marlin/src/gcode/bedlevel/abl/G29.cpp @@ -786,7 +786,7 @@ G29_TYPE GcodeSuite::G29() { float min_diff = 999; auto print_topo_map = [&](PGM_P const title, const bool get_min) { - serialprintPGM(title); + SERIAL_ECHOPGM_P(title); for (int8_t yy = abl_grid_points.y - 1; yy >= 0; yy--) { LOOP_L_N(xx, abl_grid_points.x) { const int ind = indexIntoAB[xx][yy]; diff --git a/Marlin/src/gcode/calibrate/G28.cpp b/Marlin/src/gcode/calibrate/G28.cpp index a2de1dfe3..430daf6ba 100644 --- a/Marlin/src/gcode/calibrate/G28.cpp +++ b/Marlin/src/gcode/calibrate/G28.cpp @@ -259,7 +259,7 @@ void GcodeSuite::G28() { #if HAS_HOMING_CURRENT auto debug_current = [](PGM_P const s, const int16_t a, const int16_t b){ - serialprintPGM(s); DEBUG_ECHOLNPAIR(" current: ", a, " -> ", b); + DEBUG_ECHOPGM_P(s); DEBUG_ECHOLNPAIR(" current: ", a, " -> ", b); }; #if HAS_CURRENT_HOME(X) const int16_t tmc_save_current_X = stepperX.getMilliamps(); diff --git a/Marlin/src/gcode/calibrate/G33.cpp b/Marlin/src/gcode/calibrate/G33.cpp index 77cc45771..5530bc708 100644 --- a/Marlin/src/gcode/calibrate/G33.cpp +++ b/Marlin/src/gcode/calibrate/G33.cpp @@ -93,7 +93,7 @@ void ac_cleanup(TERN_(HAS_MULTI_HOTEND, const uint8_t old_tool_index)) { void print_signed_float(PGM_P const prefix, const float &f) { SERIAL_ECHOPGM(" "); - serialprintPGM(prefix); + SERIAL_ECHOPGM_P(prefix); SERIAL_CHAR(':'); if (f >= 0) SERIAL_CHAR('+'); SERIAL_ECHO_F(f, 2); @@ -449,7 +449,7 @@ void GcodeSuite::G33() { // Report settings PGM_P const checkingac = PSTR("Checking... AC"); - serialprintPGM(checkingac); + SERIAL_ECHOPGM_P(checkingac); if (verbose_level == 0) SERIAL_ECHOPGM(" (DRY-RUN)"); SERIAL_EOL(); ui.set_status_P(checkingac); @@ -625,7 +625,7 @@ void GcodeSuite::G33() { } else { // dry run PGM_P const enddryrun = PSTR("End DRY-RUN"); - serialprintPGM(enddryrun); + SERIAL_ECHOPGM_P(enddryrun); SERIAL_ECHO_SP(35); SERIAL_ECHOLNPAIR_F("std dev:", zero_std_dev, 3); diff --git a/Marlin/src/gcode/calibrate/M852.cpp b/Marlin/src/gcode/calibrate/M852.cpp index b60f41748..e52f03b86 100644 --- a/Marlin/src/gcode/calibrate/M852.cpp +++ b/Marlin/src/gcode/calibrate/M852.cpp @@ -93,7 +93,7 @@ void GcodeSuite::M852() { if (!ijk) { SERIAL_ECHO_START(); - serialprintPGM(GET_TEXT(MSG_SKEW_FACTOR)); + SERIAL_ECHOPGM_P(GET_TEXT(MSG_SKEW_FACTOR)); SERIAL_ECHOPAIR_F(" XY: ", planner.skew_factor.xy, 6); #if ENABLED(SKEW_CORRECTION_FOR_Z) SERIAL_ECHOPAIR_F(" XZ: ", planner.skew_factor.xz, 6); diff --git a/Marlin/src/gcode/config/M217.cpp b/Marlin/src/gcode/config/M217.cpp index ebe1dbc03..2035ae55a 100644 --- a/Marlin/src/gcode/config/M217.cpp +++ b/Marlin/src/gcode/config/M217.cpp @@ -36,7 +36,7 @@ void M217_report(const bool eeprom=false) { #if ENABLED(TOOLCHANGE_FILAMENT_SWAP) - serialprintPGM(eeprom ? PSTR(" M217") : PSTR("Toolchange:")); + SERIAL_ECHOPGM_P(eeprom ? PSTR(" M217") : PSTR("Toolchange:")); SERIAL_ECHOPAIR(" S", LINEAR_UNIT(toolchange_settings.swap_length)); SERIAL_ECHOPAIR_P(SP_B_STR, LINEAR_UNIT(toolchange_settings.extra_resume), SP_E_STR, LINEAR_UNIT(toolchange_settings.extra_prime), diff --git a/Marlin/src/gcode/config/M302.cpp b/Marlin/src/gcode/config/M302.cpp index afdc6c9e8..e3ce5a10e 100644 --- a/Marlin/src/gcode/config/M302.cpp +++ b/Marlin/src/gcode/config/M302.cpp @@ -55,7 +55,7 @@ void GcodeSuite::M302() { // Report current state SERIAL_ECHO_START(); SERIAL_ECHOPGM("Cold extrudes are "); - serialprintPGM(thermalManager.allow_cold_extrude ? PSTR("en") : PSTR("dis")); + SERIAL_ECHOPGM_P(thermalManager.allow_cold_extrude ? PSTR("en") : PSTR("dis")); SERIAL_ECHOLNPAIR("abled (min temp ", thermalManager.extrude_min_temp, "C)"); } } diff --git a/Marlin/src/gcode/config/M43.cpp b/Marlin/src/gcode/config/M43.cpp index 42a74fb54..4009721a5 100644 --- a/Marlin/src/gcode/config/M43.cpp +++ b/Marlin/src/gcode/config/M43.cpp @@ -303,7 +303,7 @@ void GcodeSuite::M43() { if (parser.seen('E')) { endstops.monitor_flag = parser.value_bool(); SERIAL_ECHOPGM("endstop monitor "); - serialprintPGM(endstops.monitor_flag ? PSTR("en") : PSTR("dis")); + SERIAL_ECHOPGM_P(endstops.monitor_flag ? PSTR("en") : PSTR("dis")); SERIAL_ECHOLNPGM("abled"); return; } diff --git a/Marlin/src/gcode/control/M111.cpp b/Marlin/src/gcode/control/M111.cpp index 38cb06532..8e677080e 100644 --- a/Marlin/src/gcode/control/M111.cpp +++ b/Marlin/src/gcode/control/M111.cpp @@ -49,7 +49,7 @@ void GcodeSuite::M111() { LOOP_L_N(i, COUNT(debug_strings)) { if (TEST(marlin_debug_flags, i)) { if (comma++) SERIAL_CHAR(','); - serialprintPGM((char*)pgm_read_ptr(&debug_strings[i])); + SERIAL_ECHOPGM_P((char*)pgm_read_ptr(&debug_strings[i])); } } } diff --git a/Marlin/src/gcode/control/M80_M81.cpp b/Marlin/src/gcode/control/M80_M81.cpp index 394b06d8a..1b5ea2f7e 100644 --- a/Marlin/src/gcode/control/M80_M81.cpp +++ b/Marlin/src/gcode/control/M80_M81.cpp @@ -56,7 +56,7 @@ // S: Report the current power supply state and exit if (parser.seen('S')) { - serialprintPGM(powersupply_on ? PSTR("PS:1\n") : PSTR("PS:0\n")); + SERIAL_ECHOPGM_P(powersupply_on ? PSTR("PS:1\n") : PSTR("PS:0\n")); return; } diff --git a/Marlin/src/gcode/feature/L6470/M122.cpp b/Marlin/src/gcode/feature/L6470/M122.cpp index d2b7f7399..cfac42764 100644 --- a/Marlin/src/gcode/feature/L6470/M122.cpp +++ b/Marlin/src/gcode/feature/L6470/M122.cpp @@ -41,16 +41,16 @@ inline void L6470_say_status(const L64XX_axis_t axis) { SERIAL_ECHO(temp_buf); print_bin(sh.STATUS_AXIS_RAW); switch (sh.STATUS_AXIS_LAYOUT) { - case L6470_STATUS_LAYOUT: serialprintPGM(PSTR(" L6470")); break; - case L6474_STATUS_LAYOUT: serialprintPGM(PSTR(" L6474")); break; - case L6480_STATUS_LAYOUT: serialprintPGM(PSTR(" L6480/powerSTEP01")); break; + case L6470_STATUS_LAYOUT: SERIAL_ECHOPGM(" L6470"); break; + case L6474_STATUS_LAYOUT: SERIAL_ECHOPGM(" L6474"); break; + case L6480_STATUS_LAYOUT: SERIAL_ECHOPGM(" L6480/powerSTEP01"); break; } #endif SERIAL_ECHOPGM("\n...OUTPUT: "); - serialprintPGM(sh.STATUS_AXIS & STATUS_HIZ ? PSTR("OFF") : PSTR("ON ")); + SERIAL_ECHOPGM_P(sh.STATUS_AXIS & STATUS_HIZ ? PSTR("OFF") : PSTR("ON ")); SERIAL_ECHOPGM(" BUSY: "); echo_yes_no((sh.STATUS_AXIS & STATUS_BUSY) == 0); SERIAL_ECHOPGM(" DIR: "); - serialprintPGM((((sh.STATUS_AXIS & STATUS_DIR) >> 4) ^ L64xxManager.index_to_dir[axis]) ? PSTR("FORWARD") : PSTR("REVERSE")); + SERIAL_ECHOPGM_P((((sh.STATUS_AXIS & STATUS_DIR) >> 4) ^ L64xxManager.index_to_dir[axis]) ? PSTR("FORWARD") : PSTR("REVERSE")); if (sh.STATUS_AXIS_LAYOUT == L6480_STATUS_LAYOUT) { SERIAL_ECHOPGM(" Last Command: "); if (sh.STATUS_AXIS & sh.STATUS_AXIS_WRONG_CMD) SERIAL_ECHOPGM("VALID"); @@ -67,7 +67,7 @@ inline void L6470_say_status(const L64XX_axis_t axis) { SERIAL_ECHOPGM(" Last Command: "); if (!(sh.STATUS_AXIS & sh.STATUS_AXIS_WRONG_CMD)) SERIAL_ECHOPGM("IN"); SERIAL_ECHOPGM("VALID "); - serialprintPGM(sh.STATUS_AXIS & sh.STATUS_AXIS_NOTPERF_CMD ? PSTR("COMPLETED ") : PSTR("Not PERFORMED")); + SERIAL_ECHOPGM_P(sh.STATUS_AXIS & sh.STATUS_AXIS_NOTPERF_CMD ? PSTR("COMPLETED ") : PSTR("Not PERFORMED")); SERIAL_ECHOPAIR("\n...THERMAL: ", !(sh.STATUS_AXIS & sh.STATUS_AXIS_TH_SD) ? "SHUTDOWN " : !(sh.STATUS_AXIS & sh.STATUS_AXIS_TH_WRN) ? "WARNING " : "OK "); } SERIAL_ECHOPGM(" OVERCURRENT:"); echo_yes_no((sh.STATUS_AXIS & sh.STATUS_AXIS_OCD) == 0); diff --git a/Marlin/src/gcode/feature/L6470/M906.cpp b/Marlin/src/gcode/feature/L6470/M906.cpp index 7bd446a1a..3638fae45 100644 --- a/Marlin/src/gcode/feature/L6470/M906.cpp +++ b/Marlin/src/gcode/feature/L6470/M906.cpp @@ -132,7 +132,7 @@ void L64XX_report_current(L64XX &motor, const L64XX_axis_t axis) { SERIAL_ECHOPAIR("...MicroSteps: ", MicroSteps, " ADC_OUT: ", L6470_ADC_out); SERIAL_ECHOPGM(" Vs_compensation: "); - serialprintPGM((motor.GetParam(sh.L6470_AXIS_CONFIG) & CONFIG_EN_VSCOMP) ? PSTR("ENABLED ") : PSTR("DISABLED")); + SERIAL_ECHOPGM_P((motor.GetParam(sh.L6470_AXIS_CONFIG) & CONFIG_EN_VSCOMP) ? PSTR("ENABLED ") : PSTR("DISABLED")); SERIAL_ECHOLNPAIR(" Compensation coefficient: ~", comp_coef * 0.01f); SERIAL_ECHOPAIR("...KVAL_HOLD: ", motor.GetParam(L6470_KVAL_HOLD), diff --git a/Marlin/src/gcode/feature/powerloss/M1000.cpp b/Marlin/src/gcode/feature/powerloss/M1000.cpp index 14c92531f..a31b7732f 100644 --- a/Marlin/src/gcode/feature/powerloss/M1000.cpp +++ b/Marlin/src/gcode/feature/powerloss/M1000.cpp @@ -40,7 +40,7 @@ void menu_job_recovery(); inline void plr_error(PGM_P const prefix) { #if ENABLED(DEBUG_POWER_LOSS_RECOVERY) DEBUG_ECHO_START(); - serialprintPGM(prefix); + DEBUG_ECHOPGM_P(prefix); DEBUG_ECHOLNPGM(" Job Recovery Data"); #else UNUSED(prefix); diff --git a/Marlin/src/gcode/feature/powerloss/M413.cpp b/Marlin/src/gcode/feature/powerloss/M413.cpp index 64573e5df..e6e3ac3b3 100644 --- a/Marlin/src/gcode/feature/powerloss/M413.cpp +++ b/Marlin/src/gcode/feature/powerloss/M413.cpp @@ -54,8 +54,8 @@ void GcodeSuite::M413() { #if PIN_EXISTS(POWER_LOSS) if (parser.seen('O')) recovery._outage(); #endif - if (parser.seen('E')) serialprintPGM(recovery.exists() ? PSTR("PLR Exists\n") : PSTR("No PLR\n")); - if (parser.seen('V')) serialprintPGM(recovery.valid() ? PSTR("Valid\n") : PSTR("Invalid\n")); + if (parser.seen('E')) SERIAL_ECHOPGM_P(recovery.exists() ? PSTR("PLR Exists\n") : PSTR("No PLR\n")); + if (parser.seen('V')) SERIAL_ECHOPGM_P(recovery.valid() ? PSTR("Valid\n") : PSTR("Invalid\n")); #endif } diff --git a/Marlin/src/gcode/feature/trinamic/M569.cpp b/Marlin/src/gcode/feature/trinamic/M569.cpp index 6b379f119..a92812004 100644 --- a/Marlin/src/gcode/feature/trinamic/M569.cpp +++ b/Marlin/src/gcode/feature/trinamic/M569.cpp @@ -32,8 +32,7 @@ template void tmc_say_stealth_status(TMC &st) { st.printLabel(); SERIAL_ECHOPGM(" driver mode:\t"); - serialprintPGM(st.get_stealthChop() ? PSTR("stealthChop") : PSTR("spreadCycle")); - SERIAL_EOL(); + SERIAL_ECHOLNPGM_P(st.get_stealthChop() ? PSTR("stealthChop") : PSTR("spreadCycle")); } template void tmc_set_stealthChop(TMC &st, const bool enable) { diff --git a/Marlin/src/gcode/geometry/G17-G19.cpp b/Marlin/src/gcode/geometry/G17-G19.cpp index 7510eaba8..0154598cc 100644 --- a/Marlin/src/gcode/geometry/G17-G19.cpp +++ b/Marlin/src/gcode/geometry/G17-G19.cpp @@ -29,7 +29,7 @@ inline void report_workspace_plane() { SERIAL_ECHO_START(); SERIAL_ECHOPGM("Workspace Plane "); - serialprintPGM( + SERIAL_ECHOPGM_P( gcode.workspace_plane == GcodeSuite::PLANE_YZ ? PSTR("YZ\n") : gcode.workspace_plane == GcodeSuite::PLANE_ZX ? PSTR("ZX\n") : PSTR("XY\n") diff --git a/Marlin/src/gcode/host/M115.cpp b/Marlin/src/gcode/host/M115.cpp index 40fdbd6d3..ac712aea0 100644 --- a/Marlin/src/gcode/host/M115.cpp +++ b/Marlin/src/gcode/host/M115.cpp @@ -34,8 +34,8 @@ #if ENABLED(EXTENDED_CAPABILITIES_REPORT) static void cap_line(PGM_P const name, bool ena=false) { SERIAL_ECHOPGM("Cap:"); - serialprintPGM(name); - SERIAL_CHAR(':', ena ? '1' : '0'); + SERIAL_ECHOPGM_P(name); + SERIAL_CHAR(':', '0' + ena); SERIAL_EOL(); } #endif diff --git a/Marlin/src/gcode/host/M360.cpp b/Marlin/src/gcode/host/M360.cpp index b0bd4a3b8..50a4e4542 100644 --- a/Marlin/src/gcode/host/M360.cpp +++ b/Marlin/src/gcode/host/M360.cpp @@ -34,10 +34,9 @@ static void config_prefix(PGM_P const name, PGM_P const pref=nullptr, const int8_t ind=-1) { SERIAL_ECHOPGM("Config:"); - if (pref) serialprintPGM(pref); + if (pref) SERIAL_ECHOPGM_P(pref); if (ind >= 0) { SERIAL_ECHO(ind); SERIAL_CHAR(':'); } - serialprintPGM(name); - SERIAL_CHAR(':'); + SERIAL_ECHOPAIR_P(name, AS_CHAR(':')); } static void config_line(PGM_P const name, const float val, PGM_P const pref=nullptr, const int8_t ind=-1) { config_prefix(name, pref, ind); diff --git a/Marlin/src/gcode/queue.cpp b/Marlin/src/gcode/queue.cpp index 7ce821148..ebf95f86c 100644 --- a/Marlin/src/gcode/queue.cpp +++ b/Marlin/src/gcode/queue.cpp @@ -304,8 +304,7 @@ inline int read_serial(const uint8_t index) { return SERIAL_IMPL.read(index); } void GCodeQueue::gcode_line_error(PGM_P const err, const serial_index_t serial_ind) { PORT_REDIRECT(SERIAL_PORTMASK(serial_ind)); // Reply to the serial port that sent the command SERIAL_ERROR_START(); - SERIAL_ECHOPGM_P(err); - SERIAL_ECHOLN(serial_state[serial_ind].last_N); + SERIAL_ECHOLNPAIR_P(err, serial_state[serial_ind].last_N); while (read_serial(serial_ind) != -1) { /* nada */ } // Clear out the RX buffer. Why don't use flush here ? flush_and_request_resend(); serial_state[serial_ind].count = 0; 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 37f3c4e32..fd91138a4 100644 --- a/Marlin/src/lcd/extui/lib/anycubic_chiron/chiron_tft.cpp +++ b/Marlin/src/lcd/extui/lib/anycubic_chiron/chiron_tft.cpp @@ -290,7 +290,7 @@ namespace Anycubic { void ChironTFT::SendtoTFT(PGM_P str) { // A helper to print PROGMEN string to the panel #if ACDEBUG(AC_SOME) - serialprintPGM(str); + SERIAL_ECHOPGM_P(str); #endif while (const char c = pgm_read_byte(str++)) TFTSer.write(c); } diff --git a/Marlin/src/libs/L64XX/L64XX_Marlin.cpp b/Marlin/src/libs/L64XX/L64XX_Marlin.cpp index 0358f3f59..d079e0b4b 100644 --- a/Marlin/src/libs/L64XX/L64XX_Marlin.cpp +++ b/Marlin/src/libs/L64XX/L64XX_Marlin.cpp @@ -37,8 +37,6 @@ L64XX_Marlin L64xxManager; #include "../../module/planner.h" #include "../../HAL/shared/Delay.h" -void echo_yes_no(const bool yes) { serialprintPGM(yes ? PSTR(" YES") : PSTR(" NO ")); } - static const char str_X[] PROGMEM = "X ", str_Y[] PROGMEM = "Y ", str_Z[] PROGMEM = "Z ", str_X2[] PROGMEM = "X2", str_Y2[] PROGMEM = "Y2", str_Z2[] PROGMEM = "Z2", str_Z3[] PROGMEM = "Z3", str_Z4[] PROGMEM = "Z4", @@ -56,6 +54,8 @@ PGM_P const L64XX_Marlin::index_to_axis[] PROGMEM = { #define DEBUG_OUT ENABLED(L6470_CHITCHAT) #include "../../core/debug_out.h" +void echo_yes_no(const bool yes) { DEBUG_ECHOPGM_P(yes ? PSTR(" YES") : PSTR(" NO ")); UNUSED(yes); } + uint8_t L64XX_Marlin::dir_commands[MAX_L64XX]; // array to hold direction command for each driver const uint8_t L64XX_Marlin::index_to_dir[MAX_L64XX] = { @@ -375,7 +375,7 @@ inline void echo_min_max(const char a, const float &min, const float &max) { } inline void echo_oct_used(const float &oct, const uint8_t stall) { DEBUG_ECHOPAIR("over_current_threshold used : ", oct); - serialprintPGM(stall ? PSTR(" (Stall") : PSTR(" (OCD")); + DEBUG_ECHOPGM_P(stall ? PSTR(" (Stall") : PSTR(" (OCD")); DEBUG_ECHOLNPGM(" threshold)"); } inline void err_out_of_bounds() { DEBUG_ECHOLNPGM("Test aborted - motion out of bounds"); } @@ -652,7 +652,7 @@ void L64XX_Marlin::say_axis(const L64XX_axis_t axis, const uint8_t label/*=true* ) { say_axis(axis); DEBUG_ECHOPGM(" THERMAL: "); - serialprintPGM((status & _status_axis_th_sd) ? PSTR("SHUTDOWN") : (status & _status_axis_th_wrn) ? PSTR("WARNING ") : PSTR("OK ")); + DEBUG_ECHOPGM_P((status & _status_axis_th_sd) ? PSTR("SHUTDOWN") : (status & _status_axis_th_wrn) ? PSTR("WARNING ") : PSTR("OK ")); DEBUG_ECHOPGM(" OVERCURRENT: "); echo_yes_no((status & _status_axis_ocd) != 0); if (!(_status_axis_layout == L6474_STATUS_LAYOUT)) { // L6474 doesn't have these bits diff --git a/Marlin/src/libs/stopwatch.cpp b/Marlin/src/libs/stopwatch.cpp index 601efe551..adfaa3b04 100644 --- a/Marlin/src/libs/stopwatch.cpp +++ b/Marlin/src/libs/stopwatch.cpp @@ -98,7 +98,7 @@ millis_t Stopwatch::duration() { void Stopwatch::debug(const char func[]) { if (DEBUGGING(INFO)) { SERIAL_ECHOPGM("Stopwatch::"); - serialprintPGM(func); + SERIAL_ECHOPGM_P(func); SERIAL_ECHOLNPGM("()"); } } diff --git a/Marlin/src/libs/vector_3.cpp b/Marlin/src/libs/vector_3.cpp index 6f87a523e..0ef29f33b 100644 --- a/Marlin/src/libs/vector_3.cpp +++ b/Marlin/src/libs/vector_3.cpp @@ -77,7 +77,7 @@ void vector_3::apply_rotation(const matrix_3x3 &matrix) { } void vector_3::debug(PGM_P const title) { - serialprintPGM(title); + SERIAL_ECHOPGM_P(title); 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); @@ -139,10 +139,7 @@ matrix_3x3 matrix_3x3::transpose(const matrix_3x3 &original) { } void matrix_3x3::debug(PGM_P const title) { - if (title) { - serialprintPGM(title); - SERIAL_EOL(); - } + if (title) SERIAL_ECHOLNPGM_P(title); LOOP_L_N(i, 3) { LOOP_L_N(j, 3) { if (vectors[i][j] >= 0.0) SERIAL_CHAR('+'); diff --git a/Marlin/src/module/endstops.cpp b/Marlin/src/module/endstops.cpp index b9d2c1cdf..9550799a2 100644 --- a/Marlin/src/module/endstops.cpp +++ b/Marlin/src/module/endstops.cpp @@ -405,10 +405,9 @@ void Endstops::event_handler() { } static void print_es_state(const bool is_hit, PGM_P const label=nullptr) { - if (label) serialprintPGM(label); + if (label) SERIAL_ECHOPGM_P(label); SERIAL_ECHOPGM(": "); - serialprintPGM(is_hit ? PSTR(STR_ENDSTOP_HIT) : PSTR(STR_ENDSTOP_OPEN)); - SERIAL_EOL(); + SERIAL_ECHOLNPGM_P(is_hit ? PSTR(STR_ENDSTOP_HIT) : PSTR(STR_ENDSTOP_OPEN)); } void _O2 Endstops::report_states() { diff --git a/Marlin/src/module/planner.cpp b/Marlin/src/module/planner.cpp index 7fcf37e04..dd87a0d24 100644 --- a/Marlin/src/module/planner.cpp +++ b/Marlin/src/module/planner.cpp @@ -2973,7 +2973,7 @@ inline void limit_and_warn(float &val, const uint8_t axis, PGM_P const setting_n if (before != val) { SERIAL_CHAR(axis_codes[lim_axis]); SERIAL_ECHOPGM(" Max "); - serialprintPGM(setting_name); + SERIAL_ECHOPGM_P(setting_name); SERIAL_ECHOLNPAIR(" limited to ", val); } } diff --git a/Marlin/src/module/printcounter.cpp b/Marlin/src/module/printcounter.cpp index 45072c8f0..1caaee352 100644 --- a/Marlin/src/module/printcounter.cpp +++ b/Marlin/src/module/printcounter.cpp @@ -118,7 +118,7 @@ void PrintCounter::initStats() { inline bool _service_warn(const char * const msg) { _print_divider(); SERIAL_ECHO_START(); - serialprintPGM(msg); + SERIAL_ECHOPGM_P(msg); SERIAL_ECHOLNPGM("!"); _print_divider(); return true; @@ -177,7 +177,7 @@ void PrintCounter::saveStats() { #if HAS_SERVICE_INTERVALS inline void _service_when(char buffer[], const char * const msg, const uint32_t when) { SERIAL_ECHOPGM(STR_STATS); - serialprintPGM(msg); + SERIAL_ECHOPGM_P(msg); SERIAL_ECHOLNPAIR(" in ", duration_t(when).toString(buffer)); } #endif @@ -339,7 +339,7 @@ void PrintCounter::reset() { void PrintCounter::debug(const char func[]) { if (DEBUGGING(INFO)) { SERIAL_ECHOPGM("PrintCounter::"); - serialprintPGM(func); + SERIAL_ECHOPGM_P(func); SERIAL_ECHOLNPGM("()"); } } diff --git a/Marlin/src/module/probe.cpp b/Marlin/src/module/probe.cpp index d7fafc893..7dcf1dff3 100644 --- a/Marlin/src/module/probe.cpp +++ b/Marlin/src/module/probe.cpp @@ -279,8 +279,7 @@ FORCE_INLINE void probe_specific_action(const bool deploy) { PGM_P const ds_str = deploy ? GET_TEXT(MSG_MANUAL_DEPLOY) : GET_TEXT(MSG_MANUAL_STOW); ui.return_to_status(); // To display the new status message ui.set_status_P(ds_str, 99); - serialprintPGM(ds_str); - SERIAL_EOL(); + SERIAL_ECHOLNPGM_P(ds_str); TERN_(HOST_PROMPT_SUPPORT, host_prompt_do(PROMPT_USER_CONTINUE, PSTR("Stow Probe"), CONTINUE_STR)); TERN_(EXTENSIBLE_UI, ExtUI::onUserConfirmRequired_P(PSTR("Stow Probe"))); @@ -586,7 +585,7 @@ float Probe::run_z_probe(const bool sanity_check/*=true*/) { early_fail = (scheck && current_position.z > -offset.z + clearance); // Probe triggered too high? #if ENABLED(DEBUG_LEVELING_FEATURE) if (DEBUGGING(LEVELING) && (probe_fail || early_fail)) { - DEBUG_PRINT_P(plbl); + DEBUG_ECHOPGM_P(plbl); DEBUG_ECHOPGM(" Probe fail! -"); if (probe_fail) DEBUG_ECHOPGM(" No trigger."); if (early_fail) DEBUG_ECHOPGM(" Triggered early."); diff --git a/Marlin/src/module/settings.cpp b/Marlin/src/module/settings.cpp index f4b4bf0b8..d78d97e68 100644 --- a/Marlin/src/module/settings.cpp +++ b/Marlin/src/module/settings.cpp @@ -2990,7 +2990,7 @@ void MarlinSettings::reset() { if (!repl) { SERIAL_ECHO_START(); SERIAL_ECHOPGM("; "); - serialprintPGM(pstr); + SERIAL_ECHOPGM_P(pstr); if (eol) SERIAL_EOL(); } } @@ -3007,7 +3007,7 @@ void MarlinSettings::reset() { SERIAL_ECHOPGM(" M569 S1"); if (etc) { SERIAL_CHAR(' '); - serialprintPGM(etc); + SERIAL_ECHOPGM_P(etc); } if (newLine) SERIAL_EOL(); } @@ -3025,7 +3025,7 @@ void MarlinSettings::reset() { #endif inline void say_units(const bool colon) { - serialprintPGM( + SERIAL_ECHOPGM_P( #if ENABLED(INCH_MODE_SUPPORT) parser.linear_unit_factor != 1.0 ? PSTR(" (in)") : #endif @@ -3066,7 +3066,7 @@ void MarlinSettings::reset() { SERIAL_ECHOPGM(" M149 "); SERIAL_CHAR(parser.temp_units_code()); SERIAL_ECHOPGM(" ; Units in "); - serialprintPGM(parser.temp_units_name()); + SERIAL_ECHOPGM_P(parser.temp_units_name()); #else SERIAL_ECHOLNPGM(" M149 C ; Units in Celsius"); #endif @@ -3254,12 +3254,12 @@ void MarlinSettings::reset() { LOOP_L_N(py, GRID_MAX_POINTS_Y) { LOOP_L_N(px, GRID_MAX_POINTS_X) { CONFIG_ECHO_START(); - SERIAL_ECHOPAIR_P(PSTR(" G29 S3 I"), px, PSTR(" J"), py); + SERIAL_ECHOPAIR(" G29 S3 I", px, " J", py); SERIAL_ECHOLNPAIR_F_P(SP_Z_STR, LINEAR_UNIT(mbl.z_values[px][py]), 5); } } CONFIG_ECHO_START(); - SERIAL_ECHOLNPAIR_F_P(PSTR(" G29 S4 Z"), LINEAR_UNIT(mbl.z_offset), 5); + SERIAL_ECHOLNPAIR_F(" G29 S4 Z", LINEAR_UNIT(mbl.z_offset), 5); } #elif ENABLED(AUTO_BED_LEVELING_UBL) diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index e85e48c2d..be98972b7 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -664,9 +664,9 @@ volatile bool Temperature::raw_temps_ready = false; #if EITHER(PIDTEMPBED, PIDTEMPCHAMBER) PGM_P const estring = GHV(PSTR("chamber"), PSTR("bed"), NUL_STR); - say_default_(); serialprintPGM(estring); SERIAL_ECHOLNPAIR("Kp ", tune_pid.Kp); - say_default_(); serialprintPGM(estring); SERIAL_ECHOLNPAIR("Ki ", tune_pid.Ki); - say_default_(); serialprintPGM(estring); SERIAL_ECHOLNPAIR("Kd ", tune_pid.Kd); + say_default_(); SERIAL_ECHOPGM_P(estring); SERIAL_ECHOLNPAIR("Kp ", tune_pid.Kp); + say_default_(); SERIAL_ECHOPGM_P(estring); SERIAL_ECHOLNPAIR("Ki ", tune_pid.Ki); + say_default_(); SERIAL_ECHOPGM_P(estring); SERIAL_ECHOLNPAIR("Kd ", tune_pid.Kd); #else say_default_(); SERIAL_ECHOLNPAIR("Kp ", tune_pid.Kp); say_default_(); SERIAL_ECHOLNPAIR("Ki ", tune_pid.Ki); @@ -868,7 +868,7 @@ void Temperature::_temp_error(const heater_id_t heater_id, PGM_P const serial_ms if (IsRunning() && TERN1(BOGUS_TEMPERATURE_GRACE_PERIOD, killed == 2)) { SERIAL_ERROR_START(); - serialprintPGM(serial_msg); + SERIAL_ECHOPGM_P(serial_msg); SERIAL_ECHOPGM(STR_STOPPED_HEATER); if (heater_id >= 0) SERIAL_ECHO(heater_id); @@ -1532,7 +1532,7 @@ void Temperature::manage_heater() { SERIAL_ECHOPAIR_F_P(SP_B_STR, t.beta, 1); SERIAL_ECHOPAIR_F_P(SP_C_STR, t.sh_c_coeff, 9); SERIAL_ECHOPGM(" ; "); - serialprintPGM( + SERIAL_ECHOPGM_P( TERN_(TEMP_SENSOR_0_IS_CUSTOM, t_index == CTI_HOTEND_0 ? PSTR("HOTEND 0") :) TERN_(TEMP_SENSOR_1_IS_CUSTOM, t_index == CTI_HOTEND_1 ? PSTR("HOTEND 1") :) TERN_(TEMP_SENSOR_2_IS_CUSTOM, t_index == CTI_HOTEND_2 ? PSTR("HOTEND 2") :) diff --git a/Marlin/src/pins/pinsDebug.h b/Marlin/src/pins/pinsDebug.h index 5f153cfa2..e2e56081b 100644 --- a/Marlin/src/pins/pinsDebug.h +++ b/Marlin/src/pins/pinsDebug.h @@ -238,7 +238,7 @@ const PinInfo pin_array[] PROGMEM = { #endif static void print_input_or_output(const bool isout) { - serialprintPGM(isout ? PSTR("Output = ") : PSTR("Input = ")); + SERIAL_ECHOPGM_P(isout ? PSTR("Output = ") : PSTR("Input = ")); } // pretty report with PWM info @@ -266,8 +266,8 @@ inline void report_pin_state_extended(pin_t pin, const bool ignore, const bool e LOOP_L_N(x, COUNT(pin_array)) { // scan entire array and report all instances of this pin if (GET_ARRAY_PIN(x) == pin) { if (!found) { // report digital and analog pin number only on the first time through - if (start_string) serialprintPGM(start_string); - serialprintPGM(PSTR("PIN: ")); + if (start_string) SERIAL_ECHOPGM_P(start_string); + SERIAL_ECHOPGM("PIN: "); PRINT_PIN(pin); PRINT_PORT(pin); if (int8_t(DIGITAL_PIN_TO_ANALOG_PIN(pin)) >= 0) { @@ -317,8 +317,8 @@ inline void report_pin_state_extended(pin_t pin, const bool ignore, const bool e } // end of for loop if (!found) { - if (start_string) serialprintPGM(start_string); - serialprintPGM(PSTR("PIN: ")); + if (start_string) SERIAL_ECHOPGM_P(start_string); + SERIAL_ECHOPGM("PIN: "); PRINT_PIN(pin); PRINT_PORT(pin); if (int8_t(DIGITAL_PIN_TO_ANALOG_PIN(pin)) >= 0) { diff --git a/Marlin/src/sd/cardreader.cpp b/Marlin/src/sd/cardreader.cpp index fd26bdd67..c973ba594 100644 --- a/Marlin/src/sd/cardreader.cpp +++ b/Marlin/src/sd/cardreader.cpp @@ -552,7 +552,7 @@ void announceOpen(const uint8_t doing, const char * const path) { PORT_REDIRECT(SERIAL_ALL); SERIAL_ECHO_START(); SERIAL_ECHOPGM("Now "); - serialprintPGM(doing == 1 ? PSTR("doing") : PSTR("fresh")); + SERIAL_ECHOPGM_P(doing == 1 ? PSTR("doing") : PSTR("fresh")); SERIAL_ECHOLNPAIR(" file: ", path); } } @@ -1251,7 +1251,7 @@ void CardReader::fileHasFinished() { removeFile(recovery.filename); #if ENABLED(DEBUG_POWER_LOSS_RECOVERY) SERIAL_ECHOPGM("Power-loss file delete"); - serialprintPGM(jobRecoverFileExists() ? PSTR(" failed.\n") : PSTR("d.\n")); + SERIAL_ECHOPGM_P(jobRecoverFileExists() ? PSTR(" failed.\n") : PSTR("d.\n")); #endif } }