From 6f89db11f02a61d79728bc586f2c629db93d055d Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Mon, 29 May 2017 11:51:29 -0500 Subject: [PATCH] Allow lcd_setstatusPGM to reset the alert level --- Marlin/G26_Mesh_Validation_Tool.cpp | 30 +++++++++++++---------------- Marlin/ubl_G29.cpp | 2 +- Marlin/ultralcd.cpp | 11 ++++++----- Marlin/ultralcd.h | 6 +++--- 4 files changed, 23 insertions(+), 26 deletions(-) diff --git a/Marlin/G26_Mesh_Validation_Tool.cpp b/Marlin/G26_Mesh_Validation_Tool.cpp index a17adda10f..56f2059bb8 100644 --- a/Marlin/G26_Mesh_Validation_Tool.cpp +++ b/Marlin/G26_Mesh_Validation_Tool.cpp @@ -131,7 +131,7 @@ void set_destination_to_current(); void set_current_to_destination(); void prepare_move_to_destination(); - void lcd_setstatuspgm(const char* const message, const uint8_t level); + void lcd_setstatusPGM(const char* const message, const int8_t level); void sync_plan_position_e(); void chirp_at_user(); @@ -181,18 +181,17 @@ safe_delay(10); // Wait for click to settle #if ENABLED(ULTRA_LCD) - lcd_setstatuspgm(PSTR("Mesh Validation Stopped."), 99); + lcd_setstatusPGM(PSTR("Mesh Validation Stopped."), 99); lcd_quick_feedback(); #endif - lcd_reset_alert_level(); while (!ubl_lcd_clicked()) idle(); // Wait for button release // If the button is suddenly pressed again, // ask the user to resolve the issue - lcd_setstatuspgm(PSTR("Release button"), 99); // will never appear... + lcd_setstatusPGM(PSTR("Release button"), 99); // will never appear... while (ubl_lcd_clicked()) idle(); // unless this loop happens - lcd_setstatuspgm(PSTR("")); + lcd_setstatusPGM(PSTR(""), -1); return true; } @@ -351,8 +350,7 @@ } while (--g26_repeats && location.x_index >= 0 && location.y_index >= 0); LEAVE: - lcd_reset_alert_level(); - lcd_setstatuspgm(PSTR("Leaving G26")); + lcd_setstatusPGM(PSTR("Leaving G26"), -1); retract_filament(destination); destination[Z_AXIS] = Z_CLEARANCE_BETWEEN_PROBES; @@ -726,8 +724,7 @@ } bool unified_bed_leveling::exit_from_g26() { - lcd_reset_alert_level(); - lcd_setstatuspgm(PSTR("Leaving G26")); + lcd_setstatusPGM(PSTR("Leaving G26"), -1); while (ubl_lcd_clicked()) idle(); return UBL_ERR; } @@ -741,7 +738,7 @@ #if HAS_TEMP_BED #if ENABLED(ULTRA_LCD) if (g26_bed_temp > 25) { - lcd_setstatuspgm(PSTR("G26 Heating Bed."), 99); + lcd_setstatusPGM(PSTR("G26 Heating Bed."), 99); lcd_quick_feedback(); #endif has_control_of_lcd_panel = true; @@ -757,7 +754,7 @@ } #if ENABLED(ULTRA_LCD) } - lcd_setstatuspgm(PSTR("G26 Heating Nozzle."), 99); + lcd_setstatusPGM(PSTR("G26 Heating Nozzle."), 99); lcd_quick_feedback(); #endif #endif @@ -774,8 +771,7 @@ } #if ENABLED(ULTRA_LCD) - lcd_reset_alert_level(); - lcd_setstatuspgm(PSTR("")); + lcd_setstatusPGM(PSTR(""), -1); lcd_quick_feedback(); #endif @@ -792,7 +788,7 @@ has_control_of_lcd_panel = true; - lcd_setstatuspgm(PSTR("User-Controlled Prime"), 99); + lcd_setstatusPGM(PSTR("User-Controlled Prime"), 99); chirp_at_user(); set_destination_to_current(); @@ -819,9 +815,9 @@ while (ubl_lcd_clicked()) idle(); // Debounce Encoder Wheel #if ENABLED(ULTRA_LCD) - strcpy_P(lcd_status_message, PSTR("Done Priming")); // We can't do lcd_setstatuspgm() without having it continue; + strcpy_P(lcd_status_message, PSTR("Done Priming")); // We can't do lcd_setstatusPGM() without having it continue; // So... We cheat to get a message up. - lcd_setstatuspgm(PSTR("Done Priming"), 99); + lcd_setstatusPGM(PSTR("Done Priming"), 99); lcd_quick_feedback(); #endif @@ -830,7 +826,7 @@ } else { #if ENABLED(ULTRA_LCD) - lcd_setstatuspgm(PSTR("Fixed Length Prime."), 99); + lcd_setstatusPGM(PSTR("Fixed Length Prime."), 99); lcd_quick_feedback(); #endif set_destination_to_current(); diff --git a/Marlin/ubl_G29.cpp b/Marlin/ubl_G29.cpp index c9abfbd5cf..c4f77dceb4 100644 --- a/Marlin/ubl_G29.cpp +++ b/Marlin/ubl_G29.cpp @@ -58,7 +58,7 @@ typedef void (*screenFunc_t)(); extern void lcd_goto_screen(screenFunc_t screen, const uint32_t encoder = 0); extern void lcd_setstatus(const char* message, const bool persist); - extern void lcd_setstatuspgm(const char* message, const uint8_t level); + extern void lcd_setstatusPGM(const char* message, const int8_t level); int unified_bed_leveling::g29_verbose_level, unified_bed_leveling::g29_phase_value, diff --git a/Marlin/ultralcd.cpp b/Marlin/ultralcd.cpp index 4e21ba0792..340178835f 100755 --- a/Marlin/ultralcd.cpp +++ b/Marlin/ultralcd.cpp @@ -680,7 +680,7 @@ void kill_screen(const char* lcd_msg) { #if ENABLED(PARK_HEAD_ON_PAUSE) enqueue_and_echo_commands_P(PSTR("M125")); #endif - lcd_setstatuspgm(PSTR(MSG_PRINT_PAUSED), true); + lcd_setstatusPGM(PSTR(MSG_PRINT_PAUSED), -1); } void lcd_sdcard_resume() { @@ -690,7 +690,7 @@ void kill_screen(const char* lcd_msg) { card.startFileprint(); print_job_timer.start(); #endif - lcd_setstatuspgm(PSTR(""), true); + lcd_setstatusPGM(PSTR(""), -1); } void lcd_sdcard_stop() { @@ -703,7 +703,7 @@ void kill_screen(const char* lcd_msg) { for (uint8_t i = 0; i < FAN_COUNT; i++) fanSpeeds[i] = 0; #endif wait_for_heatup = false; - LCD_MESSAGEPGM(MSG_PRINT_ABORTED); + lcd_setstatusPGM(PSTR(MSG_PRINT_PAUSED), -1); } #endif // SDSUPPORT @@ -4095,7 +4095,8 @@ void lcd_setstatus(const char * const message, const bool persist) { lcd_finishstatus(persist); } -void lcd_setstatuspgm(const char * const message, const uint8_t level) { +void lcd_setstatusPGM(const char * const message, int8_t level) { + if (level < 0) level = lcd_status_message_level = 0; if (level < lcd_status_message_level) return; lcd_status_message_level = level; strncpy_P(lcd_status_message, message, 3 * (LCD_WIDTH)); @@ -4113,7 +4114,7 @@ void lcd_status_printf_P(const uint8_t level, const char * const fmt, ...) { } void lcd_setalertstatuspgm(const char * const message) { - lcd_setstatuspgm(message, 1); + lcd_setstatusPGM(message, 1); #if ENABLED(ULTIPANEL) lcd_return_to_status(); #endif diff --git a/Marlin/ultralcd.h b/Marlin/ultralcd.h index c6a11ee0bf..36f3b7d656 100644 --- a/Marlin/ultralcd.h +++ b/Marlin/ultralcd.h @@ -38,7 +38,7 @@ void lcd_init(); bool lcd_hasstatus(); void lcd_setstatus(const char* message, const bool persist=false); - void lcd_setstatuspgm(const char* message, const uint8_t level=0); + void lcd_setstatusPGM(const char* message, const int8_t level=0); void lcd_status_printf_P(const uint8_t level, const char * const fmt, ...); void lcd_setalertstatuspgm(const char* message); void lcd_reset_alert_level(); @@ -61,7 +61,7 @@ void bootscreen(); #endif - #define LCD_MESSAGEPGM(x) lcd_setstatuspgm(PSTR(x)) + #define LCD_MESSAGEPGM(x) lcd_setstatusPGM(PSTR(x)) #define LCD_ALERTMESSAGEPGM(x) lcd_setalertstatuspgm(PSTR(x)) #define LCD_UPDATE_INTERVAL 100 @@ -153,7 +153,7 @@ inline void lcd_init() {} inline bool lcd_hasstatus() { return false; } inline void lcd_setstatus(const char* const message, const bool persist=false) { UNUSED(message); UNUSED(persist); } - inline void lcd_setstatuspgm(const char* const message, const uint8_t level=0) { UNUSED(message); UNUSED(level); } + inline void lcd_setstatusPGM(const char* const message, const int8_t level=0) { UNUSED(message); UNUSED(level); } inline void lcd_status_printf_P(const uint8_t level, const char * const fmt, ...) { UNUSED(level); UNUSED(fmt); } inline void lcd_buttons_update() {} inline void lcd_reset_alert_level() {}