Просмотр исходного кода

🐛 Fix status_printf alert level

Scott Lahteine 2 лет назад
Родитель
Сommit
4ff063440d
2 измененных файлов: 22 добавлений и 19 удалений
  1. 21
    18
      Marlin/src/lcd/marlinui.cpp
  2. 1
    1
      Marlin/src/lcd/marlinui.h

+ 21
- 18
Marlin/src/lcd/marlinui.cpp Просмотреть файл

@@ -1487,9 +1487,12 @@ void MarlinUI::init() {
1487 1487
 
1488 1488
   #include <stdarg.h>
1489 1489
 
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;
1491 1493
     if (level < alert_level) return;
1492 1494
     alert_level = level;
1495
+
1493 1496
     va_list args;
1494 1497
     va_start(args, FTOP(fmt));
1495 1498
     vsnprintf_P(status_message, MAX_MESSAGE_LENGTH, FTOP(fmt), args);
@@ -1551,7 +1554,22 @@ void MarlinUI::init() {
1551 1554
 
1552 1555
   #endif
1553 1556
 
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
1555 1573
 
1556 1574
 #if HAS_DISPLAY
1557 1575
 
@@ -1663,22 +1681,7 @@ void MarlinUI::init() {
1663 1681
 
1664 1682
   #endif
1665 1683
 
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
1682 1685
 
1683 1686
 #if ENABLED(SDSUPPORT)
1684 1687
 

+ 1
- 1
Marlin/src/lcd/marlinui.h Просмотреть файл

@@ -365,7 +365,7 @@ public:
365 365
 
366 366
   static void set_status(const char * const cstr, const bool persist=false);
367 367
   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, ...);
369 369
 
370 370
   #if HAS_DISPLAY
371 371
 

Загрузка…
Отмена
Сохранить