Browse Source

Color UI single touch menu navigation (#20053)

Victor Oliveira 4 years ago
parent
commit
2fdeceda58
No account linked to committer's email address

+ 4
- 0
Marlin/Configuration.h View File

@@ -2343,6 +2343,10 @@
2343 2343
   //#define XPT2046_Y_CALIBRATION -8981
2344 2344
   //#define XPT2046_X_OFFSET        -43
2345 2345
   //#define XPT2046_Y_OFFSET        257
2346
+
2347
+  #if ENABLED(TFT_COLOR_UI)
2348
+    //#define SINGLE_TOUCH_NAVIGATION
2349
+  #endif
2346 2350
 #endif
2347 2351
 
2348 2352
 //

+ 4
- 1
Marlin/src/lcd/tft/touch.cpp View File

@@ -206,7 +206,10 @@ void Touch::touch(touch_control_t *control) {
206 206
 
207 207
     case MENU_SCREEN: ui.goto_screen((screenFunc_t)control->data); break;
208 208
     case BACK: ui.goto_previous_screen(); break;
209
-    case CLICK: ui.lcd_clicked = true; break;
209
+    case CLICK:
210
+      TERN_(SINGLE_TOUCH_NAVIGATION, ui.encoderPosition = control->data);
211
+      ui.lcd_clicked = true;
212
+      break;
210 213
     #if HAS_RESUME_CONTINUE
211 214
       case RESUME_CONTINUE: extern bool wait_for_user; wait_for_user = false; break;
212 215
     #endif

+ 4
- 1
Marlin/src/lcd/tft/ui_320x240.cpp View File

@@ -647,7 +647,10 @@ void menu_item(const uint8_t row, bool sel ) {
647 647
   #endif
648 648
 
649 649
   menu_line(row, sel ? COLOR_SELECTION_BG : COLOR_BACKGROUND);
650
-  TERN_(TOUCH_SCREEN, touch.add_control(sel ? CLICK : MENU_ITEM, 0, 2 + 34 * row, 320, 32, encoderTopLine + row));
650
+  #if ENABLED(TOUCH_SCREEN)
651
+    const TouchControlType tct = TERN(SINGLE_TOUCH_NAVIGATION, true, sel) ? CLICK : MENU_ITEM;
652
+    touch.add_control(tct, 0, 2 + 34 * row, 320, 32, encoderTopLine + row);
653
+  #endif
651 654
 }
652 655
 
653 656
 void MarlinUI::move_axis_screen() {

+ 4
- 1
Marlin/src/lcd/tft/ui_480x320.cpp View File

@@ -652,7 +652,10 @@ void menu_item(const uint8_t row, bool sel ) {
652 652
   #endif
653 653
 
654 654
   menu_line(row, sel ? COLOR_SELECTION_BG : COLOR_BACKGROUND);
655
-  TERN_(TOUCH_SCREEN, touch.add_control(sel ? CLICK : MENU_ITEM, 0, 4 + 45 * row, TFT_WIDTH, 43, encoderTopLine + row));
655
+  #if ENABLED(TOUCH_SCREEN)
656
+    const TouchControlType tct = TERN(SINGLE_TOUCH_NAVIGATION, true, sel) ? CLICK : MENU_ITEM;
657
+    touch.add_control(tct, 0, 4 + 45 * row, TFT_WIDTH, 43, encoderTopLine + row);
658
+  #endif
656 659
 }
657 660
 
658 661
 #if ENABLED(BABYSTEP_ZPROBE_OFFSET)

Loading…
Cancel
Save