OBD CAN sensors #1733

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

View File

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