Use PSTR versions of lcd_status... to save SRAM

This commit is contained in:
Scott Lahteine 2017-04-02 00:45:39 -05:00
parent 34e2420b9b
commit 0e6ec34228
4 changed files with 19 additions and 16 deletions

View file

@ -128,7 +128,7 @@
extern bool code_value_bool(); extern bool code_value_bool();
extern bool code_has_value(); extern bool code_has_value();
extern void lcd_init(); extern void lcd_init();
extern void lcd_setstatuspgm(const char* const message, uint8_t level); extern void lcd_setstatuspgm(const char* const message, const uint8_t level);
#define PLANNER_XY_FEEDRATE() (min(planner.max_feedrate_mm_s[X_AXIS], planner.max_feedrate_mm_s[Y_AXIS])) //bob #define PLANNER_XY_FEEDRATE() (min(planner.max_feedrate_mm_s[X_AXIS], planner.max_feedrate_mm_s[Y_AXIS])) //bob
bool prepare_move_to_destination_cartesian(); bool prepare_move_to_destination_cartesian();
void line_to_destination(); void line_to_destination();

View file

@ -29,6 +29,7 @@
#if ENABLED(AUTO_BED_LEVELING_UBL) #if ENABLED(AUTO_BED_LEVELING_UBL)
#define UBL_VERSION "1.00"
#define UBL_OK false #define UBL_OK false
#define UBL_ERR true #define UBL_ERR true

View file

