Only allow manual +/- if in manual range

This commit is contained in:
David Holdeman 2024-04-20 12:59:36 -05:00 committed by rusefillc
parent 48a658fff9
commit 649e7cf149
2 changed files with 5 additions and 2 deletions

View File

@ -96,7 +96,7 @@ void GenericGearController::update() {
setDesiredGear(NEUTRAL);
break;
case SelectedGear::ManualPlus :
if (!shiftTimer.hasElapsedMs(500)) {
if (!shiftTimer.hasElapsedMs(500) || lastRange != SelectedGear::Manual) {
break;
}
shiftTimer.reset();
@ -115,7 +115,7 @@ void GenericGearController::update() {
}
break;
case SelectedGear::ManualMinus :
if (!shiftTimer.hasElapsedMs(500)) {
if (!shiftTimer.hasElapsedMs(500) || lastRange != SelectedGear::Manual) {
break;
}
shiftTimer.reset();
@ -139,6 +139,8 @@ void GenericGearController::update() {
default:
break;
}
lastRange = gear;
}
GearControllerBase::update();

View File

@ -15,6 +15,7 @@ public:
}
private:
Timer shiftTimer;
SelectedGear lastRange;
bool isNearest(float value, int pinIndex, float* rangeStates);
SensorType getAnalogSensorType(int zeroBasedSensorIndex);
};