From 665e45e0bad4254352330884a846c21aad2a2ff0 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 26 Sep 2019 03:47:26 -0500 Subject: [PATCH] Reduce string storage, use masking 'seen' --- Marlin/src/HAL/HAL_DUE/EepromEmulation.cpp | 8 +++----- Marlin/src/Marlin.cpp | 9 +++++---- Marlin/src/feature/bedlevel/ubl/ubl.cpp | 5 ++--- Marlin/src/feature/prusa_MMU2/mmu2.cpp | 4 +--- Marlin/src/gcode/bedlevel/M420.cpp | 2 +- Marlin/src/gcode/config/M281.cpp | 9 ++++----- Marlin/src/gcode/config/M301.cpp | 6 +++--- Marlin/src/gcode/config/M302.cpp | 3 +-- Marlin/src/gcode/config/M304.cpp | 6 +++--- Marlin/src/gcode/config/M92.cpp | 16 +++++++--------- Marlin/src/gcode/control/M280.cpp | 6 ++---- Marlin/src/gcode/feature/L6470/M906.cpp | 2 +- Marlin/src/gcode/feature/advance/M900.cpp | 8 ++++---- Marlin/src/gcode/feature/powerloss/M413.cpp | 2 +- Marlin/src/gcode/probe/M951.cpp | 3 +-- .../lib/lulzbot/archim2-flash/flash_storage.cpp | 17 ++++++++--------- .../lib/lulzbot/ftdi_eve_lib/basic/commands.cpp | 10 ++++------ .../lib/lulzbot/ftdi_eve_lib/basic/constants.h | 6 +++--- .../lulzbot/ftdi_eve_lib/extended/dl_cache.cpp | 15 +++++++-------- .../ftdi_eve_lib/extended/screen_types.h | 3 +-- .../ftdi_eve_lib/extended/sound_player.cpp | 3 +-- .../lib/lulzbot/screens/media_player_screen.cpp | 12 ++++-------- .../screens/touch_calibration_screen.cpp | 3 +-- Marlin/src/sd/cardreader.cpp | 6 ++---- 24 files changed, 70 insertions(+), 94 deletions(-) diff --git a/Marlin/src/HAL/HAL_DUE/EepromEmulation.cpp b/Marlin/src/HAL/HAL_DUE/EepromEmulation.cpp index 3d6e22f6d3..c7b7007053 100644 --- a/Marlin/src/HAL/HAL_DUE/EepromEmulation.cpp +++ b/Marlin/src/HAL/HAL_DUE/EepromEmulation.cpp @@ -922,8 +922,7 @@ static void ee_Init() { if (!ee_IsPageClean(grp * PagesPerGroup + page)) { #ifdef EE_EMU_DEBUG SERIAL_ECHO_START(); - SERIAL_ECHOPAIR("EEPROM Page ",page); - SERIAL_ECHOLNPAIR(" not clean on group ",grp); + SERIAL_ECHOLNPAIR("EEPROM Page ", page, " not clean on group ", grp); SERIAL_FLUSH(); #endif ee_PageErase(grp * PagesPerGroup + page); @@ -944,7 +943,7 @@ static void ee_Init() { #ifdef EE_EMU_DEBUG SERIAL_ECHO_START(); - SERIAL_ECHOLNPAIR("EEPROM Active page: ",curPage); + SERIAL_ECHOLNPAIR("EEPROM Active page: ", curPage); SERIAL_FLUSH(); #endif @@ -953,8 +952,7 @@ static void ee_Init() { if (!ee_IsPageClean(curGroup * PagesPerGroup + page)) { #ifdef EE_EMU_DEBUG SERIAL_ECHO_START(); - SERIAL_ECHOPAIR("EEPROM Page ",page); - SERIAL_ECHOLNPAIR(" not clean on active group ",curGroup); + SERIAL_ECHOLNPAIR("EEPROM Page ", page, " not clean on active group ", curGroup); SERIAL_FLUSH(); ee_Dump(curGroup * PagesPerGroup + page, getFlashStorage(curGroup * PagesPerGroup + page)); #endif diff --git a/Marlin/src/Marlin.cpp b/Marlin/src/Marlin.cpp index 8be6a345b0..0dca9879d5 100644 --- a/Marlin/src/Marlin.cpp +++ b/Marlin/src/Marlin.cpp @@ -962,10 +962,11 @@ void setup() { SERIAL_EOL(); #if defined(STRING_DISTRIBUTION_DATE) && defined(STRING_CONFIG_H_AUTHOR) - SERIAL_ECHO_START(); - SERIAL_ECHOPGM(MSG_CONFIGURATION_VER); - SERIAL_ECHOPGM(STRING_DISTRIBUTION_DATE); - SERIAL_ECHOLNPGM(MSG_AUTHOR STRING_CONFIG_H_AUTHOR); + SERIAL_ECHO_MSG( + MSG_CONFIGURATION_VER + STRING_DISTRIBUTION_DATE + MSG_AUTHOR STRING_CONFIG_H_AUTHOR + ); SERIAL_ECHO_MSG("Compiled: " __DATE__); #endif diff --git a/Marlin/src/feature/bedlevel/ubl/ubl.cpp b/Marlin/src/feature/bedlevel/ubl/ubl.cpp index f41c80f88a..4cdc4721b5 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl.cpp +++ b/Marlin/src/feature/bedlevel/ubl/ubl.cpp @@ -50,9 +50,8 @@ for (uint8_t y = 0; y < GRID_MAX_POINTS_Y; y++) if (!isnan(z_values[x][y])) { SERIAL_ECHO_START(); - SERIAL_ECHOPAIR(" M421 I", x, " J", y); - SERIAL_ECHOPAIR_F(" Z", z_values[x][y], 4); - SERIAL_EOL(); + SERIAL_ECHOPAIR(" M421 I", int(x), " J", int(y)); + SERIAL_ECHOLNPAIR_F(" Z", z_values[x][y], 4); serial_delay(75); // Prevent Printrun from exploding } } diff --git a/Marlin/src/feature/prusa_MMU2/mmu2.cpp b/Marlin/src/feature/prusa_MMU2/mmu2.cpp index 604138896d..8f5537ba9c 100644 --- a/Marlin/src/feature/prusa_MMU2/mmu2.cpp +++ b/Marlin/src/feature/prusa_MMU2/mmu2.cpp @@ -432,9 +432,7 @@ bool MMU2::rx_ok() { */ void MMU2::check_version() { if (buildnr < MMU_REQUIRED_FW_BUILDNR) { - SERIAL_ERROR_START(); - SERIAL_ECHOPGM("MMU2 firmware version invalid. Required version >= "); - SERIAL_ECHOLN(MMU_REQUIRED_FW_BUILDNR); + SERIAL_ERROR_MSG("Invalid MMU2 firmware. Version >= " STRINGIFY(MMU_REQUIRED_FW_BUILDNR) " required."); kill(MSG_MMU2_WRONG_FIRMWARE); } } diff --git a/Marlin/src/gcode/bedlevel/M420.cpp b/Marlin/src/gcode/bedlevel/M420.cpp index 311619acc2..d3d94a99cc 100644 --- a/Marlin/src/gcode/bedlevel/M420.cpp +++ b/Marlin/src/gcode/bedlevel/M420.cpp @@ -127,7 +127,7 @@ void GcodeSuite::M420() { } // L or V display the map info - if (parser.seen('L') || parser.seen('V')) { + if (parser.seen("LV")) { ubl.display_map(parser.byteval('T')); SERIAL_ECHOPGM("Mesh is "); if (!ubl.mesh_is_valid()) SERIAL_ECHOPGM("in"); diff --git a/Marlin/src/gcode/config/M281.cpp b/Marlin/src/gcode/config/M281.cpp index ea9c032cf0..a694cb2df4 100644 --- a/Marlin/src/gcode/config/M281.cpp +++ b/Marlin/src/gcode/config/M281.cpp @@ -41,15 +41,14 @@ void GcodeSuite::M281() { } if (!angle_change) { SERIAL_ECHO_START(); - SERIAL_ECHOPAIR(" Servo ", servo_index); - SERIAL_ECHOPAIR(" L", servo_angles[servo_index][0]); - SERIAL_ECHOLNPAIR(" U", servo_angles[servo_index][1]); + SERIAL_ECHOLNPAIR(" Servo ", servo_index, + " L", servo_angles[servo_index][0], + " U", servo_angles[servo_index][1]); } } else { SERIAL_ERROR_START(); - SERIAL_ECHOPAIR("Servo ", servo_index); - SERIAL_ECHOLNPGM(" out of range"); + SERIAL_ECHOLNPAIR("Servo ", servo_index, " out of range"); } } diff --git a/Marlin/src/gcode/config/M301.cpp b/Marlin/src/gcode/config/M301.cpp index 6c66ab48cb..25a15d7728 100644 --- a/Marlin/src/gcode/config/M301.cpp +++ b/Marlin/src/gcode/config/M301.cpp @@ -61,9 +61,9 @@ void GcodeSuite::M301() { #if ENABLED(PID_PARAMS_PER_HOTEND) SERIAL_ECHOPAIR(" e:", e); // specify extruder in serial output #endif // PID_PARAMS_PER_HOTEND - SERIAL_ECHOPAIR(" p:", PID_PARAM(Kp, e)); - SERIAL_ECHOPAIR(" i:", unscalePID_i(PID_PARAM(Ki, e))); - SERIAL_ECHOPAIR(" d:", unscalePID_d(PID_PARAM(Kd, e))); + SERIAL_ECHOPAIR(" p:", PID_PARAM(Kp, e), + " i:", unscalePID_i(PID_PARAM(Ki, e)), + " d:", unscalePID_d(PID_PARAM(Kd, e))); #if ENABLED(PID_EXTRUSION_SCALING) //Kc does not have scaling applied above, or in resetting defaults SERIAL_ECHOPAIR(" c:", PID_PARAM(Kc, e)); diff --git a/Marlin/src/gcode/config/M302.cpp b/Marlin/src/gcode/config/M302.cpp index e5ca1d3608..891f3c8258 100644 --- a/Marlin/src/gcode/config/M302.cpp +++ b/Marlin/src/gcode/config/M302.cpp @@ -56,8 +56,7 @@ void GcodeSuite::M302() { SERIAL_ECHO_START(); SERIAL_ECHOPGM("Cold extrudes are "); serialprintPGM(thermalManager.allow_cold_extrude ? PSTR("en") : PSTR("dis")); - SERIAL_ECHOPAIR("abled (min temp ", thermalManager.extrude_min_temp); - SERIAL_ECHOLNPGM("C)"); + SERIAL_ECHOLNPAIR("abled (min temp ", thermalManager.extrude_min_temp, "C)"); } } diff --git a/Marlin/src/gcode/config/M304.cpp b/Marlin/src/gcode/config/M304.cpp index f63fa03fce..3048c228d5 100644 --- a/Marlin/src/gcode/config/M304.cpp +++ b/Marlin/src/gcode/config/M304.cpp @@ -33,9 +33,9 @@ void GcodeSuite::M304() { if (parser.seen('D')) thermalManager.temp_bed.pid.Kd = scalePID_d(parser.value_float()); SERIAL_ECHO_START(); - SERIAL_ECHOPAIR(" p:", thermalManager.temp_bed.pid.Kp); - SERIAL_ECHOPAIR(" i:", unscalePID_i(thermalManager.temp_bed.pid.Ki)); - SERIAL_ECHOLNPAIR(" d:", unscalePID_d(thermalManager.temp_bed.pid.Kd)); + SERIAL_ECHOLNPAIR(" 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/M92.cpp b/Marlin/src/gcode/config/M92.cpp index 3965136e6b..f0e27e82d1 100644 --- a/Marlin/src/gcode/config/M92.cpp +++ b/Marlin/src/gcode/config/M92.cpp @@ -25,9 +25,9 @@ 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])); - SERIAL_ECHOPAIR(" Y", LINEAR_UNIT(planner.settings.axis_steps_per_mm[Y_AXIS])); - SERIAL_ECHOPAIR(" Z", LINEAR_UNIT(planner.settings.axis_steps_per_mm[Z_AXIS])); + 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])); #if DISABLED(DISTINCT_E_FACTORS) SERIAL_ECHOPAIR(" E", VOLUMETRIC_UNIT(planner.settings.axis_steps_per_mm[E_AXIS])); #endif @@ -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_ECHOPAIR(" M92 T", (int)i); - SERIAL_ECHOLNPAIR(" E", VOLUMETRIC_UNIT(planner.settings.axis_steps_per_mm[E_AXIS_N(i)])); + SERIAL_ECHOLNPAIR(" M92 T", (int)i, + " E", VOLUMETRIC_UNIT(planner.settings.axis_steps_per_mm[E_AXIS_N(i)])); } #endif @@ -101,12 +101,10 @@ void GcodeSuite::M92() { micro_steps = argH ? argH : Z_MICROSTEPS; const float z_full_step_mm = micro_steps * planner.steps_to_mm[Z_AXIS]; SERIAL_ECHO_START(); - SERIAL_ECHOPAIR("{ micro_steps:", micro_steps); - SERIAL_ECHOPAIR(", z_full_step_mm:", z_full_step_mm); + SERIAL_ECHOPAIR("{ micro_steps:", micro_steps, ", z_full_step_mm:", z_full_step_mm); if (wanted) { const float best = uint16_t(wanted / z_full_step_mm) * z_full_step_mm; - SERIAL_ECHOPGM(", best:["); - SERIAL_ECHO(best); + SERIAL_ECHOPAIR(", best:[", best); if (best != wanted) { SERIAL_CHAR(','); SERIAL_ECHO(best + z_full_step_mm); } SERIAL_CHAR(']'); } diff --git a/Marlin/src/gcode/control/M280.cpp b/Marlin/src/gcode/control/M280.cpp index 3626f0bf67..6b65e9b753 100644 --- a/Marlin/src/gcode/control/M280.cpp +++ b/Marlin/src/gcode/control/M280.cpp @@ -43,14 +43,12 @@ void GcodeSuite::M280() { } else { SERIAL_ECHO_START(); - SERIAL_ECHOPAIR(" Servo ", servo_index); - SERIAL_ECHOLNPAIR(": ", servo[servo_index].read()); + SERIAL_ECHOLNPAIR(" Servo ", servo_index, ": ", servo[servo_index].read()); } } else { SERIAL_ERROR_START(); - SERIAL_ECHOPAIR("Servo ", servo_index); - SERIAL_ECHOLNPGM(" out of range"); + SERIAL_ECHOLNPAIR("Servo ", servo_index, " out of range"); } } diff --git a/Marlin/src/gcode/feature/L6470/M906.cpp b/Marlin/src/gcode/feature/L6470/M906.cpp index 7f48033190..143a6fea8d 100644 --- a/Marlin/src/gcode/feature/L6470/M906.cpp +++ b/Marlin/src/gcode/feature/L6470/M906.cpp @@ -151,7 +151,7 @@ void L6470_report_current(L6470 &motor, const uint8_t axis) { break; } SERIAL_ECHO(dtostrf(val * 100 / 256, 10, 2, numstr)); - SERIAL_ECHO("%% "); + SERIAL_ECHOPGM("%% "); serialprintPGM(suf); SERIAL_EOL(); } diff --git a/Marlin/src/gcode/feature/advance/M900.cpp b/Marlin/src/gcode/feature/advance/M900.cpp index a5c0dc5cd7..f030511422 100644 --- a/Marlin/src/gcode/feature/advance/M900.cpp +++ b/Marlin/src/gcode/feature/advance/M900.cpp @@ -99,13 +99,13 @@ void GcodeSuite::M900() { if (!parser.seen_any()) { #if EXTRUDERS < 2 - SERIAL_ECHOLNPAIR("Advance S", ext_slot, " K", planner.extruder_advance_K[0]); - SERIAL_ECHOLNPAIR("(Slot ", 1 - ext_slot, " K", saved_extruder_advance_K[0], ")"); + SERIAL_ECHOLNPAIR("Advance S", ext_slot, " K", planner.extruder_advance_K[0], + "(Slot ", 1 - ext_slot, " K", saved_extruder_advance_K[0], ")"); #else LOOP_L_N(i, EXTRUDERS) { const int slot = (int)TEST(lin_adv_slot, i); - SERIAL_ECHOLNPAIR("Advance T", int(i), " S", slot, " K", planner.extruder_advance_K[i]); - SERIAL_ECHOLNPAIR("(Slot ", 1 - slot, " K", saved_extruder_advance_K[i], ")"); + SERIAL_ECHOLNPAIR("Advance T", int(i), " S", slot, " K", planner.extruder_advance_K[i], + "(Slot ", 1 - slot, " K", saved_extruder_advance_K[i], ")"); SERIAL_EOL(); } #endif diff --git a/Marlin/src/gcode/feature/powerloss/M413.cpp b/Marlin/src/gcode/feature/powerloss/M413.cpp index 49f4c250af..cd1dd801b9 100644 --- a/Marlin/src/gcode/feature/powerloss/M413.cpp +++ b/Marlin/src/gcode/feature/powerloss/M413.cpp @@ -47,7 +47,7 @@ void GcodeSuite::M413() { } #if ENABLED(DEBUG_POWER_LOSS_RECOVERY) - if (parser.seen('R') || parser.seen('L')) recovery.load(); + if (parser.seen("RL")) recovery.load(); if (parser.seen('W')) recovery.save(true); if (parser.seen('P')) recovery.purge(); if (parser.seen('E')) serialprintPGM(recovery.exists() ? PSTR("PLR Exists\n") : PSTR("No PLR\n")); diff --git a/Marlin/src/gcode/probe/M951.cpp b/Marlin/src/gcode/probe/M951.cpp index 3e27a7397f..d8d2e8f8e0 100644 --- a/Marlin/src/gcode/probe/M951.cpp +++ b/Marlin/src/gcode/probe/M951.cpp @@ -28,11 +28,10 @@ #include "../../module/tool_change.h" #include "../../module/motion.h" - mpe_settings_t mpe_settings; inline void mpe_settings_report() { - SERIAL_ECHO_START(); SERIAL_ECHOLNPGM("Magnetic Parking Extruder"); + SERIAL_ECHO_MSG("Magnetic Parking Extruder"); SERIAL_ECHO_START(); SERIAL_ECHOLNPAIR("L: Left parking :", mpe_settings.parking_xpos[0]); SERIAL_ECHO_START(); SERIAL_ECHOLNPAIR("R: Right parking :", mpe_settings.parking_xpos[1]); SERIAL_ECHO_START(); SERIAL_ECHOLNPAIR("I: Grab Offset :", mpe_settings.grab_distance); diff --git a/Marlin/src/lcd/extensible_ui/lib/lulzbot/archim2-flash/flash_storage.cpp b/Marlin/src/lcd/extensible_ui/lib/lulzbot/archim2-flash/flash_storage.cpp index 2e17c6492c..360f2562a1 100644 --- a/Marlin/src/lcd/extensible_ui/lib/lulzbot/archim2-flash/flash_storage.cpp +++ b/Marlin/src/lcd/extensible_ui/lib/lulzbot/archim2-flash/flash_storage.cpp @@ -178,7 +178,7 @@ bool UIFlashStorage::is_present = false; ((manufacturer_id == 0x1F) && (device_type == 0x86) && (capacity == 0x01)) ; // Adesto AT255F161 if (!is_known) { - SERIAL_ECHO_START(); SERIAL_ECHOLNPGM("Unable to locate supported SPI Flash Memory."); + SERIAL_ECHO_MSG("Unable to locate supported SPI Flash Memory."); SERIAL_ECHO_START(); SERIAL_ECHOLNPAIR(" Manufacturer ID, got: ", manufacturer_id); SERIAL_ECHO_START(); SERIAL_ECHOLNPAIR(" Device Type , got: ", device_type); SERIAL_ECHO_START(); SERIAL_ECHOLNPAIR(" Capacity , got: ", capacity); @@ -252,7 +252,7 @@ bool UIFlashStorage::is_present = false; return -1; } } - SERIAL_ECHO_START(); SERIAL_ECHOLNPGM("No LULZ delimiter found."); + SERIAL_ECHO_MSG("No LULZ delimiter found."); return -1; } @@ -264,7 +264,7 @@ bool UIFlashStorage::is_present = false; int32_t write_offset = read_offset + 4 + block_size; if ((write_offset + 4 + block_size) > data_storage_area_size) { - SERIAL_ECHO_START(); SERIAL_ECHOLNPGM("Not enough free space in Flash."); + SERIAL_ECHO_MSG("Not enough free space in Flash."); return -1; // Not enough free space } return write_offset; @@ -300,7 +300,7 @@ bool UIFlashStorage::is_present = false; void UIFlashStorage::write_config_data(const void *data, size_t size) { if (!is_present) { - SERIAL_ECHO_START(); SERIAL_ECHOLNPGM("SPI Flash chip not present. Not saving UI settings."); + SERIAL_ECHO_MSG("SPI Flash chip not present. Not saving UI settings."); return; } @@ -308,7 +308,7 @@ bool UIFlashStorage::is_present = false; // make sure that the data is different before rewriting. if (verify_config_data(data, size)) { - SERIAL_ECHO_START(); SERIAL_ECHOLNPGM("UI settings already written, skipping write."); + SERIAL_ECHO_MSG("UI settings already written, skipping write."); return; } @@ -427,12 +427,12 @@ bool UIFlashStorage::is_present = false; MediaFileReader reader; if (!reader.open((char*) buff)) { - SERIAL_ECHO_START(); SERIAL_ECHOLNPGM("Unable to find media file"); + SERIAL_ECHO_MSG("Unable to find media file"); return FILE_NOT_FOUND; } if (get_media_file_size(slot) != 0xFFFFFFFFUL) { - SERIAL_ECHO_START(); SERIAL_ECHOLNPGM("Media file already exists"); + SERIAL_ECHO_MSG("Media file already exists"); return WOULD_OVERWRITE; } @@ -518,9 +518,8 @@ bool UIFlashStorage::is_present = false; SERIAL_ECHO_START(); SERIAL_ECHOLNPAIR("Boot media file size:", bytes_remaining); addr = get_media_file_start(slot); return true; - } else { - return false; } + return false; } int16_t UIFlashStorage::BootMediaReader::read(void *data, const size_t size) { diff --git a/Marlin/src/lcd/extensible_ui/lib/lulzbot/ftdi_eve_lib/basic/commands.cpp b/Marlin/src/lcd/extensible_ui/lib/lulzbot/ftdi_eve_lib/basic/commands.cpp index 87486a07d4..9a04c9e835 100644 --- a/Marlin/src/lcd/extensible_ui/lib/lulzbot/ftdi_eve_lib/basic/commands.cpp +++ b/Marlin/src/lcd/extensible_ui/lib/lulzbot/ftdi_eve_lib/basic/commands.cpp @@ -923,8 +923,7 @@ template bool CLCD::CommandFifo::_write_unaligned(T data, uint16_t len #if ENABLED(TOUCH_UI_DEBUG) if (command_write_ptr == 0xFFFFFFFFul) { - SERIAL_ECHO_START(); - SERIAL_ECHOLNPGM("Attempt to write to FIFO before CommandFifo::Cmd_Start()."); + SERIAL_ECHO_MSG("Attempt to write to FIFO before CommandFifo::Cmd_Start()."); } #endif @@ -1016,8 +1015,8 @@ template bool CLCD::CommandFifo::write(T data, uint16_t len) { if (Command_Space < (len + padding)) { #if ENABLED(TOUCH_UI_DEBUG) SERIAL_ECHO_START(); - SERIAL_ECHOPAIR("Waiting for ", len + padding); - SERIAL_ECHOPAIR(" bytes in command queue, now free: ", Command_Space); + SERIAL_ECHOPAIR("Waiting for ", len + padding, + " bytes in command queue, now free: ", Command_Space); #endif do { Command_Space = mem_read_32(REG::CMDB_SPACE) & 0x0FFF; @@ -1071,8 +1070,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_START(); - SERIAL_ECHOLNPGM("FTDI chip initialized "); + SERIAL_ECHO_MSG("FTDI chip initialized "); #endif break; } diff --git a/Marlin/src/lcd/extensible_ui/lib/lulzbot/ftdi_eve_lib/basic/constants.h b/Marlin/src/lcd/extensible_ui/lib/lulzbot/ftdi_eve_lib/basic/constants.h index 54836e1466..5f60881bdd 100644 --- a/Marlin/src/lcd/extensible_ui/lib/lulzbot/ftdi_eve_lib/basic/constants.h +++ b/Marlin/src/lcd/extensible_ui/lib/lulzbot/ftdi_eve_lib/basic/constants.h @@ -148,7 +148,7 @@ namespace FTDI { constexpr uint8_t STENCIL_OP_DECR = 4; constexpr uint8_t STENCIL_OP_INVERT = 5; - typedef enum: uint32_t { + typedef enum : uint32_t { BITMAPS = 1, POINTS = 2, LINES = 3, @@ -281,7 +281,7 @@ namespace FTDI_FT810 { } namespace FTDI { - enum effect_t { + enum effect_t : unsigned char { SILENCE = 0x00, SQUARE_WAVE = 0x01, SINE_WAVE = 0x02, @@ -342,7 +342,7 @@ namespace FTDI { UNMUTE = 0x61 }; - enum note_t { + enum note_t : unsigned char { END_SONG = 0xFF, REST = 0x00, diff --git a/Marlin/src/lcd/extensible_ui/lib/lulzbot/ftdi_eve_lib/extended/dl_cache.cpp b/Marlin/src/lcd/extensible_ui/lib/lulzbot/ftdi_eve_lib/extended/dl_cache.cpp index b4018e979e..bf8ca61f3a 100644 --- a/Marlin/src/lcd/extensible_ui/lib/lulzbot/ftdi_eve_lib/extended/dl_cache.cpp +++ b/Marlin/src/lcd/extensible_ui/lib/lulzbot/ftdi_eve_lib/extended/dl_cache.cpp @@ -78,8 +78,7 @@ bool DLCache::wait_until_idle() { const unsigned long startTime = millis(); do { if ((millis() - startTime) > 250) { - SERIAL_ECHO_START(); - SERIAL_ECHOLNPGM("Timeout on DL_Cache::Wait_Until_Idle()"); + SERIAL_ECHO_MSG("Timeout on DL_Cache::Wait_Until_Idle()"); CLCD::CommandFifo::reset(); return false; } @@ -130,15 +129,15 @@ bool DLCache::store(uint32_t num_bytes /* = 0*/) { // Not enough memory to cache the display list. #if ENABLED(TOUCH_UI_DEBUG) SERIAL_ECHO_START(); - SERIAL_ECHOPAIR("Not enough space in GRAM to cache display list, free space: ", free_space); - SERIAL_ECHOLNPAIR(" Required: ", dl_size); + SERIAL_ECHOLNPAIR("Not enough space in GRAM to cache display list, free space: ", free_space, + " Required: ", dl_size); #endif return false; } else { #if ENABLED(TOUCH_UI_DEBUG) SERIAL_ECHO_START(); - SERIAL_ECHOPAIR("Saving DL to RAMG cache, bytes: ", dl_size); - SERIAL_ECHOLNPAIR(" Free space: ", free_space); + SERIAL_ECHOLNPAIR("Saving DL to RAMG cache, bytes: ", dl_size, + " Free space: ", free_space); #endif cmd.memcpy(dl_addr, MAP::RAM_DL, dl_size); cmd.execute(); @@ -168,8 +167,8 @@ void DLCache::append() { cmd.execute(); wait_until_idle(); SERIAL_ECHO_START(); - SERIAL_ECHOPAIR("Appending to DL from RAMG cache, bytes: ", dl_size); - SERIAL_ECHOLNPAIR(" REG_CMD_DL: ", CLCD::mem_read_32(REG::CMD_DL)); + SERIAL_ECHOLNPAIR("Appending to DL from RAMG cache, bytes: ", dl_size, + " REG_CMD_DL: ", CLCD::mem_read_32(REG::CMD_DL)); #endif } diff --git a/Marlin/src/lcd/extensible_ui/lib/lulzbot/ftdi_eve_lib/extended/screen_types.h b/Marlin/src/lcd/extensible_ui/lib/lulzbot/ftdi_eve_lib/extended/screen_types.h index e42ff41d67..f1ec4fc476 100644 --- a/Marlin/src/lcd/extensible_ui/lib/lulzbot/ftdi_eve_lib/extended/screen_types.h +++ b/Marlin/src/lcd/extensible_ui/lib/lulzbot/ftdi_eve_lib/extended/screen_types.h @@ -176,8 +176,7 @@ class CachedScreen { static bool storeBackground() { DLCache dlcache(DL_SLOT); if (!dlcache.store(DL_SIZE)) { - SERIAL_ECHO_START(); - SERIAL_ECHOLNPGM("CachedScreen::storeBackground() failed: not enough DL cache space"); + SERIAL_ECHO_MSG("CachedScreen::storeBackground() failed: not enough DL cache space"); return false; } return true; diff --git a/Marlin/src/lcd/extensible_ui/lib/lulzbot/ftdi_eve_lib/extended/sound_player.cpp b/Marlin/src/lcd/extensible_ui/lib/lulzbot/ftdi_eve_lib/extended/sound_player.cpp index a58bdda738..0011d69118 100644 --- a/Marlin/src/lcd/extensible_ui/lib/lulzbot/ftdi_eve_lib/extended/sound_player.cpp +++ b/Marlin/src/lcd/extensible_ui/lib/lulzbot/ftdi_eve_lib/extended/sound_player.cpp @@ -38,8 +38,7 @@ namespace FTDI { #if ENABLED(TOUCH_UI_DEBUG) SERIAL_ECHO_START(); - SERIAL_ECHOPAIR("Playing note ", note); - SERIAL_ECHOLNPAIR(", instrument ", effect); + SERIAL_ECHOLNPAIR("Playing note ", int(note), ", instrument ", int(effect)); #endif // Play the note diff --git a/Marlin/src/lcd/extensible_ui/lib/lulzbot/screens/media_player_screen.cpp b/Marlin/src/lcd/extensible_ui/lib/lulzbot/screens/media_player_screen.cpp index 6655e4311a..1043dde9c7 100644 --- a/Marlin/src/lcd/extensible_ui/lib/lulzbot/screens/media_player_screen.cpp +++ b/Marlin/src/lcd/extensible_ui/lib/lulzbot/screens/media_player_screen.cpp @@ -66,8 +66,7 @@ bool MediaPlayerScreen::playCardMedia() { if (!reader.open(fname)) return false; - SERIAL_ECHO_START(); - SERIAL_ECHOLNPGM("Starting to play STARTUP.AVI"); + SERIAL_ECHO_MSG("Starting to play STARTUP.AVI"); playStream(&reader, MediaFileReader::read); reader.close(); #endif @@ -79,8 +78,7 @@ bool MediaPlayerScreen::playBootMedia() { UIFlashStorage::BootMediaReader reader; if (!reader.isAvailable()) return false; - SERIAL_ECHO_START(); - SERIAL_ECHOLNPGM("Starting to play boot video"); + SERIAL_ECHO_MSG("Starting to play boot video"); playStream(&reader, UIFlashStorage::BootMediaReader::read); return true; } @@ -138,8 +136,7 @@ void MediaPlayerScreen::playStream(void *obj, media_streamer_func_t *data_stream t = millis(); timeouts--; if (timeouts == 0) { - SERIAL_ECHO_START(); - SERIAL_ECHOLNPGM("Timeout playing video"); + SERIAL_ECHO_MSG("Timeout playing video"); cmd.reset(); goto exit; } @@ -151,8 +148,7 @@ void MediaPlayerScreen::playStream(void *obj, media_streamer_func_t *data_stream CLCD::mem_write_32(CLCD::REG::MEDIAFIFO_WRITE, writePtr); } while (nBytes == block_size); - SERIAL_ECHO_START(); - SERIAL_ECHOLNPGM("Done playing video"); + SERIAL_ECHO_MSG("Done playing video"); exit: spiInit(SPI_SPEED); // Restore default speed diff --git a/Marlin/src/lcd/extensible_ui/lib/lulzbot/screens/touch_calibration_screen.cpp b/Marlin/src/lcd/extensible_ui/lib/lulzbot/screens/touch_calibration_screen.cpp index 4effca9fed..0779bb6fb2 100644 --- a/Marlin/src/lcd/extensible_ui/lib/lulzbot/screens/touch_calibration_screen.cpp +++ b/Marlin/src/lcd/extensible_ui/lib/lulzbot/screens/touch_calibration_screen.cpp @@ -52,8 +52,7 @@ void TouchCalibrationScreen::onEntry() { while (CLCD::is_touching()) { #if ENABLED(TOUCH_UI_DEBUG) - SERIAL_ECHO_START(); - SERIAL_ECHOLNPGM("Waiting for touch release"); + SERIAL_ECHO_MSG("Waiting for touch release"); #endif } } diff --git a/Marlin/src/sd/cardreader.cpp b/Marlin/src/sd/cardreader.cpp index 41cc167394..98a03af168 100644 --- a/Marlin/src/sd/cardreader.cpp +++ b/Marlin/src/sd/cardreader.cpp @@ -192,8 +192,7 @@ void CardReader::lsDive(const char *prepend, SdFile parent, const char * const m if (!dir.open(&parent, dosFilename, O_READ)) { if (lsAction == LS_SerialPrint) { SERIAL_ECHO_START(); - SERIAL_ECHOPGM(MSG_SD_CANT_OPEN_SUBDIR); - SERIAL_ECHOLN(dosFilename); + SERIAL_ECHOLNPAIR(MSG_SD_CANT_OPEN_SUBDIR, dosFilename); } } lsDive(path, dir); @@ -292,8 +291,7 @@ void CardReader::ls() { if (!dir.open(&diveDir, segment, O_READ)) { SERIAL_EOL(); SERIAL_ECHO_START(); - SERIAL_ECHOPGM(MSG_SD_CANT_OPEN_SUBDIR); - SERIAL_ECHO(segment); + SERIAL_ECHOPAIR(MSG_SD_CANT_OPEN_SUBDIR, segment); break; }