@ -307,7 +307,8 @@
static float x_pos, y_pos, measured_z, card_thickness = 0.0, ubl_constant = 0.0; static float x_pos, y_pos, measured_z, card_thickness = 0.0, ubl_constant = 0.0;
#if ENABLED(ULTRA_LCD) #if ENABLED(ULTRA_LCD)
void lcd_setstatus(const char* message, bool persist); extern void lcd_setstatus(const char* message, const bool persist);
extern void lcd_setstatuspgm(const char* message, const uint8_t level);
#endif #endif
void gcode_G29() { void gcode_G29() {
@ -655,7 +656,7 @@
if (ELAPSED(millis(), nxt)) { if (ELAPSED(millis(), nxt)) {
SERIAL_PROTOCOLLNPGM("\nZ-Offset Adjustment Stopped."); SERIAL_PROTOCOLLNPGM("\nZ-Offset Adjustment Stopped.");
do_blocking_move_to_z(Z_CLEARANCE_DEPLOY_PROBE); do_blocking_move_to_z(Z_CLEARANCE_DEPLOY_PROBE);
lcd_setstatus("Z-Offset Stopped", true); lcd_setstatuspgm("Z-Offset Stopped");
restore_ubl_active_state_and_leave(); restore_ubl_active_state_and_leave();
goto LEAVE; goto LEAVE;
} }
@ -673,7 +674,8 @@
LEAVE: LEAVE:
#if ENABLED(ULTRA_LCD) #if ENABLED(ULTRA_LCD)
lcd_setstatus(" ", true); lcd_reset_alert_level();
lcd_setstatuspgm("");
lcd_quick_feedback(); lcd_quick_feedback();
#endif #endif
@ -977,7 +979,7 @@
bool g29_parameter_parsing() { bool g29_parameter_parsing() {
#if ENABLED(ULTRA_LCD) #if ENABLED(ULTRA_LCD)
lcd_setstatus("Doing G29 UBL !", true); lcd_setstatuspgm("Doing G29 UBL!");
lcd_quick_feedback(); lcd_quick_feedback();
#endif #endif
@ -1088,7 +1090,7 @@
ubl_state_recursion_chk++; ubl_state_recursion_chk++;
if (ubl_state_recursion_chk != 1) { if (ubl_state_recursion_chk != 1) {
SERIAL_ECHOLNPGM("save_ubl_active_state_and_disabled() called multiple times in a row."); SERIAL_ECHOLNPGM("save_ubl_active_state_and_disabled() called multiple times in a row.");
lcd_setstatus("save_UBL_active() error", true); lcd_setstatuspgm("save_UBL_active() error");
lcd_quick_feedback(); lcd_quick_feedback();
return; return;
} }
@ -1099,7 +1101,7 @@
void restore_ubl_active_state_and_leave() { void restore_ubl_active_state_and_leave() {
if (--ubl_state_recursion_chk) { if (--ubl_state_recursion_chk) {
SERIAL_ECHOLNPGM("restore_ubl_active_state_and_leave() called too many times."); SERIAL_ECHOLNPGM("restore_ubl_active_state_and_leave() called too many times.");
lcd_setstatus("restore_UBL_active() error", true); lcd_setstatuspgm("restore_UBL_active() error");
lcd_quick_feedback(); lcd_quick_feedback();
return; return;
} }
@ -1114,7 +1116,7 @@
void g29_what_command() { void g29_what_command() {
const uint16_t k = E2END - ubl.eeprom_start; const uint16_t k = E2END - ubl.eeprom_start;
SERIAL_PROTOCOLPGM("Unified Bed Leveling System Version 1.00 "); SERIAL_PROTOCOLPGM("Unified Bed Leveling System Version " UBL_VERSION " ");
if (ubl.state.active) if (ubl.state.active)
SERIAL_PROTOCOLCHAR('A'); SERIAL_PROTOCOLCHAR('A');
else else
@ -1339,7 +1341,7 @@
memset(not_done, 0xFF, sizeof(not_done)); memset(not_done, 0xFF, sizeof(not_done));
#if ENABLED(ULTRA_LCD) #if ENABLED(ULTRA_LCD)
lcd_setstatus("Fine Tuning Mesh.", true); lcd_setstatuspgm("Fine Tuning Mesh");
#endif #endif
do_blocking_move_to_z(Z_CLEARANCE_DEPLOY_PROBE); do_blocking_move_to_z(Z_CLEARANCE_DEPLOY_PROBE);
@ -1398,7 +1400,7 @@
lcd_return_to_status(); lcd_return_to_status();
//SERIAL_PROTOCOLLNPGM("\nFine Tuning of Mesh Stopped."); //SERIAL_PROTOCOLLNPGM("\nFine Tuning of Mesh Stopped.");
do_blocking_move_to_z(Z_CLEARANCE_DEPLOY_PROBE); do_blocking_move_to_z(Z_CLEARANCE_DEPLOY_PROBE);
lcd_setstatus("Mesh Editing Stopped", true); lcd_setstatuspgm("Mesh Editing Stopped");
while (ubl_lcd_clicked()) idle(); while (ubl_lcd_clicked()) idle();
@ -1426,9 +1428,9 @@
do_blocking_move_to_xy(lx, ly); do_blocking_move_to_xy(lx, ly);
#if ENABLED(ULTRA_LCD) #if ENABLED(ULTRA_LCD)
lcd_setstatus("Done Editing Mesh", true); lcd_setstatuspgm("Done Editing Mesh");
#endif #endif
SERIAL_ECHOLNPGM("Done Editing Mesh."); SERIAL_ECHOLNPGM("Done Editing Mesh");
} }
#endif // AUTO_BED_LEVELING_UBL #endif // AUTO_BED_LEVELING_UBL

View file

@ -677,7 +677,7 @@ void kill_screen(const char* lcd_msg) {
thermalManager.autotempShutdown(); thermalManager.autotempShutdown();
#endif #endif
wait_for_heatup = false; wait_for_heatup = false;
lcd_setstatus(MSG_PRINT_ABORTED, true); lcd_setstatuspgm(PSTR(MSG_PRINT_ABORTED), true);
} }
#endif // SDSUPPORT #endif // SDSUPPORT
@ -3552,13 +3552,13 @@ void lcd_finishstatus(bool persist=false) {
bool lcd_hasstatus() { return (lcd_status_message[0] != '\0'); } bool lcd_hasstatus() { return (lcd_status_message[0] != '\0'); }
void lcd_setstatus(const char* const message, bool persist) { void lcd_setstatus(const char * const message, const bool persist) {
if (lcd_status_message_level > 0) return; if (lcd_status_message_level > 0) return;
strncpy(lcd_status_message, message, 3 * (LCD_WIDTH)); strncpy(lcd_status_message, message, 3 * (LCD_WIDTH));
lcd_finishstatus(persist); lcd_finishstatus(persist);
} }
void lcd_setstatuspgm(const char* const message, uint8_t level) { void lcd_setstatuspgm(const char * const message, const uint8_t level) {
if (level < lcd_status_message_level) return; if (level < lcd_status_message_level) return;
lcd_status_message_level = level; lcd_status_message_level = level;
strncpy_P(lcd_status_message, message, 3 * (LCD_WIDTH)); strncpy_P(lcd_status_message, message, 3 * (LCD_WIDTH));
@ -3575,7 +3575,7 @@ void status_printf(uint8_t level, const char *status, ...) {
lcd_finishstatus(level > 0); lcd_finishstatus(level > 0);
} }
void lcd_setalertstatuspgm(const char* const message) { void lcd_setalertstatuspgm(const char * const message) {
lcd_setstatuspgm(message, 1); lcd_setstatuspgm(message, 1);
#if ENABLED(ULTIPANEL) #if ENABLED(ULTIPANEL)
lcd_return_to_status(); lcd_return_to_status();