🐛 Fix status_printf alert level

This commit is contained in:
Scott Lahteine 2022-03-25 17:09:26 -05:00 committed by Scott Lahteine
parent eccbfbcede
commit 5632ad65f5
2 changed files with 22 additions and 19 deletions

View File

@ -1487,9 +1487,12 @@ void MarlinUI::init() {
#include <stdarg.h>
void MarlinUI::status_printf(const uint8_t level, FSTR_P const fmt, ...) {
void MarlinUI::status_printf(int8_t level, FSTR_P const fmt, ...) {
// Alerts block lower priority messages
if (level < 0) level = alert_level = 0;
if (level < alert_level) return;
alert_level = level;
va_list args;
va_start(args, FTOP(fmt));
vsnprintf_P(status_message, MAX_MESSAGE_LENGTH, FTOP(fmt), args);
@ -1551,7 +1554,22 @@ void MarlinUI::init() {
#endif
#endif
#else // !HAS_STATUS_MESSAGE
//
// Send the status line as a host notification
//
void MarlinUI::set_status(const char * const cstr, const bool) {
TERN(HOST_PROMPT_SUPPORT, hostui.notify(cstr), UNUSED(cstr));
}
void MarlinUI::set_status(FSTR_P const fstr, const int8_t) {
TERN(HOST_PROMPT_SUPPORT, hostui.notify(fstr), UNUSED(fstr));
}
void MarlinUI::status_printf(int8_t, FSTR_P const fstr, ...) {
TERN(HOST_PROMPT_SUPPORT, hostui.notify(fstr), UNUSED(fstr));
}
#endif // !HAS_STATUS_MESSAGE
#if HAS_DISPLAY
@ -1663,22 +1681,7 @@ void MarlinUI::init() {
#endif
#elif !HAS_STATUS_MESSAGE // && !HAS_DISPLAY
//
// Send the status line as a host notification
//
void MarlinUI::set_status(const char * const cstr, const bool) {
TERN(HOST_PROMPT_SUPPORT, hostui.notify(cstr), UNUSED(cstr));
}
void MarlinUI::set_status(FSTR_P const fstr, const int8_t) {
TERN(HOST_PROMPT_SUPPORT, hostui.notify(fstr), UNUSED(fstr));
}
void MarlinUI::status_printf(const uint8_t, FSTR_P const fstr, ...) {
TERN(HOST_PROMPT_SUPPORT, hostui.notify(fstr), UNUSED(fstr));
}
#endif // !HAS_DISPLAY && !HAS_STATUS_MESSAGE
#endif // HAS_DISPLAY
#if ENABLED(SDSUPPORT)

View File

@ -365,7 +365,7 @@ public:
static void set_status(const char * const cstr, const bool persist=false);
static void set_status(FSTR_P const fstr, const int8_t level=0);
static void status_printf(const uint8_t level, FSTR_P const fmt, ...);
static void status_printf(int8_t level, FSTR_P const fmt, ...);
#if HAS_DISPLAY