From c0b776375da14a3712aa60846586337990c4f32b Mon Sep 17 00:00:00 2001 From: 3d-gussner <3d.gussner@gmail.com> Date: Wed, 8 Sep 2021 19:33:08 +0200 Subject: [PATCH] Fix right button issue on some hardware My MM-control-board v0.3 has following ADC readings in DEBUG_BUTTONS - none = 1023 - left = 169 - mid = 91-92 - right = 0 As the comparison was larger than 0 MY MMU2 right button wasn't detected. --- src/modules/buttons.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/modules/buttons.cpp b/src/modules/buttons.cpp index 1ea7cc0..60a61fc 100644 --- a/src/modules/buttons.cpp +++ b/src/modules/buttons.cpp @@ -15,7 +15,7 @@ int8_t Buttons::DecodeADC(uint16_t rawADC) { // Doesn't handle multiple pressed buttons at once for (int8_t buttonIndex = 0; buttonIndex < config::buttonCount; ++buttonIndex) { - if (rawADC > config::buttonADCLimits[buttonIndex][0] && rawADC <= config::buttonADCLimits[buttonIndex][1]) + if (rawADC >= config::buttonADCLimits[buttonIndex][0] && rawADC <= config::buttonADCLimits[buttonIndex][1]) return buttonIndex; }