refactoring: extracting method
This commit is contained in:
parent
e754595b97
commit
ddc9971a2a
|
@ -525,7 +525,7 @@ expected<percent_t> EtbController::getClosedLoop(percent_t target, percent_t obs
|
|||
prevOutput = output;
|
||||
|
||||
// seems good enough to simply check for both TPS sensors
|
||||
bool isInputError = !Sensor::get(SensorType::Tps1).Valid || isTps2Error() || isPedalError();
|
||||
bool isInputError = isTps1Error() || isTps2Error() || isPedalError();
|
||||
// current basic implementation is to check for input error counter only while engine is not running
|
||||
// we can make this logic smarter one day later
|
||||
if (Sensor::getOrZero(SensorType::Rpm) == 0 && wasInputError != isInputError) {
|
||||
|
|
|
@ -34,6 +34,10 @@ void grabPedalIsWideOpen() {
|
|||
engine->outputChannels.calibrationValue2 = Sensor::getRaw(SensorType::AcceleratorPedalSecondary);
|
||||
}
|
||||
|
||||
bool isTps1Error() {
|
||||
return !Sensor::get(SensorType::Tps1).Valid;
|
||||
}
|
||||
|
||||
bool isTps2Error() {
|
||||
return !Sensor::get(SensorType::Tps2).Valid && Sensor::hasSensor(SensorType::Tps2Primary);
|
||||
}
|
||||
|
|
|
@ -24,5 +24,6 @@ void grabTPSIsWideOpen();
|
|||
void grabPedalIsUp();
|
||||
void grabPedalIsWideOpen();
|
||||
|
||||
bool isTps1Error();
|
||||
bool isTps2Error();
|
||||
bool isPedalError();
|
||||
|
|
Loading…
Reference in New Issue