浏览代码

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

Alexander Gavrilenko 5 年前
父节点
当前提交
c45d6b2017
没有帐户链接到提交者的电子邮件
共有 1 个文件被更改,包括 8 次插入5 次删除
  1. 8
    5
      Marlin/src/lcd/ultralcd.cpp

+ 8
- 5
Marlin/src/lcd/ultralcd.cpp 查看文件

777
     static bool wait_for_unclick; // = false
777
     static bool wait_for_unclick; // = false
778
 
778
 
779
     #if ENABLED(TOUCH_BUTTONS)
779
     #if ENABLED(TOUCH_BUTTONS)
780
-
781
       if (touch_buttons) {
780
       if (touch_buttons) {
782
         RESET_STATUS_TIMEOUT();
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
           if (ELAPSED(ms, next_button_update_ms)) {
783
           if (ELAPSED(ms, next_button_update_ms)) {
785
             encoderDiff = (ENCODER_STEPS_PER_MENU_ITEM) * (ENCODER_PULSES_PER_STEP) * encoderDirection;
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
             #if ENABLED(AUTO_BED_LEVELING_UBL)
786
             #if ENABLED(AUTO_BED_LEVELING_UBL)
788
               if (external_control) ubl.encoder_diff = encoderDiff;
787
               if (external_control) ubl.encoder_diff = encoderDiff;
789
             #endif
788
             #endif
1246
             | slow_buttons
1245
             | slow_buttons
1247
           #endif
1246
           #endif
1248
           #if ENABLED(TOUCH_BUTTONS) && HAS_ENCODER_ACTION
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
           #endif
1253
           #endif
1251
         );
1254
         );
1252
 
1255
 
1277
 
1280
 
1278
     } // next_button_update_ms
1281
     } // next_button_update_ms
1279
 
1282
 
1280
-    #if HAS_ENCODER_WHEEL && DISABLED(TOUCH_BUTTONS)
1283
+    #if HAS_ENCODER_WHEEL
1281
       static uint8_t lastEncoderBits;
1284
       static uint8_t lastEncoderBits;
1282
 
1285
 
1283
       #define encrot0 0
1286
       #define encrot0 0

正在加载...
取消
保存