Make buttons' ADC decision levels "inclusive"

especially because of the zero level, which is very likely to be a valid button0 level
pull/46/head
D.R.racer 2021-07-01 09:50:09 +02:00 committed by DRracer
parent b484eeacb6
commit ccda84df80
1 changed files with 3 additions and 3 deletions

View File

@ -14,11 +14,11 @@ int8_t Buttons::DecodeADC(uint16_t rawADC) {
// Button 3 - 516 // Button 3 - 516
// Doesn't handle multiple pressed buttons at once // Doesn't handle multiple pressed buttons at once
if (rawADC > config::button0ADCMin && rawADC < config::button0ADCMax) if (rawADC >= config::button0ADCMin && rawADC <= config::button0ADCMax)
return 0; return 0;
else if (rawADC > config::button1ADCMin && rawADC < config::button1ADCMax) else if (rawADC >= config::button1ADCMin && rawADC <= config::button1ADCMax)
return 1; return 1;
else if (rawADC > config::button2ADCMin && rawADC < config::button2ADCMax) else if (rawADC >= config::button2ADCMin && rawADC <= config::button2ADCMax)
return 2; return 2;
return -1; return -1;
} }