Bläddra i källkod

Simultaneous use of rotary encoder and touch buttons (#16729)

Alexander Gavrilenko 5 år sedan
förälder
incheckning
c45d6b2017
Inget konto är kopplat till bidragsgivarens mejladress
1 ändrade filer med 8 tillägg och 5 borttagningar
  1. 8
    5
      Marlin/src/lcd/ultralcd.cpp

+ 8
- 5
Marlin/src/lcd/ultralcd.cpp Visa fil

@@ -777,13 +777,12 @@ void MarlinUI::update() {
777 777
     static bool wait_for_unclick; // = false
778 778
 
779 779
     #if ENABLED(TOUCH_BUTTONS)
780
-
781 780
       if (touch_buttons) {
782 781
         RESET_STATUS_TIMEOUT();
783
-        if (buttons & (EN_A | EN_B)) {                    // Menu arrows, in priority
782
+        if (touch_buttons & (EN_A | EN_B)) {              // Menu arrows, in priority
784 783
           if (ELAPSED(ms, next_button_update_ms)) {
785 784
             encoderDiff = (ENCODER_STEPS_PER_MENU_ITEM) * (ENCODER_PULSES_PER_STEP) * encoderDirection;
786
-            if (buttons & EN_A) encoderDiff *= -1;
785
+            if (touch_buttons & EN_A) encoderDiff *= -1;
787 786
             #if ENABLED(AUTO_BED_LEVELING_UBL)
788 787
               if (external_control) ubl.encoder_diff = encoderDiff;
789 788
             #endif
@@ -1246,7 +1245,11 @@ void MarlinUI::update() {
1246 1245
             | slow_buttons
1247 1246
           #endif
1248 1247
           #if ENABLED(TOUCH_BUTTONS) && HAS_ENCODER_ACTION
1249
-            | touch_buttons
1248
+            | (touch_buttons
1249
+              #if HAS_ENCODER_WHEEL
1250
+                & (~(EN_A | EN_B))
1251
+              #endif
1252
+            )
1250 1253
           #endif
1251 1254
         );
1252 1255
 
@@ -1277,7 +1280,7 @@ void MarlinUI::update() {
1277 1280
 
1278 1281
     } // next_button_update_ms
1279 1282
 
1280
-    #if HAS_ENCODER_WHEEL && DISABLED(TOUCH_BUTTONS)
1283
+    #if HAS_ENCODER_WHEEL
1281 1284
       static uint8_t lastEncoderBits;
1282 1285
 
1283 1286
       #define encrot0 0

Laddar…
Avbryt
Spara