parent
ec3ec9f40b
commit
5fc1b6902c
|
@ -193,14 +193,11 @@ void Engine::periodicSlowCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|||
slowCallBackWasInvoked = true;
|
||||
|
||||
#if HW_CHECK_MODE
|
||||
// we need to skip some of the first measurments to have BiQuad filter happy
|
||||
if (getSlowAdcCounter() > 1000) {
|
||||
efiAssertVoid(OBD_PCM_Processor_Fault, CONFIG(clt).adcChannel != EFI_ADC_NONE, "No CLT setting");
|
||||
assertCloseTo("clt", Sensor::get(SensorType::Clt).Value, 49.3);
|
||||
assertCloseTo("iat", Sensor::get(SensorType::Iat).Value, 73.2);
|
||||
assertCloseTo("aut1", Sensor::get(SensorType::AuxTemp1).Value, 13.8);
|
||||
assertCloseTo("aut2", Sensor::get(SensorType::AuxTemp2).Value, 6.2);
|
||||
}
|
||||
efiAssertVoid(OBD_PCM_Processor_Fault, CONFIG(clt).adcChannel != EFI_ADC_NONE, "No CLT setting");
|
||||
assertCloseTo("clt", Sensor::get(SensorType::Clt).Value, 49.3);
|
||||
assertCloseTo("iat", Sensor::get(SensorType::Iat).Value, 73.2);
|
||||
assertCloseTo("aut1", Sensor::get(SensorType::AuxTemp1).Value, 13.8);
|
||||
assertCloseTo("aut2", Sensor::get(SensorType::AuxTemp2).Value, 6.2);
|
||||
#endif // HW_CHECK_MODE
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ struct AdcSubscriptionEntry {
|
|||
float VoltsPerAdcVolt;
|
||||
adc_channel_e Channel;
|
||||
Biquad Filter;
|
||||
bool HasUpdated = false;
|
||||
};
|
||||
|
||||
static size_t s_nextEntry = 0;
|
||||
|
@ -68,6 +69,14 @@ void AdcSubscription::UpdateSubscribers(efitick_t nowNt) {
|
|||
float mcuVolts = getVoltage("sensor", entry.Channel);
|
||||
float sensorVolts = mcuVolts * entry.VoltsPerAdcVolt;
|
||||
|
||||
// On the very first update, preload the filter as if we've been
|
||||
// seeing this value for a long time. This prevents a slow ramp-up
|
||||
// towards the correct value just after startup
|
||||
if (!entry.HasUpdated) {
|
||||
entry.Filter.cookSteadyState(sensorVolts);
|
||||
entry.HasUpdated = true;
|
||||
}
|
||||
|
||||
float filtered = entry.Filter.filter(sensorVolts);
|
||||
|
||||
entry.Sensor->postRawValue(filtered, nowNt);
|
||||
|
|
Loading…
Reference in New Issue