소스 검색

✨ STATUS_MESSAGE_TIMEOUT_SEC (#23135)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
Robby Candra 3 년 전
부모
커밋
b7ffcd6941
No account linked to committer's email address
5개의 변경된 파일31개의 추가작업 그리고 2개의 파일을 삭제
  1. 3
    0
      Marlin/Configuration_adv.h
  2. 4
    0
      Marlin/src/inc/Conditionals_adv.h
  3. 4
    0
      Marlin/src/inc/Warnings.cpp
  4. 16
    2
      Marlin/src/lcd/marlinui.cpp
  5. 4
    0
      Marlin/src/lcd/marlinui.h

+ 3
- 0
Marlin/Configuration_adv.h 파일 보기

1352
   // Scroll a longer status message into view
1352
   // Scroll a longer status message into view
1353
   //#define STATUS_MESSAGE_SCROLLING
1353
   //#define STATUS_MESSAGE_SCROLLING
1354
 
1354
 
1355
+  // Apply a timeout to low-priority status messages
1356
+  //#define STATUS_MESSAGE_TIMEOUT_SEC 30 // (seconds)
1357
+
1355
   // On the Info Screen, display XY with one decimal place when possible
1358
   // On the Info Screen, display XY with one decimal place when possible
1356
   //#define LCD_DECIMAL_SMALL_XY
1359
   //#define LCD_DECIMAL_SMALL_XY
1357
 
1360
 

+ 4
- 0
Marlin/src/inc/Conditionals_adv.h 파일 보기

587
   #define HAS_PRINT_PROGRESS 1
587
   #define HAS_PRINT_PROGRESS 1
588
 #endif
588
 #endif
589
 
589
 
590
+#if STATUS_MESSAGE_TIMEOUT_SEC > 0
591
+  #define HAS_STATUS_MESSAGE_TIMEOUT 1
592
+#endif
593
+
590
 #if ENABLED(SDSUPPORT) && SD_PROCEDURE_DEPTH
594
 #if ENABLED(SDSUPPORT) && SD_PROCEDURE_DEPTH
591
   #define HAS_MEDIA_SUBCALLS 1
595
   #define HAS_MEDIA_SUBCALLS 1
592
 #endif
596
 #endif

+ 4
- 0
Marlin/src/inc/Warnings.cpp 파일 보기

574
   #warning "Contrast cannot be changed when LCD_CONTRAST_MIN >= LCD_CONTRAST_MAX."
574
   #warning "Contrast cannot be changed when LCD_CONTRAST_MIN >= LCD_CONTRAST_MAX."
575
 #endif
575
 #endif
576
 
576
 
577
+#if PROGRESS_MSG_EXPIRE > 0 && HAS_STATUS_MESSAGE_TIMEOUT
578
+  #warning "It is recommended not to combine PROGRESS_MSG_EXPIRE with STATUS_MESSAGE_TIMEOUT_SEC."
579
+#endif
580
+
577
 /**
581
 /**
578
  * FYSETC backlighting
582
  * FYSETC backlighting
579
  */
583
  */

+ 16
- 2
Marlin/src/lcd/marlinui.cpp 파일 보기

73
   #endif
73
   #endif
74
   char MarlinUI::status_message[MAX_MESSAGE_LENGTH + 1];
74
   char MarlinUI::status_message[MAX_MESSAGE_LENGTH + 1];
75
   uint8_t MarlinUI::alert_level; // = 0
75
   uint8_t MarlinUI::alert_level; // = 0
76
+  #if HAS_STATUS_MESSAGE_TIMEOUT
77
+    millis_t MarlinUI::status_message_expire_ms; // = 0
78
+  #endif
76
   statusResetFunc_t MarlinUI::status_reset_callback; // = nullptr
79
   statusResetFunc_t MarlinUI::status_reset_callback; // = nullptr
77
 #endif
80
 #endif
78
 
81
 
628
 
631
 
629
     #endif // BASIC_PROGRESS_BAR
632
     #endif // BASIC_PROGRESS_BAR
630
 
633
 
631
-    if (status_reset_callback && (*status_reset_callback)())
632
-      reset_status();
634
+    bool did_expire = status_reset_callback && (*status_reset_callback)();
635
+
636
+    #if HAS_STATUS_MESSAGE_TIMEOUT
637
+      #ifndef GOT_MS
638
+        #define GOT_MS
639
+        const millis_t ms = millis();
640
+      #endif
641
+      did_expire |= status_message_expire_ms && ELAPSED(ms, status_message_expire_ms);
642
+    #endif
643
+
644
+    if (did_expire) reset_status();
633
 
645
 
634
     #if HAS_MARLINUI_MENU
646
     #if HAS_MARLINUI_MENU
635
       if (use_click()) {
647
       if (use_click()) {
1521
 
1533
 
1522
     set_status_reset_fn();
1534
     set_status_reset_fn();
1523
 
1535
 
1536
+    TERN_(HAS_STATUS_MESSAGE_TIMEOUT, status_message_expire_ms = persist ? 0 : millis() + (STATUS_MESSAGE_TIMEOUT_SEC) * 1000UL);
1537
+
1524
     #if HAS_WIRED_LCD
1538
     #if HAS_WIRED_LCD
1525
 
1539
 
1526
       #if BASIC_PROGRESS_BAR || BOTH(FILAMENT_LCD_DISPLAY, SDSUPPORT)
1540
       #if BASIC_PROGRESS_BAR || BOTH(FILAMENT_LCD_DISPLAY, SDSUPPORT)

+ 4
- 0
Marlin/src/lcd/marlinui.h 파일 보기

344
     static char status_message[];
344
     static char status_message[];
345
     static uint8_t alert_level; // Higher levels block lower levels
345
     static uint8_t alert_level; // Higher levels block lower levels
346
 
346
 
347
+    #if HAS_STATUS_MESSAGE_TIMEOUT
348
+      static millis_t status_message_expire_ms; // Reset some status messages after a timeout
349
+    #endif
350
+
347
     #if ENABLED(STATUS_MESSAGE_SCROLLING)
351
     #if ENABLED(STATUS_MESSAGE_SCROLLING)
348
       static uint8_t status_scroll_offset;
352
       static uint8_t status_scroll_offset;
349
       static void advance_status_scroll();
353
       static void advance_status_scroll();

Loading…
취소
저장