Reinit pressure sensors (#3287)
* pressure sensors reinit * oops * typo Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
This commit is contained in:
parent
62725b3b32
commit
f72c4656c4
|
@ -38,7 +38,7 @@ void initTurbochargerSpeedSensor(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||||
void deinitVbatt();
|
void deinitVbatt();
|
||||||
void deinitTps();
|
void deinitTps();
|
||||||
void deinitThermistors();
|
void deinitThermistors();
|
||||||
void reconfigureOilPressure(DECLARE_CONFIG_PARAMETER_SIGNATURE);
|
void deinitOilPressure();
|
||||||
void deInitFlexSensor();
|
void deInitFlexSensor();
|
||||||
void deInitVehicleSpeedSensor();
|
void deInitVehicleSpeedSensor();
|
||||||
void deinitTurbochargerSpeedSensor();
|
void deinitTurbochargerSpeedSensor();
|
||||||
|
|
|
@ -17,18 +17,6 @@ static FunctionalSensor fuelPressureSensorHigh(SensorType::FuelPressureHigh, /*
|
||||||
|
|
||||||
static ProxySensor injectorPressure(SensorType::FuelPressureInjector);
|
static ProxySensor injectorPressure(SensorType::FuelPressureInjector);
|
||||||
|
|
||||||
static void configureFluidPressure(LinearFunc& func, const linear_sensor_s& cfg) {
|
|
||||||
float val1 = cfg.value1;
|
|
||||||
float val2 = cfg.value2;
|
|
||||||
|
|
||||||
// Limit to max given pressure - val1 or val2 could be larger
|
|
||||||
// (sensor may be backwards, high voltage = low pressure)
|
|
||||||
float greaterOutput = val1 > val2 ? val1 : val2;
|
|
||||||
|
|
||||||
// Allow slightly negative output (-5kpa) so as to not fail the sensor when engine is off
|
|
||||||
func.configure(cfg.v1, val1, cfg.v2, val2, /*minOutput*/ -5, greaterOutput);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param bandwidth Hertz, used by low pass filter in to analog subscribers
|
* @param bandwidth Hertz, used by low pass filter in to analog subscribers
|
||||||
*/
|
*/
|
||||||
|
@ -40,7 +28,16 @@ static void initFluidPressure(LinearFunc& func, FunctionalSensor& sensor, const
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
configureFluidPressure(func, cfg);
|
float val1 = cfg.value1;
|
||||||
|
float val2 = cfg.value2;
|
||||||
|
|
||||||
|
// Limit to max given pressure - val1 or val2 could be larger
|
||||||
|
// (sensor may be backwards, high voltage = low pressure)
|
||||||
|
float greaterOutput = val1 > val2 ? val1 : val2;
|
||||||
|
|
||||||
|
// Allow slightly negative output (-5kpa) so as to not fail the sensor when engine is off
|
||||||
|
func.configure(cfg.v1, val1, cfg.v2, val2, /*minOutput*/ -5, greaterOutput);
|
||||||
|
|
||||||
sensor.setFunction(func);
|
sensor.setFunction(func);
|
||||||
|
|
||||||
AdcSubscription::SubscribeSensor(sensor, channel, bandwidth);
|
AdcSubscription::SubscribeSensor(sensor, channel, bandwidth);
|
||||||
|
@ -62,8 +59,8 @@ void initOilPressure(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
||||||
injectorPressure.Register();
|
injectorPressure.Register();
|
||||||
}
|
}
|
||||||
|
|
||||||
void reconfigureOilPressure(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
void deinitOilPressure() {
|
||||||
configureFluidPressure(oilpSensorFunc, CONFIG(oilPressure));
|
AdcSubscription::UnsubscribeSensor(oilpSensor);
|
||||||
configureFluidPressure(fuelPressureFuncLow, CONFIG(lowPressureFuel));
|
AdcSubscription::UnsubscribeSensor(fuelPressureSensorLow);
|
||||||
configureFluidPressure(fuelPressureFuncHigh, CONFIG(highPressureFuel));
|
AdcSubscription::UnsubscribeSensor(fuelPressureSensorHigh);
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,6 +81,7 @@ void stopSensors(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
||||||
deInitOldAnalogInputs(PASS_CONFIG_PARAMETER_SIGNATURE);
|
deInitOldAnalogInputs(PASS_CONFIG_PARAMETER_SIGNATURE);
|
||||||
|
|
||||||
deinitTps();
|
deinitTps();
|
||||||
|
deinitOilPressure();
|
||||||
deinitVbatt();
|
deinitVbatt();
|
||||||
deinitThermistors();
|
deinitThermistors();
|
||||||
deInitFlexSensor();
|
deInitFlexSensor();
|
||||||
|
@ -89,9 +90,8 @@ void stopSensors(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void reconfigureSensors(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
void reconfigureSensors(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
reconfigureOilPressure(PASS_CONFIG_PARAMETER_SIGNATURE);
|
|
||||||
|
|
||||||
initTps(PASS_CONFIG_PARAMETER_SIGNATURE);
|
initTps(PASS_CONFIG_PARAMETER_SIGNATURE);
|
||||||
|
initOilPressure(PASS_CONFIG_PARAMETER_SIGNATURE);
|
||||||
initVbatt(PASS_CONFIG_PARAMETER_SIGNATURE);
|
initVbatt(PASS_CONFIG_PARAMETER_SIGNATURE);
|
||||||
initThermistors(PASS_CONFIG_PARAMETER_SIGNATURE);
|
initThermistors(PASS_CONFIG_PARAMETER_SIGNATURE);
|
||||||
initFlexSensor(PASS_CONFIG_PARAMETER_SIGNATURE);
|
initFlexSensor(PASS_CONFIG_PARAMETER_SIGNATURE);
|
||||||
|
|
Loading…
Reference in New Issue