mirror of https://github.com/rusefi/wideband.git
Use a 0.5s timeout for over/underheat to reject transients
This commit is contained in:
parent
b16b3239bb
commit
a34e0bbdf2
|
@ -117,12 +117,22 @@ HeaterState HeaterControllerBase::GetNextState(HeaterState currentState, HeaterA
|
|||
break;
|
||||
case HeaterState::ClosedLoop:
|
||||
// Check that the sensor's ESR is acceptable for normal operation
|
||||
if (sensorTemp > overheatTemp)
|
||||
if (sensorTemp <= overheatTemp)
|
||||
{
|
||||
m_overheatTimer.reset();
|
||||
}
|
||||
|
||||
if (sensorTemp >= underheatTemp)
|
||||
{
|
||||
m_underheatTimer.reset();
|
||||
}
|
||||
|
||||
if (m_overheatTimer.hasElapsedSec(0.5f))
|
||||
{
|
||||
SetFault(ch, Fault::SensorOverheat);
|
||||
return HeaterState::Stopped;
|
||||
}
|
||||
else if (sensorTemp < underheatTemp)
|
||||
else if (m_underheatTimer.hasElapsedSec(0.5f))
|
||||
{
|
||||
SetFault(ch, Fault::SensorUnderheat);
|
||||
return HeaterState::Stopped;
|
||||
|
|
|
@ -76,6 +76,12 @@ private:
|
|||
Timer m_preheatTimer;
|
||||
Timer m_warmupTimer;
|
||||
|
||||
// Stores the time since a non-over/underheat condition
|
||||
// If the timer reaches a threshold, an over/underheat has
|
||||
// occured
|
||||
Timer m_underheatTimer;
|
||||
Timer m_overheatTimer;
|
||||
|
||||
static const int batteryStabTimeCounter = HEATER_BATTERY_STAB_TIME / HEATER_CONTROL_PERIOD;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue