From 582458998f4dd91d05a99425aa665ed45816d069 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 4 Feb 2021 23:22:42 -0600 Subject: [PATCH] Use serial shorthand --- Marlin/src/MarlinCore.cpp | 3 +- Marlin/src/feature/binary_stream.h | 9 +-- Marlin/src/feature/cancel_object.cpp | 3 +- Marlin/src/feature/mmu/mmu2.cpp | 9 +-- Marlin/src/gcode/bedlevel/mbl/G29.cpp | 12 ++-- Marlin/src/gcode/config/M281.cpp | 16 ++--- Marlin/src/gcode/config/M304.cpp | 9 +-- Marlin/src/gcode/config/M305.cpp | 6 +- Marlin/src/gcode/control/M280.cpp | 15 ++--- Marlin/src/gcode/host/M113.cpp | 8 +-- Marlin/src/gcode/motion/M290.cpp | 6 +- Marlin/src/gcode/stats/M31.cpp | 3 +- .../anycubic_i3mega/anycubic_i3mega_lcd.cpp | 6 +- .../ftdi_eve_lib/basic/commands.cpp | 17 ++--- .../ftdi_eve_lib/extended/event_loop.cpp | 6 +- .../ftdi_eve_lib/extended/screen_types.cpp | 3 +- .../screens/bio_printing_dialog_box.cpp | 3 +- Marlin/src/module/settings.cpp | 64 ++++++++----------- Marlin/src/module/temperature.cpp | 3 +- Marlin/src/module/tool_change.cpp | 3 +- Marlin/src/sd/cardreader.cpp | 16 ++--- 21 files changed, 88 insertions(+), 132 deletions(-) diff --git a/Marlin/src/MarlinCore.cpp b/Marlin/src/MarlinCore.cpp index 16111936da..f0d4fa05a6 100644 --- a/Marlin/src/MarlinCore.cpp +++ b/Marlin/src/MarlinCore.cpp @@ -419,8 +419,7 @@ inline void manage_inactivity(const bool ignore_stepper_queue=false) { if (parked_or_ignoring) gcode.reset_stepper_timeout(ms); if (gcode.stepper_max_timed_out(ms)) { - SERIAL_ERROR_START(); - SERIAL_ECHOLNPAIR(STR_KILL_INACTIVE_TIME, parser.command_ptr); + SERIAL_ERROR_MSG(STR_KILL_INACTIVE_TIME, parser.command_ptr); kill(); } diff --git a/Marlin/src/feature/binary_stream.h b/Marlin/src/feature/binary_stream.h index 81d6e7184b..a70a0a4a27 100644 --- a/Marlin/src/feature/binary_stream.h +++ b/Marlin/src/feature/binary_stream.h @@ -352,8 +352,7 @@ public: } } else { - SERIAL_ECHO_START(); - SERIAL_ECHOLNPAIR("Packet header(", packet.header.sync, "?) corrupt"); + SERIAL_ECHO_MSG("Packet header(", packet.header.sync, "?) corrupt"); stream_state = StreamState::PACKET_RESEND; } } @@ -387,8 +386,7 @@ public: stream_state = StreamState::PACKET_PROCESS; } else { - SERIAL_ECHO_START(); - SERIAL_ECHOLNPAIR("Packet(", packet.header.sync, ") payload corrupt"); + SERIAL_ECHO_MSG("Packet(", packet.header.sync, ") payload corrupt"); stream_state = StreamState::PACKET_RESEND; } } @@ -406,8 +404,7 @@ public: if (packet_retries < MAX_RETRIES || MAX_RETRIES == 0) { packet_retries++; stream_state = StreamState::PACKET_RESET; - SERIAL_ECHO_START(); - SERIAL_ECHOLNPAIR("Resend request ", int(packet_retries)); + SERIAL_ECHO_MSG("Resend request ", int(packet_retries)); SERIAL_ECHOLNPAIR("rs", sync); } else diff --git a/Marlin/src/feature/cancel_object.cpp b/Marlin/src/feature/cancel_object.cpp index 853e765b66..3ffd10e970 100644 --- a/Marlin/src/feature/cancel_object.cpp +++ b/Marlin/src/feature/cancel_object.cpp @@ -67,8 +67,7 @@ void CancelObject::uncancel_object(const int8_t obj) { void CancelObject::report() { if (active_object >= 0) { - SERIAL_ECHO_START(); - SERIAL_ECHOLNPAIR("Active Object: ", int(active_object)); + SERIAL_ECHO_MSG("Active Object: ", int(active_object)); } if (canceled) { diff --git a/Marlin/src/feature/mmu/mmu2.cpp b/Marlin/src/feature/mmu/mmu2.cpp index e3036947d5..3bff73e956 100644 --- a/Marlin/src/feature/mmu/mmu2.cpp +++ b/Marlin/src/feature/mmu/mmu2.cpp @@ -514,8 +514,7 @@ static void mmu2_not_responding() { extruder = index; // filament change is finished active_extruder = 0; ENABLE_AXIS_E0(); - SERIAL_ECHO_START(); - SERIAL_ECHOLNPAIR(STR_ACTIVE_EXTRUDER, int(extruder)); + SERIAL_ECHO_MSG(STR_ACTIVE_EXTRUDER, int(extruder)); } ui.reset_status(); } @@ -602,8 +601,7 @@ static void mmu2_not_responding() { active_extruder = 0; ENABLE_AXIS_E0(); - SERIAL_ECHO_START(); - SERIAL_ECHOLNPAIR(STR_ACTIVE_EXTRUDER, int(extruder)); + SERIAL_ECHO_MSG(STR_ACTIVE_EXTRUDER, int(extruder)); ui.reset_status(); } @@ -698,8 +696,7 @@ static void mmu2_not_responding() { extruder = index; //filament change is finished active_extruder = 0; ENABLE_AXIS_E0(); - SERIAL_ECHO_START(); - SERIAL_ECHOLNPAIR(STR_ACTIVE_EXTRUDER, int(extruder)); + SERIAL_ECHO_MSG(STR_ACTIVE_EXTRUDER, int(extruder)); ui.reset_status(); } diff --git a/Marlin/src/gcode/bedlevel/mbl/G29.cpp b/Marlin/src/gcode/bedlevel/mbl/G29.cpp index cf27c14d3b..a08e4a0867 100644 --- a/Marlin/src/gcode/bedlevel/mbl/G29.cpp +++ b/Marlin/src/gcode/bedlevel/mbl/G29.cpp @@ -142,8 +142,7 @@ void GcodeSuite::G29() { if (parser.seenval('I')) { ix = parser.value_int(); if (!WITHIN(ix, 0, GRID_MAX_POINTS_X - 1)) { - SERIAL_ECHOPAIR("I out of range (0-", int(GRID_MAX_POINTS_X - 1)); - SERIAL_ECHOLNPGM(")"); + SERIAL_ECHOLNPAIR("I out of range (0-", int(GRID_MAX_POINTS_X - 1), ")"); return; } } @@ -153,8 +152,7 @@ void GcodeSuite::G29() { if (parser.seenval('J')) { iy = parser.value_int(); if (!WITHIN(iy, 0, GRID_MAX_POINTS_Y - 1)) { - SERIAL_ECHOPAIR("J out of range (0-", int(GRID_MAX_POINTS_Y - 1)); - SERIAL_ECHOLNPGM(")"); + SERIAL_ECHOLNPAIR("J out of range (0-", int(GRID_MAX_POINTS_Y - 1), ")"); return; } } @@ -182,10 +180,8 @@ void GcodeSuite::G29() { } // switch(state) - if (state == MeshNext) { - SERIAL_ECHOPAIR("MBL G29 point ", _MIN(mbl_probe_index, GRID_MAX_POINTS)); - SERIAL_ECHOLNPAIR(" of ", int(GRID_MAX_POINTS)); - } + if (state == MeshNext) + SERIAL_ECHOLNPAIR("MBL G29 point ", _MIN(mbl_probe_index, GRID_MAX_POINTS), " of ", int(GRID_MAX_POINTS)); report_current_position(); } diff --git a/Marlin/src/gcode/config/M281.cpp b/Marlin/src/gcode/config/M281.cpp index 018ca1c092..eeb0fcc470 100644 --- a/Marlin/src/gcode/config/M281.cpp +++ b/Marlin/src/gcode/config/M281.cpp @@ -34,7 +34,9 @@ * U - Stowed Angle */ void GcodeSuite::M281() { + if (!parser.seenval('P')) return; + const int servo_index = parser.value_int(); if (WITHIN(servo_index, 0, NUM_SERVOS - 1)) { #if ENABLED(BLTOUCH) @@ -53,16 +55,14 @@ void GcodeSuite::M281() { angle_change = true; } if (!angle_change) { - SERIAL_ECHO_START(); - SERIAL_ECHOLNPAIR(" Servo ", servo_index, - " L", servo_angles[servo_index][0], - " U", servo_angles[servo_index][1]); + SERIAL_ECHO_MSG(" Servo ", servo_index, + " L", servo_angles[servo_index][0], + " U", servo_angles[servo_index][1]); } } - else { - SERIAL_ERROR_START(); - SERIAL_ECHOLNPAIR("Servo ", servo_index, " out of range"); - } + else + SERIAL_ERROR_MSG("Servo ", servo_index, " out of range"); + } #endif // EDITABLE_SERVO_ANGLES diff --git a/Marlin/src/gcode/config/M304.cpp b/Marlin/src/gcode/config/M304.cpp index 10739be3f8..b1af5a5ae2 100644 --- a/Marlin/src/gcode/config/M304.cpp +++ b/Marlin/src/gcode/config/M304.cpp @@ -35,14 +35,15 @@ * D - Set the D value */ void GcodeSuite::M304() { + if (parser.seen('P')) thermalManager.temp_bed.pid.Kp = parser.value_float(); if (parser.seen('I')) thermalManager.temp_bed.pid.Ki = scalePID_i(parser.value_float()); if (parser.seen('D')) thermalManager.temp_bed.pid.Kd = scalePID_d(parser.value_float()); - SERIAL_ECHO_START(); - SERIAL_ECHOLNPAIR(" p:", thermalManager.temp_bed.pid.Kp, - " i:", unscalePID_i(thermalManager.temp_bed.pid.Ki), - " d:", unscalePID_d(thermalManager.temp_bed.pid.Kd)); + SERIAL_ECHO_MSG(" p:", thermalManager.temp_bed.pid.Kp, + " i:", unscalePID_i(thermalManager.temp_bed.pid.Ki), + " d:", unscalePID_d(thermalManager.temp_bed.pid.Kd)); + } #endif // PIDTEMPBED diff --git a/Marlin/src/gcode/config/M305.cpp b/Marlin/src/gcode/config/M305.cpp index 3e7206aee4..9771ac2ced 100644 --- a/Marlin/src/gcode/config/M305.cpp +++ b/Marlin/src/gcode/config/M305.cpp @@ -49,10 +49,8 @@ void GcodeSuite::M305() { const bool do_set = parser.seen("BCRT"); // A valid P index is required - if (t_index >= (USER_THERMISTORS) || (do_set && t_index < 0)) { - SERIAL_ECHO_START(); - SERIAL_ECHOLNPAIR("!Invalid index. (0 <= P <= ", int(USER_THERMISTORS - 1), ")"); - } + if (t_index >= (USER_THERMISTORS) || (do_set && t_index < 0)) + SERIAL_ECHO_MSG("!Invalid index. (0 <= P <= ", int(USER_THERMISTORS - 1), ")"); else if (do_set) { if (parser.seen('R')) // Pullup resistor value if (!thermalManager.set_pull_up_res(t_index, parser.value_float())) diff --git a/Marlin/src/gcode/control/M280.cpp b/Marlin/src/gcode/control/M280.cpp index 6ccbb7becc..187c9a9b19 100644 --- a/Marlin/src/gcode/control/M280.cpp +++ b/Marlin/src/gcode/control/M280.cpp @@ -31,7 +31,9 @@ * M280: Get or set servo position. P [S] */ void GcodeSuite::M280() { + if (!parser.seen('P')) return; + const int servo_index = parser.value_int(); if (WITHIN(servo_index, 0, NUM_SERVOS - 1)) { if (parser.seen('S')) { @@ -41,15 +43,12 @@ void GcodeSuite::M280() { else MOVE_SERVO(servo_index, a); } - else { - SERIAL_ECHO_START(); - SERIAL_ECHOLNPAIR(" Servo ", servo_index, ": ", servo[servo_index].read()); - } - } - else { - SERIAL_ERROR_START(); - SERIAL_ECHOLNPAIR("Servo ", servo_index, " out of range"); + else + SERIAL_ECHO_MSG(" Servo ", servo_index, ": ", servo[servo_index].read()); } + else + SERIAL_ERROR_MSG("Servo ", servo_index, " out of range"); + } #endif // HAS_SERVOS diff --git a/Marlin/src/gcode/host/M113.cpp b/Marlin/src/gcode/host/M113.cpp index ce826d6acd..1183cc27a1 100644 --- a/Marlin/src/gcode/host/M113.cpp +++ b/Marlin/src/gcode/host/M113.cpp @@ -32,14 +32,14 @@ * S Optional. Set the keepalive interval. */ void GcodeSuite::M113() { + if (parser.seenval('S')) { host_keepalive_interval = parser.value_byte(); NOMORE(host_keepalive_interval, 60); } - else { - SERIAL_ECHO_START(); - SERIAL_ECHOLNPAIR("M113 S", (unsigned long)host_keepalive_interval); - } + else + SERIAL_ECHO_MSG("M113 S", (uint16_t)host_keepalive_interval); + } #endif // HOST_KEEPALIVE_FEATURE diff --git a/Marlin/src/gcode/motion/M290.cpp b/Marlin/src/gcode/motion/M290.cpp index df8dad7999..8ff94a78fd 100644 --- a/Marlin/src/gcode/motion/M290.cpp +++ b/Marlin/src/gcode/motion/M290.cpp @@ -42,14 +42,12 @@ FORCE_INLINE void mod_probe_offset(const float &offs) { if (TERN1(BABYSTEP_HOTEND_Z_OFFSET, active_extruder == 0)) { probe.offset.z += offs; - SERIAL_ECHO_START(); - SERIAL_ECHOLNPAIR(STR_PROBE_OFFSET " " STR_Z, probe.offset.z); + SERIAL_ECHO_MSG(STR_PROBE_OFFSET " " STR_Z, probe.offset.z); } else { #if ENABLED(BABYSTEP_HOTEND_Z_OFFSET) hotend_offset[active_extruder].z -= offs; - SERIAL_ECHO_START(); - SERIAL_ECHOLNPAIR(STR_PROBE_OFFSET STR_Z ": ", hotend_offset[active_extruder].z); + SERIAL_ECHO_MSG(STR_PROBE_OFFSET STR_Z ": ", hotend_offset[active_extruder].z); #endif } } diff --git a/Marlin/src/gcode/stats/M31.cpp b/Marlin/src/gcode/stats/M31.cpp index 207f9e144e..355701f6a4 100644 --- a/Marlin/src/gcode/stats/M31.cpp +++ b/Marlin/src/gcode/stats/M31.cpp @@ -35,6 +35,5 @@ void GcodeSuite::M31() { ui.set_status(buffer); - SERIAL_ECHO_START(); - SERIAL_ECHOLNPAIR("Print time: ", buffer); + SERIAL_ECHO_MSG("Print time: ", buffer); } diff --git a/Marlin/src/lcd/extui/lib/anycubic_i3mega/anycubic_i3mega_lcd.cpp b/Marlin/src/lcd/extui/lib/anycubic_i3mega/anycubic_i3mega_lcd.cpp index c44d667b8f..2b47094a4e 100644 --- a/Marlin/src/lcd/extui/lib/anycubic_i3mega/anycubic_i3mega_lcd.cpp +++ b/Marlin/src/lcd/extui/lib/anycubic_i3mega/anycubic_i3mega_lcd.cpp @@ -552,10 +552,8 @@ void AnycubicTFTClass::GetCommandFromTFT() { a_command = ((int)((strtod(&TFTcmdbuffer[TFTbufindw][TFTstrchr_pointer - TFTcmdbuffer[TFTbufindw] + 1], nullptr)))); #if ENABLED(ANYCUBIC_LCD_DEBUG) - if ((a_command > 7) && (a_command != 20)) { // No debugging of status polls, please! - SERIAL_ECHOPGM("TFT Serial Command: "); - SERIAL_ECHOLN(TFTcmdbuffer[TFTbufindw]); - } + if ((a_command > 7) && (a_command != 20)) // No debugging of status polls, please! + SERIAL_ECHOLNPAIR("TFT Serial Command: ", TFTcmdbuffer[TFTbufindw]); #endif switch (a_command) { diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/basic/commands.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/basic/commands.cpp index 1db1175d3c..62c66f16f2 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/basic/commands.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/basic/commands.cpp @@ -1074,7 +1074,7 @@ void CLCD::init() { uint8_t device_id = mem_read_8(REG::ID); // Read Device ID, Should Be 0x7C; if (device_id == 0x7C) { #if ENABLED(TOUCH_UI_DEBUG) - SERIAL_ECHO_MSG("FTDI chip initialized "); + SERIAL_ECHO_MSG("FTDI chip initialized"); #endif break; } @@ -1082,11 +1082,10 @@ void CLCD::init() { delay(1); if (counter == 249) { - #if ENABLED(TOUCH_UI_DEBUG) - SERIAL_ECHO_START(); - SERIAL_ECHOLNPAIR("Timeout waiting for device ID, should be 124, got ", device_id); - #endif - } + #if ENABLED(TOUCH_UI_DEBUG) + SERIAL_ECHO_MSG("Timeout waiting for device ID, should be 124, got ", int(device_id)); + #endif + } } /* make sure that all units are in working conditions, usually the touch-controller needs a little more time */ @@ -1101,10 +1100,8 @@ void CLCD::init() { else delay(1); - if (ENABLED(TOUCH_UI_DEBUG) && counter == 99) { - SERIAL_ECHO_START(); - SERIAL_ECHOLNPAIR("Timeout waiting for reset status. Should be 0x00, got ", reset_status); - } + if (ENABLED(TOUCH_UI_DEBUG) && counter == 99) + SERIAL_ECHO_MSG("Timeout waiting for reset status. Should be 0x00, got ", int(reset_status)); } mem_write_8(REG::PWM_DUTY, 0); // turn off Backlight, Frequency already is set to 250Hz default diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extended/event_loop.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extended/event_loop.cpp index 6c0392c200..78d5f2483e 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extended/event_loop.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extended/event_loop.cpp @@ -124,8 +124,7 @@ namespace FTDI { case UNPRESSED: if (tag != 0) { #if ENABLED(TOUCH_UI_DEBUG) - SERIAL_ECHO_START(); - SERIAL_ECHOLNPAIR("Touch start: ", tag); + SERIAL_ECHO_MSG("Touch start: ", int(tag)); #endif pressed_tag = tag; @@ -186,8 +185,7 @@ namespace FTDI { if (UIData::flags.bits.touch_end_sound) sound.play(unpress_sound); #if ENABLED(TOUCH_UI_DEBUG) - SERIAL_ECHO_START(); - SERIAL_ECHOLNPAIR("Touch end: ", pressed_tag); + SERIAL_ECHO_MSG("Touch end: ", int(pressed_tag)); #endif const uint8_t saved_pressed_tag = pressed_tag; diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extended/screen_types.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extended/screen_types.cpp index 944237bd28..a0b434818a 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extended/screen_types.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/ftdi_eve_lib/extended/screen_types.cpp @@ -43,8 +43,7 @@ void ScreenRef::setScreen(onRedraw_func_t onRedraw_ptr) { if (type != 0xFF) { setType(type); #if ENABLED(TOUCH_UI_DEBUG) - SERIAL_ECHO_START(); - SERIAL_ECHOLNPAIR("New screen: ", type); + SERIAL_ECHO_MSG("New screen: ", int(type)); #endif } } diff --git a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_printing_dialog_box.cpp b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_printing_dialog_box.cpp index 65b996dd51..fb8dc3edf3 100644 --- a/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_printing_dialog_box.cpp +++ b/Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bio_printing_dialog_box.cpp @@ -127,8 +127,7 @@ void BioPrintingDialogBox::setStatusMessage(const char* message) { storeBackground(); #if ENABLED(TOUCH_UI_DEBUG) - SERIAL_ECHO_START(); - SERIAL_ECHOLNPAIR("New status message: ", message); + SERIAL_ECHO_MSG("New status message: ", message); #endif if (AT_SCREEN(BioPrintingDialogBox)) diff --git a/Marlin/src/module/settings.cpp b/Marlin/src/module/settings.cpp index 6908635d6e..089481d076 100644 --- a/Marlin/src/module/settings.cpp +++ b/Marlin/src/module/settings.cpp @@ -2946,7 +2946,7 @@ void MarlinSettings::reset() { } #define CONFIG_ECHO_START() do{ if (!forReplay) SERIAL_ECHO_START(); }while(0) - #define CONFIG_ECHO_MSG(STR) do{ CONFIG_ECHO_START(); SERIAL_ECHOLNPGM(STR); }while(0) + #define CONFIG_ECHO_MSG(V...) do{ CONFIG_ECHO_START(); SERIAL_ECHOLNPAIR(V); }while(0) #define CONFIG_ECHO_HEADING(STR) config_heading(forReplay, PSTR(STR)) #if HAS_TRINAMIC_CONFIG @@ -3039,26 +3039,24 @@ void MarlinSettings::reset() { } #if EXTRUDERS == 1 - CONFIG_ECHO_START(); - SERIAL_ECHOLNPAIR(" M200 S", int(parser.volumetric_enabled) - , " D", LINEAR_UNIT(planner.filament_size[0]) - #if ENABLED(VOLUMETRIC_EXTRUDER_LIMIT) - , " L", LINEAR_UNIT(planner.volumetric_extruder_limit[0]) - #endif - ); + CONFIG_ECHO_MSG(" M200 S", int(parser.volumetric_enabled) + , " D", LINEAR_UNIT(planner.filament_size[0]) + #if ENABLED(VOLUMETRIC_EXTRUDER_LIMIT) + , " L", LINEAR_UNIT(planner.volumetric_extruder_limit[0]) + #endif + ); #else LOOP_L_N(i, EXTRUDERS) { - CONFIG_ECHO_START(); - SERIAL_ECHOLNPAIR(" M200 T", int(i) - , " D", LINEAR_UNIT(planner.filament_size[i]) - #if ENABLED(VOLUMETRIC_EXTRUDER_LIMIT) - , " L", LINEAR_UNIT(planner.volumetric_extruder_limit[i]) - #endif - ); + CONFIG_ECHO_MSG(" M200 T", int(i) + , " D", LINEAR_UNIT(planner.filament_size[i]) + #if ENABLED(VOLUMETRIC_EXTRUDER_LIMIT) + , " L", LINEAR_UNIT(planner.volumetric_extruder_limit[i]) + #endif + ); } - CONFIG_ECHO_START(); - SERIAL_ECHOLNPAIR(" M200 S", int(parser.volumetric_enabled)); + CONFIG_ECHO_MSG(" M200 S", int(parser.volumetric_enabled)); #endif + #endif // EXTRUDERS && !NO_VOLUMETRICS CONFIG_ECHO_HEADING("Steps per unit:"); @@ -3194,7 +3192,7 @@ void MarlinSettings::reset() { CONFIG_ECHO_START(); SERIAL_ECHOLNPAIR_P( - PSTR(" M420 S"), planner.leveling_active ? 1 : 0 + PSTR(" M420 S"), int(planner.leveling_active) #if ENABLED(ENABLE_LEVELING_FADE_HEIGHT) , SP_Z_STR, LINEAR_UNIT(planner.z_fade_height) #endif @@ -3260,8 +3258,7 @@ void MarlinSettings::reset() { #elif ENABLED(BLTOUCH) || (HAS_Z_SERVO_PROBE && defined(Z_SERVO_ANGLES)) case Z_PROBE_SERVO_NR: #endif - CONFIG_ECHO_START(); - SERIAL_ECHOLNPAIR(" M281 P", int(i), " L", servo_angles[i][0], " U", servo_angles[i][1]); + CONFIG_ECHO_MSG(" M281 P", int(i), " L", servo_angles[i][0], " U", servo_angles[i][1]); default: break; } } @@ -3382,8 +3379,7 @@ void MarlinSettings::reset() { #endif // PIDTEMP #if ENABLED(PIDTEMPBED) - CONFIG_ECHO_START(); - SERIAL_ECHOLNPAIR( + CONFIG_ECHO_MSG( " M304 P", thermalManager.temp_bed.pid.Kp , " I", unscalePID_i(thermalManager.temp_bed.pid.Ki) , " D", unscalePID_d(thermalManager.temp_bed.pid.Kd) @@ -3400,16 +3396,14 @@ void MarlinSettings::reset() { #if HAS_LCD_CONTRAST CONFIG_ECHO_HEADING("LCD Contrast:"); - CONFIG_ECHO_START(); - SERIAL_ECHOLNPAIR(" M250 C", ui.contrast); + CONFIG_ECHO_MSG(" M250 C", ui.contrast); #endif TERN_(CONTROLLER_FAN_EDITABLE, M710_report(forReplay)); #if ENABLED(POWER_LOSS_RECOVERY) CONFIG_ECHO_HEADING("Power-Loss Recovery:"); - CONFIG_ECHO_START(); - SERIAL_ECHOLNPAIR(" M413 S", int(recovery.enabled)); + CONFIG_ECHO_MSG(" M413 S", int(recovery.enabled)); #endif #if ENABLED(FWRETRACT) @@ -3424,8 +3418,7 @@ void MarlinSettings::reset() { ); CONFIG_ECHO_HEADING("Recover: S F"); - CONFIG_ECHO_START(); - SERIAL_ECHOLNPAIR( + CONFIG_ECHO_MSG( " M208 S", LINEAR_UNIT(fwretract.settings.retract_recover_extra) , " W", LINEAR_UNIT(fwretract.settings.swap_retract_recover_extra) , " F", LINEAR_UNIT(MMS_TO_MMM(fwretract.settings.retract_recover_feedrate_mm_s)) @@ -3434,8 +3427,7 @@ void MarlinSettings::reset() { #if ENABLED(FWRETRACT_AUTORETRACT) CONFIG_ECHO_HEADING("Auto-Retract: S=0 to disable, 1 to interpret E-only moves as retract/recover"); - CONFIG_ECHO_START(); - SERIAL_ECHOLNPAIR(" M209 S", fwretract.autoretract_enabled ? 1 : 0); + CONFIG_ECHO_MSG(" M209 S", int(fwretract.autoretract_enabled)); #endif // FWRETRACT_AUTORETRACT @@ -3780,13 +3772,10 @@ void MarlinSettings::reset() { #if ENABLED(LIN_ADVANCE) CONFIG_ECHO_HEADING("Linear Advance:"); #if EXTRUDERS < 2 - CONFIG_ECHO_START(); - SERIAL_ECHOLNPAIR(" M900 K", planner.extruder_advance_K[0]); + CONFIG_ECHO_MSG(" M900 K", planner.extruder_advance_K[0]); #else - LOOP_L_N(i, EXTRUDERS) { - CONFIG_ECHO_START(); - SERIAL_ECHOLNPAIR(" M900 T", int(i), " K", planner.extruder_advance_K[i]); - } + LOOP_L_N(i, EXTRUDERS) + CONFIG_ECHO_MSG(" M900 T", int(i), " K", planner.extruder_advance_K[i]); #endif #endif @@ -3851,8 +3840,7 @@ void MarlinSettings::reset() { #if HAS_FILAMENT_SENSOR CONFIG_ECHO_HEADING("Filament runout sensor:"); - CONFIG_ECHO_START(); - SERIAL_ECHOLNPAIR( + CONFIG_ECHO_MSG( " M412 S", int(runout.enabled) #if HAS_FILAMENT_RUNOUT_DISTANCE , " D", LINEAR_UNIT(runout.runout_distance()) diff --git a/Marlin/src/module/temperature.cpp b/Marlin/src/module/temperature.cpp index b5820e17bf..f6d22420f2 100644 --- a/Marlin/src/module/temperature.cpp +++ b/Marlin/src/module/temperature.cpp @@ -1037,8 +1037,7 @@ void Temperature::min_temp_error(const heater_id_t heater_id) { #if ENABLED(PID_BED_DEBUG) { - SERIAL_ECHO_START(); - SERIAL_ECHOLNPAIR( + SERIAL_ECHO_MSG( " PID_BED_DEBUG : Input ", temp_bed.celsius, " Output ", pid_output, #if DISABLED(PID_OPENLOOP) STR_PID_DEBUG_PTERM, work_pid.Kp, diff --git a/Marlin/src/module/tool_change.cpp b/Marlin/src/module/tool_change.cpp index 4278e6be26..191617be30 100644 --- a/Marlin/src/module/tool_change.cpp +++ b/Marlin/src/module/tool_change.cpp @@ -1196,8 +1196,7 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) { gcode.process_subcommands_now_P(PSTR(EVENT_GCODE_AFTER_TOOLCHANGE)); #endif - SERIAL_ECHO_START(); - SERIAL_ECHOLNPAIR(STR_ACTIVE_EXTRUDER, int(active_extruder)); + SERIAL_ECHO_MSG(STR_ACTIVE_EXTRUDER, int(active_extruder)); #endif // HAS_MULTI_EXTRUDER } diff --git a/Marlin/src/sd/cardreader.cpp b/Marlin/src/sd/cardreader.cpp index c88fdc0693..bda7f8aeba 100644 --- a/Marlin/src/sd/cardreader.cpp +++ b/Marlin/src/sd/cardreader.cpp @@ -270,10 +270,9 @@ void CardReader::printListing(SdFile parent, const char * const prepend/*=nullpt // Get a new directory object using the full path // and dive recursively into it. SdFile child; - if (!child.open(&parent, dosFilename, O_READ)) { - SERIAL_ECHO_START(); - SERIAL_ECHOLNPAIR(STR_SD_CANT_OPEN_SUBDIR, dosFilename); - } + if (!child.open(&parent, dosFilename, O_READ)) + SERIAL_ECHO_MSG(STR_SD_CANT_OPEN_SUBDIR, dosFilename); + printListing(child, path); // close() is done automatically by destructor of SdFile } @@ -594,8 +593,7 @@ void CardReader::openFileRead(char * const path, const uint8_t subcall_type/*=0* filespos[file_subcall_ctr] = sdpos; // For sub-procedures say 'SUBROUTINE CALL target: "..." parent: "..." pos12345' - SERIAL_ECHO_START(); - SERIAL_ECHOLNPAIR("SUBROUTINE CALL target:\"", path, "\" parent:\"", proc_filenames[file_subcall_ctr], "\" pos", sdpos); + SERIAL_ECHO_MSG("SUBROUTINE CALL target:\"", path, "\" parent:\"", proc_filenames[file_subcall_ctr], "\" pos", sdpos); file_subcall_ctr++; break; @@ -941,10 +939,8 @@ void CardReader::cd(const char * relpath) { workDirParents[workDirDepth++] = workDir; TERN_(SDCARD_SORT_ALPHA, presort()); } - else { - SERIAL_ECHO_START(); - SERIAL_ECHOLNPAIR(STR_SD_CANT_ENTER_SUBDIR, relpath); - } + else + SERIAL_ECHO_MSG(STR_SD_CANT_ENTER_SUBDIR, relpath); } int8_t CardReader::cdup() {