From 1c1210686920e637dec27006003757c89f759d6d Mon Sep 17 00:00:00 2001 From: bdring Date: Thu, 24 Sep 2020 18:22:36 -0500 Subject: [PATCH] fixed dual switches when inverted (#614) * fixed dual switches when inverted * Removed debug message --- Grbl_Esp32/src/Limits.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Grbl_Esp32/src/Limits.cpp b/Grbl_Esp32/src/Limits.cpp index 8c5e252c..382b02e1 100644 --- a/Grbl_Esp32/src/Limits.cpp +++ b/Grbl_Esp32/src/Limits.cpp @@ -376,7 +376,10 @@ uint8_t limits_get_state() { for (int gang_index = 0; gang_index < 2; gang_index++) { uint8_t pin = limit_pins[axis][gang_index]; if (pin != UNDEFINED_PIN) { - pinMask |= (digitalRead(pin) << axis); + if (limit_invert->get()) + pinMask |= (!digitalRead(pin) << axis); + else + pinMask |= (digitalRead(pin) << axis); } } } @@ -384,9 +387,6 @@ uint8_t limits_get_state() { #ifdef INVERT_LIMIT_PIN_MASK // not normally used..unless you have both normal and inverted switches pinMask ^= INVERT_LIMIT_PIN_MASK; #endif - if (limit_invert->get()) { - pinMask ^= limit_mask; - } return pinMask; }