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_X_STR[] PROGMEM = " X",
SP_Y_STR[] PROGMEM = " Y", SP_Y_STR[] PROGMEM = " Y",
SP_Z_STR[] PROGMEM = " Z", 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; bool Running = true;

View file

@ -123,4 +123,6 @@ void protected_pin_err();
#endif #endif
extern const char NUL_STR[], M112_KILL_STR[], G28_STR[], M21_STR[], M23_STR[], M24_STR[], 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_MSG("Stepper current values in % (Amps):");
SERIAL_ECHO_START(); SERIAL_ECHO_START();
SERIAL_ECHOLNPAIR( SERIAL_ECHOLNPAIR_P(
" X:", dac_perc(X_AXIS), " (", dac_amps(X_AXIS), ")" SP_X_LBL, dac_perc(X_AXIS), PSTR(" ("), dac_amps(X_AXIS), PSTR(")")
" Y:", dac_perc(Y_AXIS), " (", dac_amps(Y_AXIS), ")" SP_Y_LBL, dac_perc(Y_AXIS), PSTR(" ("), dac_amps(Y_AXIS), PSTR(")")
" Z:", dac_perc(Z_AXIS), " (", dac_amps(Z_AXIS), ")" SP_Z_LBL, dac_perc(Z_AXIS), PSTR(" ("), dac_amps(Z_AXIS), PSTR(")")
" E:", dac_perc(E_AXIS), " (", dac_amps(E_AXIS), ")" 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 _LCD_W_POS 12
#define _PLOT_X 1 #define _PLOT_X 1
#define _MAP_X 3 #define _MAP_X 3
#define _LABEL(C,X,Y) lcd_put_u8str(X, Y, C) #define _LABEL(C,X,Y) lcd_put_u8str_P(X, Y, C)
#define _XLABEL(X,Y) _LABEL("X:",X,Y) #define _XLABEL(X,Y) _LABEL(X_LBL,X,Y)
#define _YLABEL(X,Y) _LABEL("Y:",X,Y) #define _YLABEL(X,Y) _LABEL(Y_LBL,X,Y)
#define _ZLABEL(X,Y) _LABEL("Z:",X,Y) #define _ZLABEL(X,Y) _LABEL(Z_LBL,X,Y)
#else #else
#define _LCD_W_POS 8 #define _LCD_W_POS 8
#define _PLOT_X 0 #define _PLOT_X 0

View file

@ -652,11 +652,11 @@ void MarlinUI::draw_status_screen() {
} }
} }
else if (progress_state == 2 && estimation_string[0]) { 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); lcd_put_u8str(estimation_x_pos, EXTRAS_BASELINE, estimation_string);
} }
else if (elapsed_string[0]) { 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); 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)) { if (PAGE_UNDER(7)) {
const xy_pos_t pos = { ubl.mesh_index_to_xpos(x_plot), ubl.mesh_index_to_ypos(y_plot) }, const xy_pos_t pos = { ubl.mesh_index_to_xpos(x_plot), ubl.mesh_index_to_ypos(y_plot) },
lpos = pos.asLogical(); 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(ftostr52(lpos.x));
lcd_put_u8str(74, 7, "Y:"); lcd_put_u8str_P(74, 7, Y_LBL);
lcd_put_u8str(ftostr52(lpos.y)); lcd_put_u8str(ftostr52(lpos.y));
} }
@ -563,7 +563,7 @@ void MarlinUI::clear_lcd() { } // Automatically cleared by Picture Loop
lcd_put_wchar(')'); lcd_put_wchar(')');
// Show the location value // 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])) if (!isnan(ubl.z_values[x_plot][y_plot]))
lcd_put_u8str(ftostr43sign(ubl.z_values[x_plot][y_plot])); lcd_put_u8str(ftostr43sign(ubl.z_values[x_plot][y_plot]));
else 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("->", target.a);
SERIAL_ECHOPAIR(") B:", b); SERIAL_ECHOPAIR(") B:", b);
#else #else
SERIAL_ECHOPAIR(" X:", a); SERIAL_ECHOPAIR_P(SP_X_LBL, a);
SERIAL_ECHOPAIR(" (", position.x); SERIAL_ECHOPAIR(" (", position.x);
SERIAL_ECHOPAIR("->", target.x); SERIAL_ECHOPAIR("->", target.x);
SERIAL_ECHOPAIR(") Y:", b); SERIAL_CHAR(')');
SERIAL_ECHOPAIR_P(SP_Y_LBL, b);
#endif #endif
SERIAL_ECHOPAIR(" (", position.y); SERIAL_ECHOPAIR(" (", position.y);
SERIAL_ECHOPAIR("->", target.y); SERIAL_ECHOPAIR("->", target.y);
#if ENABLED(DELTA) #if ENABLED(DELTA)
SERIAL_ECHOPAIR(") C:", c); SERIAL_ECHOPAIR(") C:", c);
#else #else
SERIAL_ECHOPAIR(") Z:", c); SERIAL_CHAR(')');
SERIAL_ECHOPAIR_P(SP_Z_LBL, c);
#endif #endif
SERIAL_ECHOPAIR(" (", position.z); SERIAL_ECHOPAIR(" (", position.z);
SERIAL_ECHOPAIR("->", target.z); SERIAL_ECHOPAIR("->", target.z);
SERIAL_ECHOPAIR(") E:", e); SERIAL_CHAR(')');
SERIAL_ECHOPAIR_P(SP_E_LBL, e);
SERIAL_ECHOPAIR(" (", position.e); SERIAL_ECHOPAIR(" (", position.e);
SERIAL_ECHOPAIR("->", target.e); SERIAL_ECHOPAIR("->", target.e);
SERIAL_ECHOLNPGM(")"); SERIAL_ECHOLNPGM(")");

View file

@ -53,11 +53,13 @@ void scara_set_axis_is_at_home(const AxisEnum axis) {
current_position[axis] = cartes[axis]; current_position[axis] = cartes[axis];
#else #else
// MP_SCARA uses a Cartesian XY home position // 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]; current_position[axis] = homeposition[axis];
#endif #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); 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 #if CORE_IS_XY || CORE_IS_XZ || ENABLED(DELTA) || IS_SCARA
SERIAL_ECHOPAIR(STR_COUNT_A, pos.x, " B:", pos.y); SERIAL_ECHOPAIR(STR_COUNT_A, pos.x, " B:", pos.y);
#else #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 #endif
#if CORE_IS_XZ || CORE_IS_YZ || ENABLED(DELTA) #if CORE_IS_XZ || CORE_IS_YZ || ENABLED(DELTA)
SERIAL_ECHOLNPAIR(" C:", pos.z); SERIAL_ECHOLNPAIR(" C:", pos.z);
#else #else
SERIAL_ECHOLNPAIR(" Z:", pos.z); SERIAL_ECHOLNPAIR_P(SP_Z_LBL, pos.z);
#endif #endif
} }