Minor string storage optimization

This commit is contained in:
Scott Lahteine 2020-02-01 17:05:42 -06:00
parent 4937519d51
commit 0e72c315a0
9 changed files with 18 additions and 16 deletions

View file

@ -187,6 +187,8 @@ const char NUL_STR[] PROGMEM = "",
M21_STR[] PROGMEM = "M21",
M23_STR[] PROGMEM = "M23 %s",
M24_STR[] PROGMEM = "M24",
SP_P_STR[] PROGMEM = " P",
SP_T_STR[] PROGMEM = " T",
SP_X_STR[] PROGMEM = " X",
SP_Y_STR[] PROGMEM = " Y",
SP_Z_STR[] PROGMEM = " Z",

View file

@ -121,4 +121,4 @@ void protected_pin_err();
#endif
extern const char NUL_STR[], M112_KILL_STR[], G28_STR[], M21_STR[], M23_STR[], M24_STR[],
SP_X_STR[], SP_Y_STR[], SP_Z_STR[], SP_E_STR[];
SP_P_STR[], SP_T_STR[], SP_X_STR[], SP_Y_STR[], SP_Z_STR[], SP_E_STR[];

View file

@ -96,7 +96,7 @@ void GcodeSuite::M204() {
if (!parser.seen("PRST")) {
SERIAL_ECHOPAIR("Acceleration: P", planner.settings.acceleration);
SERIAL_ECHOPAIR(" R", planner.settings.retract_acceleration);
SERIAL_ECHOLNPAIR(" T", planner.settings.travel_acceleration);
SERIAL_ECHOLNPAIR_P(SP_T_STR, planner.settings.travel_acceleration);
}
else {
//planner.synchronize();

View file

@ -37,7 +37,7 @@ void M217_report(const bool eeprom=false) {
serialprintPGM(eeprom ? PSTR(" M217") : PSTR("Toolchange:"));
SERIAL_ECHOPAIR(" S", LINEAR_UNIT(toolchange_settings.swap_length));
SERIAL_ECHOPAIR_P(SP_E_STR, LINEAR_UNIT(toolchange_settings.extra_prime));
SERIAL_ECHOPAIR(" P", LINEAR_UNIT(toolchange_settings.prime_speed));
SERIAL_ECHOPAIR_P(SP_P_STR, LINEAR_UNIT(toolchange_settings.prime_speed));
SERIAL_ECHOPAIR(" R", LINEAR_UNIT(toolchange_settings.retract_speed));
#if ENABLED(TOOLCHANGE_PARK)

View file

@ -137,7 +137,7 @@
DEBUG_EOL();
HOTEND_LOOP() {
DEBUG_ECHOPAIR(" T", int(e));
DEBUG_ECHOPAIR_P(SP_T_STR, int(e));
LOOP_XYZ(a) DEBUG_ECHOPAIR(" hotend_offset[", int(e), "].", axis_codes[a] | 0x20, "=", hotend_offset[e][a]);
DEBUG_EOL();
}

View file

@ -35,7 +35,7 @@ inline void echo_mix() {
inline void echo_zt(const int t, const float &z) {
mixer.update_mix_from_vtool(t);
SERIAL_ECHOPAIR_P(SP_Z_STR, z, PSTR(" T"), t);
SERIAL_ECHOPAIR_P(SP_Z_STR, z, SP_T_STR, t);
echo_mix();
}

View file

@ -254,8 +254,8 @@ void GCodeQueue::ok_to_send() {
while (NUMERIC_SIGNED(*p))
SERIAL_ECHO(*p++);
}
SERIAL_ECHOPGM(" P"); SERIAL_ECHO(int(BLOCK_BUFFER_SIZE - planner.movesplanned() - 1));
SERIAL_ECHOPGM(" B"); SERIAL_ECHO(BUFSIZE - length);
SERIAL_ECHOPAIR_P(SP_P_STR, int(BLOCK_BUFFER_SIZE - planner.movesplanned() - 1));
SERIAL_ECHOPAIR(" B", BUFSIZE - length);
#endif
SERIAL_EOL();
}

View file

@ -2922,10 +2922,10 @@ void MarlinSettings::reset() {
CONFIG_ECHO_HEADING("Acceleration (units/s2): P<print_accel> R<retract_accel> T<travel_accel>");
CONFIG_ECHO_START();
SERIAL_ECHOLNPAIR(
" M204 P", LINEAR_UNIT(planner.settings.acceleration)
, " R", LINEAR_UNIT(planner.settings.retract_acceleration)
, " T", LINEAR_UNIT(planner.settings.travel_acceleration)
SERIAL_ECHOLNPAIR_P(
PSTR(" M204 P"), LINEAR_UNIT(planner.settings.acceleration)
, PSTR(" R"), LINEAR_UNIT(planner.settings.retract_acceleration)
, SP_T_STR, LINEAR_UNIT(planner.settings.travel_acceleration)
);
if (!forReplay) {
@ -2946,7 +2946,7 @@ void MarlinSettings::reset() {
SERIAL_ECHOLNPAIR_P(
PSTR(" M205 B"), LINEAR_UNIT(planner.settings.min_segment_time_us)
, PSTR(" S"), LINEAR_UNIT(planner.settings.min_feedrate_mm_s)
, PSTR(" T"), LINEAR_UNIT(planner.settings.min_travel_feedrate_mm_s)
, SP_T_STR, LINEAR_UNIT(planner.settings.min_travel_feedrate_mm_s)
#if DISABLED(CLASSIC_JERK)
, PSTR(" J"), LINEAR_UNIT(planner.junction_deviation_mm)
#endif
@ -3089,8 +3089,8 @@ void MarlinSettings::reset() {
CONFIG_ECHO_START();
SERIAL_ECHOLNPAIR_P(
PSTR(" M665 S"), delta_segments_per_second
, PSTR(" P"), scara_home_offset.a
, PSTR(" T"), scara_home_offset.b
, SP_P_STR, scara_home_offset.a
, SP_T_STR, scara_home_offset.b
, SP_Z_STR, LINEAR_UNIT(scara_home_offset.z)
);
@ -3168,7 +3168,7 @@ void MarlinSettings::reset() {
SERIAL_ECHOPAIR_P(
#if HOTENDS > 1 && ENABLED(PID_PARAMS_PER_HOTEND)
PSTR(" M301 E"), e,
PSTR(" P")
SP_P_STR
#else
PSTR(" M301 P")
#endif

View file

@ -1326,7 +1326,7 @@ void Temperature::manage_heater() {
const user_thermistor_t &t = user_thermistor[t_index];
SERIAL_ECHOPAIR_F(" R", t.series_res, 1);
SERIAL_ECHOPAIR_F(" T", t.res_25, 1);
SERIAL_ECHOPAIR_F_P(SP_T_STR, t.res_25, 1);
SERIAL_ECHOPAIR_F(" B", t.beta, 1);
SERIAL_ECHOPAIR_F(" C", t.sh_c_coeff, 9);
SERIAL_ECHOPGM(" ; ");