Use PSTR for common labels

This commit is contained in:
Scott Lahteine 2020-03-01 07:36:25 -06:00
parent f7d663c7db
commit 5e9a10dbae
9 changed files with 39 additions and 24 deletions

View File

@ -192,7 +192,15 @@ const char NUL_STR[] PROGMEM = "",
SP_X_STR[] PROGMEM = " X",
SP_Y_STR[] PROGMEM = " Y",
SP_Z_STR[] PROGMEM = " Z",
SP_E_STR[] PROGMEM = " E";
SP_E_STR[] PROGMEM = " E",
X_LBL[] PROGMEM = "X:",
Y_LBL[] PROGMEM = "Y:",
Z_LBL[] PROGMEM = "Z:",
E_LBL[] PROGMEM = "E:",
SP_X_LBL[] PROGMEM = " X:",
SP_Y_LBL[] PROGMEM = " Y:",
SP_Z_LBL[] PROGMEM = " Z:",
SP_E_LBL[] PROGMEM = " E:";
bool Running = true;

View File

@ -123,4 +123,6 @@ void protected_pin_err();
#endif
extern const char NUL_STR[], M112_KILL_STR[], G28_STR[], M21_STR[], M23_STR[], M24_STR[],
SP_P_STR[], SP_T_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[],
X_LBL[], Y_LBL[], Z_LBL[], E_LBL[], SP_X_LBL[], SP_Y_LBL[], SP_Z_LBL[], SP_E_LBL[];

View File

@ -88,11 +88,11 @@ void dac_print_values() {
SERIAL_ECHO_MSG("Stepper current values in % (Amps):");
SERIAL_ECHO_START();
SERIAL_ECHOLNPAIR(
" X:", dac_perc(X_AXIS), " (", dac_amps(X_AXIS), ")"
" Y:", dac_perc(Y_AXIS), " (", dac_amps(Y_AXIS), ")"
" Z:", dac_perc(Z_AXIS), " (", dac_amps(Z_AXIS), ")"
" E:", dac_perc(E_AXIS), " (", dac_amps(E_AXIS), ")"
SERIAL_ECHOLNPAIR_P(
SP_X_LBL, dac_perc(X_AXIS), PSTR(" ("), dac_amps(X_AXIS), PSTR(")")
SP_Y_LBL, dac_perc(Y_AXIS), PSTR(" ("), dac_amps(Y_AXIS), PSTR(")")
SP_Z_LBL, dac_perc(Z_AXIS), PSTR(" ("), dac_amps(Z_AXIS), PSTR(")")
SP_E_LBL, dac_perc(E_AXIS), PSTR(" ("), dac_amps(E_AXIS), PSTR(")")
);
}

View File

@ -1212,10 +1212,10 @@ void MarlinUI::draw_status_screen() {
#define _LCD_W_POS 12
#define _PLOT_X 1
#define _MAP_X 3
#define _LABEL(C,X,Y) lcd_put_u8str(X, Y, C)
#define _XLABEL(X,Y) _LABEL("X:",X,Y)
#define _YLABEL(X,Y) _LABEL("Y:",X,Y)
#define _ZLABEL(X,Y) _LABEL("Z:",X,Y)
#define _LABEL(C,X,Y) lcd_put_u8str_P(X, Y, C)
#define _XLABEL(X,Y) _LABEL(X_LBL,X,Y)
#define _YLABEL(X,Y) _LABEL(Y_LBL,X,Y)
#define _ZLABEL(X,Y) _LABEL(Z_LBL,X,Y)
#else
#define _LCD_W_POS 8
#define _PLOT_X 0

View File

@ -652,11 +652,11 @@ void MarlinUI::draw_status_screen() {
}
}
else if (progress_state == 2 && estimation_string[0]) {
lcd_put_u8str(PROGRESS_BAR_X, EXTRAS_BASELINE, "R:");
lcd_put_u8str_P(PROGRESS_BAR_X, EXTRAS_BASELINE, PSTR("R:"));
lcd_put_u8str(estimation_x_pos, EXTRAS_BASELINE, estimation_string);
}
else if (elapsed_string[0]) {
lcd_put_u8str(PROGRESS_BAR_X, EXTRAS_BASELINE, "E:");
lcd_put_u8str_P(PROGRESS_BAR_X, EXTRAS_BASELINE, E_LBL);
lcd_put_u8str(elapsed_x_pos, EXTRAS_BASELINE, elapsed_string);
}

View File

@ -548,9 +548,9 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
if (PAGE_UNDER(7)) {
const xy_pos_t pos = { ubl.mesh_index_to_xpos(x_plot), ubl.mesh_index_to_ypos(y_plot) },
lpos = pos.asLogical();
lcd_put_u8str(5, 7, "X:");
lcd_put_u8str_P(5, 7, X_LBL);
lcd_put_u8str(ftostr52(lpos.x));
lcd_put_u8str(74, 7, "Y:");
lcd_put_u8str_P(74, 7, Y_LBL);
lcd_put_u8str(ftostr52(lpos.y));
}
@ -563,7 +563,7 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
lcd_put_wchar(')');
// Show the location value
lcd_put_u8str(74, LCD_PIXEL_HEIGHT, "Z:");
lcd_put_u8str_P(74, LCD_PIXEL_HEIGHT, Z_LBL);
if (!isnan(ubl.z_values[x_plot][y_plot]))
lcd_put_u8str(ftostr43sign(ubl.z_values[x_plot][y_plot]));
else

View File

@ -2628,21 +2628,24 @@ bool Planner::buffer_segment(const float &a, const float &b, const float &c, con
SERIAL_ECHOPAIR("->", target.a);
SERIAL_ECHOPAIR(") B:", b);
#else
SERIAL_ECHOPAIR(" X:", a);
SERIAL_ECHOPAIR_P(SP_X_LBL, a);
SERIAL_ECHOPAIR(" (", position.x);
SERIAL_ECHOPAIR("->", target.x);
SERIAL_ECHOPAIR(") Y:", b);
SERIAL_CHAR(')');
SERIAL_ECHOPAIR_P(SP_Y_LBL, b);
#endif
SERIAL_ECHOPAIR(" (", position.y);
SERIAL_ECHOPAIR("->", target.y);
#if ENABLED(DELTA)
SERIAL_ECHOPAIR(") C:", c);
#else
SERIAL_ECHOPAIR(") Z:", c);
SERIAL_CHAR(')');
SERIAL_ECHOPAIR_P(SP_Z_LBL, c);
#endif
SERIAL_ECHOPAIR(" (", position.z);
SERIAL_ECHOPAIR("->", target.z);
SERIAL_ECHOPAIR(") E:", e);
SERIAL_CHAR(')');
SERIAL_ECHOPAIR_P(SP_E_LBL, e);
SERIAL_ECHOPAIR(" (", position.e);
SERIAL_ECHOPAIR("->", target.e);
SERIAL_ECHOLNPGM(")");

View File

@ -53,11 +53,13 @@ void scara_set_axis_is_at_home(const AxisEnum axis) {
current_position[axis] = cartes[axis];
#else
// MP_SCARA uses a Cartesian XY home position
// SERIAL_ECHOLNPAIR("homeposition X:", homeposition.x, " Y:", homeposition.y);
// SERIAL_ECHOPGM("homeposition");
// SERIAL_ECHOLNPAIR_P(SP_X_LBL, homeposition.x, SP_Y_LBL, homeposition.y);
current_position[axis] = homeposition[axis];
#endif
// SERIAL_ECHOLNPAIR("Cartesian X:", current_position.x, " Y:", current_position.y);
// SERIAL_ECHOPGM("Cartesian");
// SERIAL_ECHOLNPAIR_P(SP_X_LBL, current_position.x, SP_Y_LBL, current_position.y);
update_software_endstops(axis);
}
}

View File

@ -2464,12 +2464,12 @@ void Stepper::report_positions() {
#if CORE_IS_XY || CORE_IS_XZ || ENABLED(DELTA) || IS_SCARA
SERIAL_ECHOPAIR(STR_COUNT_A, pos.x, " B:", pos.y);
#else
SERIAL_ECHOPAIR(STR_COUNT_X, pos.x, " Y:", pos.y);
SERIAL_ECHOPAIR_P(PSTR(STR_COUNT_X), pos.x, SP_Y_LBL, pos.y);
#endif
#if CORE_IS_XZ || CORE_IS_YZ || ENABLED(DELTA)
SERIAL_ECHOLNPAIR(" C:", pos.z);
#else
SERIAL_ECHOLNPAIR(" Z:", pos.z);
SERIAL_ECHOLNPAIR_P(SP_Z_LBL, pos.z);
#endif
}