Browse Source

Add 'BTN_ENC_EN' for SKR V1.4 with DOGM (#19796)

Gurmeet Athwal 3 years ago
parent
commit
62ba799d72
No account linked to committer's email address

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

@@ -337,6 +337,10 @@ void MarlinUI::init() {
337 337
       SET_INPUT_PULLUP(BTN_ENC);
338 338
     #endif
339 339
 
340
+    #if BUTTON_EXISTS(ENC_EN)
341
+      SET_INPUT_PULLUP(BTN_ENC_EN);
342
+    #endif
343
+
340 344
     #if BUTTON_EXISTS(BACK)
341 345
       SET_INPUT_PULLUP(BTN_BACK);
342 346
     #endif
@@ -957,7 +961,10 @@ void MarlinUI::update() {
957 961
 
958 962
           #endif // ENCODER_RATE_MULTIPLIER
959 963
 
960
-          encoderPosition += (encoderDiff * encoderMultiplier) / epps;
964
+          // Update position only when ENC_EN is HIGH
965
+          if (TERN1(BTN_ENC_EN, !BUTTON_PRESSED(ENC_EN)))
966
+            encoderPosition += (encoderDiff * encoderMultiplier) / epps;
967
+
961 968
           encoderDiff = 0;
962 969
         }
963 970
 
@@ -1175,7 +1182,8 @@ void MarlinUI::update() {
1175 1182
             if (BUTTON_PRESSED(EN2)) newbutton |= EN_B;
1176 1183
           #endif
1177 1184
           #if BUTTON_EXISTS(ENC)
1178
-            if (BUTTON_PRESSED(ENC)) newbutton |= EN_C;
1185
+            // Update button only when ENC_EN is HIGH
1186
+            if (TERN1(BTN_ENC_EN, !BUTTON_PRESSED(ENC_EN)) && BUTTON_PRESSED(ENC)) newbutton |= EN_C;
1179 1187
           #endif
1180 1188
           #if BUTTON_EXISTS(BACK)
1181 1189
             if (BUTTON_PRESSED(BACK)) newbutton |= EN_D;

+ 5
- 0
Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h View File

@@ -399,6 +399,11 @@
399 399
         #define LCD_PINS_D5                P1_21
400 400
         #define LCD_PINS_D6                P1_22
401 401
         #define LCD_PINS_D7                P1_23
402
+
403
+        #if ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER)
404
+          #define BTN_ENC_EN         LCD_PINS_D7  // Detect the presence of the encoder
405
+        #endif
406
+
402 407
       #endif
403 408
 
404 409
     #endif // !FYSETC_MINI_12864

+ 3
- 0
Marlin/src/pins/pinsDebug_list.h View File

@@ -147,6 +147,9 @@
147 147
 #if defined(BTN_EN2) && BTN_EN2 >= 0
148 148
   REPORT_NAME_DIGITAL(__LINE__, BTN_EN2)
149 149
 #endif
150
+#if defined(BTN_ENC_EN) && BTN_ENC_EN >= 0
151
+  REPORT_NAME_DIGITAL(__LINE__, BTN_ENC_EN)
152
+#endif
150 153
 #if defined(BTN_ENC) && BTN_ENC >= 0
151 154
   REPORT_NAME_DIGITAL(__LINE__, BTN_ENC)
152 155
 #endif

Loading…
Cancel
Save