Pārlūkot izejas kodu

🐛 Fix status_printf alert level

Scott Lahteine 3 gadus atpakaļ
vecāks
revīzija
4ff063440d
2 mainītis faili ar 22 papildinājumiem un 19 dzēšanām
  1. 21
    18
      Marlin/src/lcd/marlinui.cpp
  2. 1
    1
      Marlin/src/lcd/marlinui.h

+ 21
- 18
Marlin/src/lcd/marlinui.cpp Parādīt failu

1487
 
1487
 
1488
   #include <stdarg.h>
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
     if (level < alert_level) return;
1493
     if (level < alert_level) return;
1492
     alert_level = level;
1494
     alert_level = level;
1495
+
1493
     va_list args;
1496
     va_list args;
1494
     va_start(args, FTOP(fmt));
1497
     va_start(args, FTOP(fmt));
1495
     vsnprintf_P(status_message, MAX_MESSAGE_LENGTH, FTOP(fmt), args);
1498
     vsnprintf_P(status_message, MAX_MESSAGE_LENGTH, FTOP(fmt), args);
1551
 
1554
 
1552
   #endif
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
 #if HAS_DISPLAY
1574
 #if HAS_DISPLAY
1557
 
1575
 
1663
 
1681
 
1664
   #endif
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
 #if ENABLED(SDSUPPORT)
1686
 #if ENABLED(SDSUPPORT)
1684
 
1687
 

+ 1
- 1
Marlin/src/lcd/marlinui.h Parādīt failu

365
 
365
 
366
   static void set_status(const char * const cstr, const bool persist=false);
366
   static void set_status(const char * const cstr, const bool persist=false);
367
   static void set_status(FSTR_P const fstr, const int8_t level=0);
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
   #if HAS_DISPLAY
370
   #if HAS_DISPLAY
371
 
371
 

Notiek ielāde…
Atcelt
Saglabāt