From 1dcfe193acaac8a26d789dcd4e949bb9613f3b58 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 23 Jan 2018 19:09:40 -0600 Subject: [PATCH] Optimize some serial strings --- Marlin/src/feature/I2CPositionEncoder.cpp | 2 +- Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp | 8 ++++---- Marlin/src/gcode/calibrate/M852.cpp | 2 +- Marlin/src/gcode/parser.cpp | 4 ++-- Marlin/src/module/configuration_store.cpp | 8 ++++---- Marlin/src/module/printcounter.cpp | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Marlin/src/feature/I2CPositionEncoder.cpp b/Marlin/src/feature/I2CPositionEncoder.cpp index bf4c3676df..512f9d23e8 100644 --- a/Marlin/src/feature/I2CPositionEncoder.cpp +++ b/Marlin/src/feature/I2CPositionEncoder.cpp @@ -116,7 +116,7 @@ void I2CPositionEncoder::update() { SERIAL_ECHOPGM("New position reads as "); SERIAL_ECHO(get_position()); - SERIAL_ECHOPGM("("); + SERIAL_CHAR('('); SERIAL_ECHO(mm_from_count(get_position())); SERIAL_ECHOLNPGM(")"); #endif diff --git a/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp b/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp index 4acde7fe4a..b951962e6e 100644 --- a/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp +++ b/Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp @@ -1732,7 +1732,7 @@ d = t + normal.z * z1; SERIAL_ECHOPGM("D from 1st point: "); SERIAL_ECHO_F(d, 6); - SERIAL_ECHO(" Z error: "); + SERIAL_ECHOPGM(" Z error: "); SERIAL_ECHO_F(normal.z*z1-get_z_correction(UBL_PROBE_PT_1_X, UBL_PROBE_PT_1_Y),6); SERIAL_EOL(); @@ -1741,7 +1741,7 @@ SERIAL_EOL(); SERIAL_ECHOPGM("D from 2nd point: "); SERIAL_ECHO_F(d, 6); - SERIAL_ECHO(" Z error: "); + SERIAL_ECHOPGM(" Z error: "); SERIAL_ECHO_F(normal.z*z2-get_z_correction(UBL_PROBE_PT_2_X, UBL_PROBE_PT_2_Y),6); SERIAL_EOL(); @@ -1749,7 +1749,7 @@ d = t + normal.z * z3; SERIAL_ECHOPGM("D from 3rd point: "); SERIAL_ECHO_F(d, 6); - SERIAL_ECHO(" Z error: "); + SERIAL_ECHOPGM(" Z error: "); SERIAL_ECHO_F(normal.z*z3-get_z_correction(UBL_PROBE_PT_3_X, UBL_PROBE_PT_3_Y),6); SERIAL_EOL(); @@ -1766,7 +1766,7 @@ SERIAL_ECHOPAIR(" Z error: (", Z_SAFE_HOMING_X_POINT ); SERIAL_ECHOPAIR(",", Z_SAFE_HOMING_Y_POINT ); - SERIAL_ECHO(") = "); + SERIAL_ECHOPGM(") = "); SERIAL_ECHO_F( get_z_correction(Z_SAFE_HOMING_X_POINT, Z_SAFE_HOMING_Y_POINT),6); SERIAL_EOL(); */ diff --git a/Marlin/src/gcode/calibrate/M852.cpp b/Marlin/src/gcode/calibrate/M852.cpp index 7e23aab673..4841cecbc0 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(); - SERIAL_ECHO(MSG_SKEW_FACTOR " XY: "); + SERIAL_ECHOPGM(MSG_SKEW_FACTOR " XY: "); SERIAL_ECHO_F(planner.xy_skew_factor, 6); SERIAL_EOL(); #if ENABLED(SKEW_CORRECTION_FOR_Z) diff --git a/Marlin/src/gcode/parser.cpp b/Marlin/src/gcode/parser.cpp index 807ad3ad2d..a3543670f9 100644 --- a/Marlin/src/gcode/parser.cpp +++ b/Marlin/src/gcode/parser.cpp @@ -286,13 +286,13 @@ void GCodeParser::unknown_command_error() { SERIAL_ECHO(codenum); SERIAL_ECHOLNPGM(")"); #if ENABLED(FASTER_GCODE_PARSER) - SERIAL_ECHO(" args: \""); + SERIAL_ECHOPGM(" args: \""); for (char c = 'A'; c <= 'Z'; ++c) if (seen(c)) { SERIAL_CHAR(c); SERIAL_CHAR(' '); } #else SERIAL_ECHOPAIR(" args: \"", command_args); #endif - SERIAL_ECHOPGM("\""); + SERIAL_CHAR('"'); if (string_arg) { SERIAL_ECHOPGM(" string: \""); SERIAL_ECHO(string_arg); diff --git a/Marlin/src/module/configuration_store.cpp b/Marlin/src/module/configuration_store.cpp index 1f8921f206..a27cf80563 100644 --- a/Marlin/src/module/configuration_store.cpp +++ b/Marlin/src/module/configuration_store.cpp @@ -2266,7 +2266,7 @@ void MarlinSettings::reset( } CONFIG_ECHO_START; #if ENABLED(SKEW_CORRECTION_FOR_Z) - SERIAL_ECHO_P(port, " M852 I"); + SERIAL_ECHOPGM_P(port, " M852 I"); SERIAL_ECHO_F_P(port, LINEAR_UNIT(planner.xy_skew_factor), 6); SERIAL_ECHOPGM_P(port, " J"); SERIAL_ECHO_F_P(port, LINEAR_UNIT(planner.xz_skew_factor), 6); @@ -2274,7 +2274,7 @@ void MarlinSettings::reset( SERIAL_ECHO_F_P(port, LINEAR_UNIT(planner.yz_skew_factor), 6); SERIAL_EOL_P(port); #else - SERIAL_ECHO_P(port, " M852 S"); + SERIAL_ECHOPGM_P(port, " M852 S"); SERIAL_ECHO_F_P(port, LINEAR_UNIT(planner.xy_skew_factor), 6); SERIAL_EOL_P(port); #endif @@ -2289,7 +2289,7 @@ void MarlinSettings::reset( SERIAL_ECHOLNPGM_P(port, "Stepper driver current:"); } CONFIG_ECHO_START; - SERIAL_ECHO_P(port, " M906"); + SERIAL_ECHOPGM_P(port, " M906"); #if ENABLED(X_IS_TMC2130) || ENABLED(X_IS_TMC2208) SERIAL_ECHOPAIR_P(port, " X ", stepperX.getCurrent()); #endif @@ -2335,7 +2335,7 @@ void MarlinSettings::reset( SERIAL_ECHOLNPGM_P(port, "Sensorless homing threshold:"); } CONFIG_ECHO_START; - SERIAL_ECHO_P(port, " M914"); + SERIAL_ECHOPGM_P(port, " M914"); #if ENABLED(X_IS_TMC2130) SERIAL_ECHOPAIR_P(port, " X", stepperX.sgt()); #endif diff --git a/Marlin/src/module/printcounter.cpp b/Marlin/src/module/printcounter.cpp index 8b27b3c43d..847ec47c09 100644 --- a/Marlin/src/module/printcounter.cpp +++ b/Marlin/src/module/printcounter.cpp @@ -144,7 +144,7 @@ void PrintCounter::showStats() { SERIAL_ECHOPGM("Filament used: "); SERIAL_ECHO(this->data.filamentUsed / 1000); - SERIAL_ECHOPGM("m"); + SERIAL_CHAR('m'); SERIAL_EOL(); }