diff --git a/firmware/config/engines/honda_accord.cpp b/firmware/config/engines/honda_accord.cpp index 70dec2f6ef..604a57259a 100644 --- a/firmware/config/engines/honda_accord.cpp +++ b/firmware/config/engines/honda_accord.cpp @@ -60,10 +60,10 @@ static void setHondaAccordConfigurationCommon(engine_configuration_s *engineConf * 2.1K Ohm @ 24C * 100 Ohm @ 120C */ - setThermistorConfiguration(&engineConfiguration->cltThermistorConf, -20.0, 18000.0, 23.8889, 2100.0, 120.0, 100.0); + setCommonNTCSensor(&engineConfiguration->cltThermistorConf); engineConfiguration->cltThermistorConf.bias_resistor = 1500; // same as OEM ECU - setThermistorConfiguration(&engineConfiguration->iatThermistorConf, -20.0, 18000.0, 23.8889, 2100.0, 120.0, 100.0); + setCommonNTCSensor(&engineConfiguration->iatThermistorConf); engineConfiguration->iatThermistorConf.bias_resistor = 1500; // same as OEM ECU // set_cranking_charge_angle 35 diff --git a/firmware/config/engines/mitsubishi.cpp b/firmware/config/engines/mitsubishi.cpp index ca3b4bfcad..7135266222 100644 --- a/firmware/config/engines/mitsubishi.cpp +++ b/firmware/config/engines/mitsubishi.cpp @@ -51,13 +51,8 @@ void setMitsubishiConfiguration(engine_configuration_s *engineConfiguration, boa // */ // setThermistorConfiguration(&engineConfiguration->cltThermistorConf, 40, 29150, 70, 10160, 150, 1270); - /** - * 18K Ohm @ -20C - * 2.1K Ohm @ 24C - * 294 Ohm @ 80C - * http://www.rexbo.eu/hella/coolant-temperature-sensor-6pt009107121?c=100334&at=3130 - */ - setThermistorConfiguration(&engineConfiguration->cltThermistorConf, -20, 18000, 23.8889, 2100, 80, 294); + setCommonNTCSensor(&engineConfiguration->cltThermistorConf); + engineConfiguration->cltThermistorConf.bias_resistor = 2700; diff --git a/firmware/controllers/sensors/thermistors.cpp b/firmware/controllers/sensors/thermistors.cpp index 705d0cea46..1ee176e9ac 100644 --- a/firmware/controllers/sensors/thermistors.cpp +++ b/firmware/controllers/sensors/thermistors.cpp @@ -167,6 +167,17 @@ static void initThermistorCurve(Thermistor * t, ThermistorConf *config, adc_chan t->channel = channel; } +// todo: better method name? +void setCommonNTCSensor(ThermistorConf *thermistorConf) { + /** + * 18K Ohm @ -20C + * 2.1K Ohm @ 24C + * 294 Ohm @ 80C + * http://www.rexbo.eu/hella/coolant-temperature-sensor-6pt009107121?c=100334&at=3130 + */ + setThermistorConfiguration(thermistorConf, -20, 18000, 23.8889, 2100, 120.0, 100.0); +} + void initThermistors(void) { initThermistorCurve(&engineConfiguration2->clt, &engineConfiguration->cltThermistorConf, engineConfiguration->cltAdcChannel); diff --git a/firmware/controllers/sensors/thermistors.h b/firmware/controllers/sensors/thermistors.h index fe9b2a8a55..1a2521b7ef 100644 --- a/firmware/controllers/sensors/thermistors.h +++ b/firmware/controllers/sensors/thermistors.h @@ -49,6 +49,8 @@ void setThermistorConfiguration(ThermistorConf * tc, float temp1, float r1, floa void prepareThermistorCurve(ThermistorConf * config); void initThermistors(void); +void setCommonNTCSensor(ThermistorConf *thermistorConf); + #ifdef __cplusplus } #endif /* __cplusplus */