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

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

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

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

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

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

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

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

545
   #endif
545
   #endif
546
 
546
 
547
   static void reset_status_timeout(const millis_t ms) {
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
   #if HAS_MARLINUI_MENU
551
   #if HAS_MARLINUI_MENU
596
     #endif
596
     #endif
597
 
597
 
598
     FORCE_INLINE static bool screen_is_sticky() {
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
     FORCE_INLINE static void defer_status_screen(const bool defer=true) {
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
     static void goto_previous_screen_no_defer() {
606
     static void goto_previous_screen_no_defer() {
778
 
778
 
779
 private:
779
 private:
780
 
780
 
781
-  #if SCREENS_CAN_TIME_OUT
781
+  #if HAS_SCREEN_TIMEOUT
782
     static millis_t return_to_status_ms;
782
     static millis_t return_to_status_ms;
783
     static bool defer_return_to_status;
783
     static bool defer_return_to_status;
784
   #else
784
   #else

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

61
   screenFunc_t menu_function;     // The screen's function
61
   screenFunc_t menu_function;     // The screen's function
62
   uint32_t encoder_position;      // The position of the encoder
62
   uint32_t encoder_position;      // The position of the encoder
63
   int8_t top_line, items;         // The amount of scroll, and the number of items
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
     bool sticky;                  // The screen is sticky
65
     bool sticky;                  // The screen is sticky
66
   #endif
66
   #endif
67
 } menuPosition;
67
 } menuPosition;
89
 
89
 
90
 void MarlinUI::push_current_screen() {
90
 void MarlinUI::push_current_screen() {
91
   if (screen_history_depth < COUNT(screen_history))
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
 void MarlinUI::_goto_previous_screen(TERN_(TURBO_BACK_MENU_ITEM, const bool is_back/*=false*/)) {
95
 void MarlinUI::_goto_previous_screen(TERN_(TURBO_BACK_MENU_ITEM, const bool is_back/*=false*/)) {
102
       is_back ? 0 : sh.top_line,
102
       is_back ? 0 : sh.top_line,
103
       sh.items
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
   else
107
   else
108
     return_to_status();
108
     return_to_status();

Loading…
Cancel
Save