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 deinitTps();
|
||||
void deinitThermistors();
|
||||
void reconfigureOilPressure(DECLARE_CONFIG_PARAMETER_SIGNATURE);
|
||||
void deinitOilPressure();
|
||||
void deInitFlexSensor();
|
||||
void deInitVehicleSpeedSensor();
|
||||
void deinitTurbochargerSpeedSensor();
|
||||
|
|
|
@ -17,18 +17,6 @@ static FunctionalSensor fuelPressureSensorHigh(SensorType::FuelPressureHigh, /*
|
|||
|
||||
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
|
||||
*/
|
||||
|
@ -40,7 +28,16 @@ static void initFluidPressure(LinearFunc& func, FunctionalSensor& sensor, const
|
|||
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);
|
||||
|
||||
AdcSubscription::SubscribeSensor(sensor, channel, bandwidth);
|
||||
|
@ -62,8 +59,8 @@ void initOilPressure(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
|||
injectorPressure.Register();
|
||||
}
|
||||
|
||||
void reconfigureOilPressure(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
||||
configureFluidPressure(oilpSensorFunc, CONFIG(oilPressure));
|
||||
configureFluidPressure(fuelPressureFuncLow, CONFIG(lowPressureFuel));
|
||||
configureFluidPressure(fuelPressureFuncHigh, CONFIG(highPressureFuel));
|
||||
void deinitOilPressure() {
|
||||
AdcSubscription::UnsubscribeSensor(oilpSensor);
|
||||
AdcSubscription::UnsubscribeSensor(fuelPressureSensorLow);
|
||||
AdcSubscription::UnsubscribeSensor(fuelPressureSensorHigh);
|
||||
}
|
||||
|
|
|
@ -81,6 +81,7 @@ void stopSensors(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
|||
deInitOldAnalogInputs(PASS_CONFIG_PARAMETER_SIGNATURE);
|
||||
|
||||
deinitTps();
|
||||
deinitOilPressure();
|
||||
deinitVbatt();
|
||||
deinitThermistors();
|
||||
deInitFlexSensor();
|
||||
|
@ -89,9 +90,8 @@ void stopSensors(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
|||
}
|
||||
|
||||
void reconfigureSensors(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||
reconfigureOilPressure(PASS_CONFIG_PARAMETER_SIGNATURE);
|
||||
|
||||
initTps(PASS_CONFIG_PARAMETER_SIGNATURE);
|
||||
initOilPressure(PASS_CONFIG_PARAMETER_SIGNATURE);
|
||||
initVbatt(PASS_CONFIG_PARAMETER_SIGNATURE);
|
||||
initThermistors(PASS_CONFIG_PARAMETER_SIGNATURE);
|
||||
initFlexSensor(PASS_CONFIG_PARAMETER_SIGNATURE);
|
||||
|
|
Loading…
Reference in New Issue