diff --git a/Marlin/src/lcd/marlinui.cpp b/Marlin/src/lcd/marlinui.cpp index 11b523ff53..9e27dc6006 100644 --- a/Marlin/src/lcd/marlinui.cpp +++ b/Marlin/src/lcd/marlinui.cpp @@ -1487,9 +1487,12 @@ void MarlinUI::init() { #include - 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) diff --git a/Marlin/src/lcd/marlinui.h b/Marlin/src/lcd/marlinui.h index 30c22188e4..7a6b3992b4 100644 --- a/Marlin/src/lcd/marlinui.h +++ b/Marlin/src/lcd/marlinui.h @@ -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