hyuindai
This commit is contained in:
parent
72f89f2167
commit
0b1d09715a
|
@ -87,7 +87,7 @@ static void setupDefaultSensorInputs() {
|
|||
|
||||
engineConfiguration->iat.adcChannel = H144_IN_IAT;
|
||||
|
||||
engineConfiguration->auxTempSensor1.adcChannel = H144_IN_O2S2;
|
||||
// engineConfiguration->auxTempSensor1.adcChannel = H144_IN_O2S2;
|
||||
engineConfiguration->auxTempSensor2.adcChannel = EFI_ADC_NONE;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,23 +23,25 @@ static CCM_OPTIONAL FunctionalSensor aux2(SensorType::AuxTemp2, MS2NT(10));
|
|||
|
||||
static FuncPair fclt, fiat, faux1, faux2;
|
||||
|
||||
void validateThermistorConfig(thermistor_conf_s& cfg) {
|
||||
static void validateThermistorConfig(const char *msg, thermistor_conf_s& cfg) {
|
||||
if (cfg.tempC_1 >= cfg.tempC_2 ||
|
||||
cfg.tempC_2 >= cfg.tempC_3) {
|
||||
firmwareError(OBD_Engine_Coolant_Temperature_Circuit_Malfunction, "Invalid thermistor configuration: please check that temperatures are in the ascending order %f %f %f",
|
||||
firmwareError(OBD_Engine_Coolant_Temperature_Circuit_Malfunction, "Invalid thermistor %s configuration: please check that temperatures are in the ascending order %f %f %f",
|
||||
msg,
|
||||
cfg.tempC_1,
|
||||
cfg.tempC_2,
|
||||
cfg.tempC_3);
|
||||
}
|
||||
}
|
||||
|
||||
static SensorConverter& configureTempSensorFunction(thermistor_conf_s& cfg, FuncPair& p, bool isLinear) {
|
||||
static SensorConverter& configureTempSensorFunction(const char *msg,
|
||||
thermistor_conf_s& cfg, FuncPair& p, bool isLinear) {
|
||||
if (isLinear) {
|
||||
p.linear.configure(cfg.resistance_1, cfg.tempC_1, cfg.resistance_2, cfg.tempC_2, -50, 250);
|
||||
|
||||
return p.linear;
|
||||
} else /* sensor is thermistor */ {
|
||||
validateThermistorConfig(cfg);
|
||||
validateThermistorConfig(msg, cfg);
|
||||
|
||||
p.thermistor.get<resist>().configure(5.0f, cfg.bias_resistor);
|
||||
p.thermistor.get<therm>().configure(cfg);
|
||||
|
@ -48,7 +50,8 @@ static SensorConverter& configureTempSensorFunction(thermistor_conf_s& cfg, Func
|
|||
}
|
||||
}
|
||||
|
||||
void configTherm(FunctionalSensor &sensor,
|
||||
static void configTherm(const char *msg,
|
||||
FunctionalSensor &sensor,
|
||||
FuncPair &p,
|
||||
ThermistorConf &config,
|
||||
bool isLinear) {
|
||||
|
@ -58,10 +61,11 @@ void configTherm(FunctionalSensor &sensor,
|
|||
}
|
||||
|
||||
// Configure the conversion function for this sensor
|
||||
sensor.setFunction(configureTempSensorFunction(config.config, p, isLinear));
|
||||
sensor.setFunction(configureTempSensorFunction(msg, config.config, p, isLinear));
|
||||
}
|
||||
|
||||
static void configureTempSensor(FunctionalSensor &sensor,
|
||||
static void configureTempSensor(const char *msg,
|
||||
FunctionalSensor &sensor,
|
||||
FuncPair &p,
|
||||
ThermistorConf &config,
|
||||
bool isLinear) {
|
||||
|
@ -72,7 +76,7 @@ static void configureTempSensor(FunctionalSensor &sensor,
|
|||
return;
|
||||
}
|
||||
|
||||
configTherm(sensor, p, config, isLinear);
|
||||
configTherm(msg, sensor, p, config, isLinear);
|
||||
|
||||
// Register & subscribe
|
||||
AdcSubscription::SubscribeSensor(sensor, channel, 2);
|
||||
|
@ -81,23 +85,27 @@ static void configureTempSensor(FunctionalSensor &sensor,
|
|||
|
||||
void initThermistors(DECLARE_CONFIG_PARAMETER_SIGNATURE) {
|
||||
if (!CONFIG(consumeObdSensors)) {
|
||||
configureTempSensor(clt,
|
||||
configureTempSensor("clt",
|
||||
clt,
|
||||
fclt,
|
||||
CONFIG(clt),
|
||||
CONFIG(useLinearCltSensor));
|
||||
|
||||
configureTempSensor(iat,
|
||||
configureTempSensor("iat",
|
||||
iat,
|
||||
fiat,
|
||||
CONFIG(iat),
|
||||
CONFIG(useLinearIatSensor));
|
||||
}
|
||||
|
||||
configureTempSensor(aux1,
|
||||
configureTempSensor("aux1",
|
||||
aux1,
|
||||
faux1,
|
||||
CONFIG(auxTempSensor1),
|
||||
false);
|
||||
|
||||
configureTempSensor(aux2,
|
||||
configureTempSensor("aux2",
|
||||
aux2,
|
||||
faux2,
|
||||
CONFIG(auxTempSensor2),
|
||||
false);
|
||||
|
|
Loading…
Reference in New Issue