Browse Source

🐛 Fix FTDUI Status Screen Timeout (#24899)

InsanityAutomation 1 year ago
parent
commit
81f88fefdc
No account linked to committer's email address

+ 2
- 2
Marlin/src/inc/Conditionals_post.h View File

@@ -3689,13 +3689,13 @@
3689 3689
   #endif
3690 3690
 #endif
3691 3691
 
3692
-#if HAS_MARLINUI_MENU
3692
+#if EITHER(HAS_MARLINUI_MENU, TOUCH_UI_FTDI_EVE)
3693 3693
   // LCD timeout to status screen default is 15s
3694 3694
   #ifndef LCD_TIMEOUT_TO_STATUS
3695 3695
     #define LCD_TIMEOUT_TO_STATUS 15000
3696 3696
   #endif
3697 3697
   #if LCD_TIMEOUT_TO_STATUS
3698
-    #define SCREENS_CAN_TIME_OUT 1
3698
+    #define HAS_SCREEN_TIMEOUT 1
3699 3699
   #endif
3700 3700
 #endif
3701 3701
 

+ 11
- 7
Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/base_screen.cpp View File

@@ -45,15 +45,16 @@ bool BaseScreen::buttonStyleCallback(CommandProcessor &cmd, uint8_t tag, uint8_t
45 45
     return false;
46 46
   }
47 47
 
48
-  #if SCREENS_CAN_TIME_OUT
48
+  #if HAS_SCREEN_TIMEOUT
49 49
     if (EventLoop::get_pressed_tag() != 0) {
50
+      #if ENABLED(TOUCH_UI_DEBUG)
51
+        SERIAL_ECHO_MSG("buttonStyleCallback, resetting timeout");
52
+      #endif
50 53
       reset_menu_timeout();
51 54
     }
52 55
   #endif
53 56
 
54
-  if (buttonIsPressed(tag)) {
55
-    options = OPT_FLAT;
56
-  }
57
+  if (buttonIsPressed(tag)) options = OPT_FLAT;
57 58
 
58 59
   if (style & cmd.STYLE_DISABLED) {
59 60
     cmd.tag(0);
@@ -65,7 +66,10 @@ bool BaseScreen::buttonStyleCallback(CommandProcessor &cmd, uint8_t tag, uint8_t
65 66
 }
66 67
 
67 68
 void BaseScreen::onIdle() {
68
-  #if SCREENS_CAN_TIME_OUT
69
+  #if HAS_SCREEN_TIMEOUT
70
+    if (EventLoop::get_pressed_tag() != 0)
71
+      reset_menu_timeout();
72
+
69 73
     if ((millis() - last_interaction) > LCD_TIMEOUT_TO_STATUS) {
70 74
       reset_menu_timeout();
71 75
       #if ENABLED(TOUCH_UI_DEBUG)
@@ -77,10 +81,10 @@ void BaseScreen::onIdle() {
77 81
 }
78 82
 
79 83
 void BaseScreen::reset_menu_timeout() {
80
-  TERN_(SCREENS_CAN_TIME_OUT, last_interaction = millis());
84
+  TERN_(HAS_SCREEN_TIMEOUT, last_interaction = millis());
81 85
 }
82 86
 
83
-#if SCREENS_CAN_TIME_OUT
87
+#if HAS_SCREEN_TIMEOUT
84 88
   uint32_t BaseScreen::last_interaction;
85 89
 #endif
86 90
 

+ 1
- 1
Marlin/src/lcd/extui/ftdi_eve_touch_ui/generic/base_screen.h View File

@@ -27,7 +27,7 @@
27 27
 
28 28
 class BaseScreen : public UIScreen {
29 29
   protected:
30
-    #if SCREENS_CAN_TIME_OUT
30
+    #if HAS_SCREEN_TIMEOUT
31 31
       static uint32_t last_interaction;
32 32
     #endif
33 33
 

+ 2
- 2
Marlin/src/lcd/marlinui.cpp View File

@@ -316,7 +316,7 @@ void MarlinUI::init() {
316 316
     #endif
317 317
   #endif
318 318
 
319
-  #if SCREENS_CAN_TIME_OUT
319
+  #if HAS_SCREEN_TIMEOUT
320 320
     bool MarlinUI::defer_return_to_status;
321 321
     millis_t MarlinUI::return_to_status_ms = 0;
322 322
   #endif
@@ -1171,7 +1171,7 @@ void MarlinUI::init() {
1171 1171
           NOLESS(max_display_update_time, millis() - ms);
1172 1172
       }
1173 1173
 
1174
-      #if SCREENS_CAN_TIME_OUT
1174
+      #if HAS_SCREEN_TIMEOUT
1175 1175
         // Return to Status Screen after a timeout
1176 1176
         if (on_status_screen() || defer_return_to_status)
1177 1177
           reset_status_timeout(ms);

+ 4
- 4
Marlin/src/lcd/marlinui.h View File

@@ -545,7 +545,7 @@ public:
545 545
   #endif
546 546
 
547 547
   static void reset_status_timeout(const millis_t ms) {
548
-    TERN(SCREENS_CAN_TIME_OUT, return_to_status_ms = ms + LCD_TIMEOUT_TO_STATUS, UNUSED(ms));
548
+    TERN(HAS_SCREEN_TIMEOUT, return_to_status_ms = ms + LCD_TIMEOUT_TO_STATUS, UNUSED(ms));
549 549
   }
550 550
 
551 551
   #if HAS_MARLINUI_MENU
@@ -596,11 +596,11 @@ public:
596 596
     #endif
597 597
 
598 598
     FORCE_INLINE static bool screen_is_sticky() {
599
-      return TERN1(SCREENS_CAN_TIME_OUT, defer_return_to_status);
599
+      return TERN1(HAS_SCREEN_TIMEOUT, defer_return_to_status);
600 600
     }
601 601
 
602 602
     FORCE_INLINE static void defer_status_screen(const bool defer=true) {
603
-      TERN(SCREENS_CAN_TIME_OUT, defer_return_to_status = defer, UNUSED(defer));
603
+      TERN(HAS_SCREEN_TIMEOUT, defer_return_to_status = defer, UNUSED(defer));
604 604
     }
605 605
 
606 606
     static void goto_previous_screen_no_defer() {
@@ -778,7 +778,7 @@ public:
778 778
 
779 779
 private:
780 780
 
781
-  #if SCREENS_CAN_TIME_OUT
781
+  #if HAS_SCREEN_TIMEOUT
782 782
     static millis_t return_to_status_ms;
783 783
     static bool defer_return_to_status;
784 784
   #else

+ 3
- 3
Marlin/src/lcd/menu/menu.cpp View File

@@ -61,7 +61,7 @@ typedef struct {
61 61
   screenFunc_t menu_function;     // The screen's function
62 62
   uint32_t encoder_position;      // The position of the encoder
63 63
   int8_t top_line, items;         // The amount of scroll, and the number of items
64
-  #if SCREENS_CAN_TIME_OUT
64
+  #if HAS_SCREEN_TIMEOUT
65 65
     bool sticky;                  // The screen is sticky
66 66
   #endif
67 67
 } menuPosition;
@@ -89,7 +89,7 @@ void MarlinUI::return_to_status() { goto_screen(status_screen); }
89 89
 
90 90
 void MarlinUI::push_current_screen() {
91 91
   if (screen_history_depth < COUNT(screen_history))
92
-    screen_history[screen_history_depth++] = { currentScreen, encoderPosition, encoderTopLine, screen_items OPTARG(SCREENS_CAN_TIME_OUT, screen_is_sticky()) };
92
+    screen_history[screen_history_depth++] = { currentScreen, encoderPosition, encoderTopLine, screen_items OPTARG(HAS_SCREEN_TIMEOUT, screen_is_sticky()) };
93 93
 }
94 94
 
95 95
 void MarlinUI::_goto_previous_screen(TERN_(TURBO_BACK_MENU_ITEM, const bool is_back/*=false*/)) {
@@ -102,7 +102,7 @@ void MarlinUI::_goto_previous_screen(TERN_(TURBO_BACK_MENU_ITEM, const bool is_b
102 102
       is_back ? 0 : sh.top_line,
103 103
       sh.items
104 104
     );
105
-    defer_status_screen(TERN_(SCREENS_CAN_TIME_OUT, sh.sticky));
105
+    defer_status_screen(TERN_(HAS_SCREEN_TIMEOUT, sh.sticky));
106 106
   }
107 107
   else
108 108
     return_to_status();

Loading…
Cancel
Save