Skip to content

Commit 4ff0634

Browse files
committed
🐛 Fix status_printf alert level
1 parent 6b55eec commit 4ff0634

File tree

2 files changed

+22
-19
lines changed

2 files changed

+22
-19
lines changed

Marlin/src/lcd/marlinui.cpp

+21-18
Original file line numberDiff line numberDiff line change
@@ -1487,9 +1487,12 @@ void MarlinUI::init() {
14871487

14881488
#include <stdarg.h>
14891489

1490-
void MarlinUI::status_printf(const uint8_t level, FSTR_P const fmt, ...) {
1490+
void MarlinUI::status_printf(int8_t level, FSTR_P const fmt, ...) {
1491+
// Alerts block lower priority messages
1492+
if (level < 0) level = alert_level = 0;
14911493
if (level < alert_level) return;
14921494
alert_level = level;
1495+
14931496
va_list args;
14941497
va_start(args, FTOP(fmt));
14951498
vsnprintf_P(status_message, MAX_MESSAGE_LENGTH, FTOP(fmt), args);
@@ -1551,7 +1554,22 @@ void MarlinUI::init() {
15511554

15521555
#endif
15531556

1554-
#endif
1557+
#else // !HAS_STATUS_MESSAGE
1558+
1559+
//
1560+
// Send the status line as a host notification
1561+
//
1562+
void MarlinUI::set_status(const char * const cstr, const bool) {
1563+
TERN(HOST_PROMPT_SUPPORT, hostui.notify(cstr), UNUSED(cstr));
1564+
}
1565+
void MarlinUI::set_status(FSTR_P const fstr, const int8_t) {
1566+
TERN(HOST_PROMPT_SUPPORT, hostui.notify(fstr), UNUSED(fstr));
1567+
}
1568+
void MarlinUI::status_printf(int8_t, FSTR_P const fstr, ...) {
1569+
TERN(HOST_PROMPT_SUPPORT, hostui.notify(fstr), UNUSED(fstr));
1570+
}
1571+
1572+
#endif // !HAS_STATUS_MESSAGE
15551573

15561574
#if HAS_DISPLAY
15571575

@@ -1663,22 +1681,7 @@ void MarlinUI::init() {
16631681

16641682
#endif
16651683

1666-
#elif !HAS_STATUS_MESSAGE // && !HAS_DISPLAY
1667-
1668-
//
1669-
// Send the status line as a host notification
1670-
//
1671-
void MarlinUI::set_status(const char * const cstr, const bool) {
1672-
TERN(HOST_PROMPT_SUPPORT, hostui.notify(cstr), UNUSED(cstr));
1673-
}
1674-
void MarlinUI::set_status(FSTR_P const fstr, const int8_t) {
1675-
TERN(HOST_PROMPT_SUPPORT, hostui.notify(fstr), UNUSED(fstr));
1676-
}
1677-
void MarlinUI::status_printf(const uint8_t, FSTR_P const fstr, ...) {
1678-
TERN(HOST_PROMPT_SUPPORT, hostui.notify(fstr), UNUSED(fstr));
1679-
}
1680-
1681-
#endif // !HAS_DISPLAY && !HAS_STATUS_MESSAGE
1684+
#endif // HAS_DISPLAY
16821685

16831686
#if ENABLED(SDSUPPORT)
16841687

Marlin/src/lcd/marlinui.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ class MarlinUI {
365365

366366
static void set_status(const char * const cstr, const bool persist=false);
367367
static void set_status(FSTR_P const fstr, const int8_t level=0);
368-
static void status_printf(const uint8_t level, FSTR_P const fmt, ...);
368+
static void status_printf(int8_t level, FSTR_P const fmt, ...);
369369

370370
#if HAS_DISPLAY
371371

0 commit comments

Comments
 (0)