Browse Source

🐛 Fix status_printf alert level

FB4S_WIFI
Scott Lahteine 2 years ago
committed by Scott Lahteine
parent
commit
5632ad65f5
  1. 39
      Marlin/src/lcd/marlinui.cpp
  2. 2
      Marlin/src/lcd/marlinui.h

39
Marlin/src/lcd/marlinui.cpp

@ -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)

2
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

Loading…
Cancel
Save