OBD CAN sensors #1733

This commit is contained in:
rusefi 2020-09-03 16:58:10 -04:00
parent d58e34296e
commit 6ce016959a
1 changed files with 10 additions and 4 deletions

View File

@ -37,20 +37,26 @@ public:
return unexpected;
}
if (getTimeNowNt() - m_timeoutPeriod > m_lastUpdate) {
return unexpected;
if (m_timeoutPeriod != 0) { // zero m_timeoutPeriod means value lasts forever
if (getTimeNowNt() - m_timeoutPeriod > m_lastUpdate) {
return unexpected;
}
}
return value;
}
protected:
explicit StoredValueSensor(SensorType type, efitick_t timeoutNt)
void showInfo(Logging* logger, float testInputValue) const {
}
StoredValueSensor(SensorType type, efitick_t timeoutNt)
: Sensor(type)
, m_timeoutPeriod(timeoutNt)
{
}
protected:
// Invalidate the stored value.
void invalidate() {
m_isValid = false;