Skip to content

Commit 1f11c26

Browse files
guruathwalvgadreau
authored andcommitted
Add 'BTN_ENC_EN' for SKR V1.4 with DOGM (MarlinFirmware#19796)
1 parent 42142a2 commit 1f11c26

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

Marlin/src/lcd/marlinui.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,10 @@ void MarlinUI::init() {
337337
SET_INPUT_PULLUP(BTN_ENC);
338338
#endif
339339

340+
#if BUTTON_EXISTS(ENC_EN)
341+
SET_INPUT_PULLUP(BTN_ENC_EN);
342+
#endif
343+
340344
#if BUTTON_EXISTS(BACK)
341345
SET_INPUT_PULLUP(BTN_BACK);
342346
#endif
@@ -957,7 +961,10 @@ void MarlinUI::update() {
957961

958962
#endif // ENCODER_RATE_MULTIPLIER
959963

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+
961968
encoderDiff = 0;
962969
}
963970

@@ -1175,7 +1182,8 @@ void MarlinUI::update() {
11751182
if (BUTTON_PRESSED(EN2)) newbutton |= EN_B;
11761183
#endif
11771184
#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;
11791187
#endif
11801188
#if BUTTON_EXISTS(BACK)
11811189
if (BUTTON_PRESSED(BACK)) newbutton |= EN_D;

Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,11 @@
399399
#define LCD_PINS_D5 P1_21
400400
#define LCD_PINS_D6 P1_22
401401
#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+
402407
#endif
403408

404409
#endif // !FYSETC_MINI_12864

Marlin/src/pins/pinsDebug_list.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,9 @@
147147
#if defined(BTN_EN2) && BTN_EN2 >= 0
148148
REPORT_NAME_DIGITAL(__LINE__, BTN_EN2)
149149
#endif
150+
#if defined(BTN_ENC_EN) && BTN_ENC_EN >= 0
151+
REPORT_NAME_DIGITAL(__LINE__, BTN_ENC_EN)
152+
#endif
150153
#if defined(BTN_ENC) && BTN_ENC >= 0
151154
REPORT_NAME_DIGITAL(__LINE__, BTN_ENC)
152155
#endif

0 commit comments

Comments
 (0)