ETB duty cycle jitter #4833
This commit is contained in:
parent
6ad3ce13d6
commit
31a8a91f3b
|
@ -524,14 +524,6 @@ expected<percent_t> EtbController::getClosedLoop(percent_t target, percent_t obs
|
|||
etbDutyRateOfChange = m_dutyRocAverage.average(output - prevOutput);
|
||||
prevOutput = output;
|
||||
|
||||
// seems good enough to simply check for both TPS sensors
|
||||
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) {
|
||||
wasInputError = isInputError;
|
||||
etbInputErrorCounter++;
|
||||
}
|
||||
return output;
|
||||
}
|
||||
}
|
||||
|
@ -597,6 +589,22 @@ void EtbController::update() {
|
|||
&& engine->etbAutoTune
|
||||
&& m_function == ETB_Throttle1;
|
||||
|
||||
if (!m_isAutotune) {
|
||||
// note that ClosedLoopController has it's own setpoint error validation so ours with the counter has to be here
|
||||
// seems good enough to simply check for both TPS sensors
|
||||
int errorState = (isTps1Error() ? 1 : 0) + (isTps2Error() ? 2 : 0)
|
||||
+ (isPedalError() ? 4 : 0);
|
||||
|
||||
// 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
|
||||
&& prevErrorState != errorState) {
|
||||
prevErrorState = errorState;
|
||||
etbInputErrorCounter++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ClosedLoopController::update();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue