Introduce severity levels for alert messages
Use the internal lcd_status_message_level for multiple severity levels of alert messages. This is needed to distinguish between non-critical alerts (such as FAN ERROR) from critical ones (any heater issue). During a failure scenario, a critical error MUST NOT be overridden by a lower-level one. As such LCD_STATUS_CRITICAL is currently used for all heater-related errors that result in a safety full-stop.
This commit is contained in:
parent
a7dfe4b523
commit
fb025bba05
2 changed files with 22 additions and 11 deletions
|
@ -8813,18 +8813,22 @@ void lcd_updatestatus(const char *message){
|
|||
lcd_draw_update = 1;
|
||||
}
|
||||
|
||||
void lcd_setalertstatuspgm(const char* message)
|
||||
void lcd_setalertstatuspgm(const char* message, uint8_t severity)
|
||||
{
|
||||
lcd_setstatuspgm(message);
|
||||
lcd_status_message_level = 1;
|
||||
lcd_return_to_status();
|
||||
if (severity > lcd_status_message_level) {
|
||||
lcd_setstatuspgm(message);
|
||||
lcd_status_message_level = severity;
|
||||
lcd_return_to_status();
|
||||
}
|
||||
}
|
||||
|
||||
void lcd_setalertstatus(const char* message)
|
||||
void lcd_setalertstatus(const char* message, uint8_t severity)
|
||||
{
|
||||
lcd_setstatus(message);
|
||||
lcd_status_message_level = 1;
|
||||
lcd_return_to_status();
|
||||
if (severity > lcd_status_message_level) {
|
||||
lcd_setstatus(message);
|
||||
lcd_status_message_level = severity;
|
||||
lcd_return_to_status();
|
||||
}
|
||||
}
|
||||
|
||||
void lcd_reset_alert_level()
|
||||
|
|
|
@ -12,13 +12,20 @@ extern void menu_lcd_lcdupdate_func(void);
|
|||
void ultralcd_init();
|
||||
void lcd_setstatus(const char* message);
|
||||
void lcd_setstatuspgm(const char* message);
|
||||
|
||||
//! LCD status severities
|
||||
#define LCD_STATUS_CRITICAL 2 //< Heater failure
|
||||
#define LCD_STATUS_ALERT 1 //< Other hardware issue
|
||||
#define LCD_STATUS_NONE 0 //< No alert message set
|
||||
|
||||
//! return to the main status screen and display the alert message
|
||||
//! Beware - it has sideeffects:
|
||||
//! - always returns the display to the main status screen
|
||||
//! - always makes lcd_reset (which is slow and causes flicker)
|
||||
//! - does not update the message if there is already one (i.e. lcd_status_message_level > 0)
|
||||
void lcd_setalertstatus(const char* message);
|
||||
void lcd_setalertstatuspgm(const char* message);
|
||||
//! - does not update the message if there is one with the same (or higher) severity present
|
||||
void lcd_setalertstatus(const char* message, uint8_t severity = LCD_STATUS_ALERT);
|
||||
void lcd_setalertstatuspgm(const char* message, uint8_t severity = LCD_STATUS_ALERT);
|
||||
|
||||
//! only update the alert message on the main status screen
|
||||
//! has no sideeffects, may be called multiple times
|
||||
void lcd_updatestatus(const char *message);
|
||||
|
|
Loading…
Add table
Reference in a new issue