From c95ed26d894b3f6c82e3c99f7399567ce0817bf1 Mon Sep 17 00:00:00 2001 From: Matthew Kennedy Date: Thu, 28 May 2020 14:51:33 -0700 Subject: [PATCH] Remove old thermistor implementation (#1458) * remove test clt/iat * remove warning since this code is nearly dead * remove old therm impl * tests & live doc * not quite right --- firmware/console/binary/tunerstudio.cpp | 4 - firmware/controllers/algo/engine2.cpp | 12 - firmware/controllers/algo/engine_parts.h | 27 --- firmware/controllers/algo/engine_state.h | 4 - firmware/controllers/can/can_rx.cpp | 6 +- .../generated/thermistor_generated.h | 28 --- firmware/controllers/sensors/allsensors.cpp | 1 - firmware/controllers/sensors/thermistors.cpp | 217 ------------------ firmware/controllers/sensors/thermistors.h | 17 -- firmware/gen_live_documentation.bat | 6 - firmware/integration/rusefi_config.txt | 2 - firmware/integration/thermistor_state.txt | 8 - .../src/com/rusefi/ldmp/StateDictionary.java | 4 +- .../com/rusefi/ui/livedocs/LiveDocPanel.java | 6 - unit_tests/engine_test_helper.cpp | 3 - unit_tests/tests/test_fuelCut.cpp | 1 - unit_tests/tests/test_fuel_map.cpp | 3 - unit_tests/tests/test_sensors.cpp | 29 --- .../test_startOfCrankingPrimingPulse.cpp | 4 - .../tests/trigger/test_trigger_decoder.cpp | 5 - 20 files changed, 3 insertions(+), 384 deletions(-) delete mode 100644 firmware/controllers/generated/thermistor_generated.h delete mode 100644 firmware/integration/thermistor_state.txt diff --git a/firmware/console/binary/tunerstudio.cpp b/firmware/console/binary/tunerstudio.cpp index d8b964694b..b19c417813 100644 --- a/firmware/console/binary/tunerstudio.cpp +++ b/firmware/console/binary/tunerstudio.cpp @@ -274,10 +274,6 @@ static void onlineApplyWorkingCopyBytes(uint32_t offset, int count) { static const void * getStructAddr(int structId) { switch (structId) { - case LDS_CLT_STATE_INDEX: - return static_cast(&engine->engineState.cltCurve); - case LDS_IAT_STATE_INDEX: - return static_cast(&engine->engineState.iatCurve); case LDS_ENGINE_STATE_INDEX: return static_cast(&engine->engineState); case LDS_FUEL_TRIM_STATE_INDEX: diff --git a/firmware/controllers/algo/engine2.cpp b/firmware/controllers/algo/engine2.cpp index b3aedd9c0f..8db251a9f1 100644 --- a/firmware/controllers/algo/engine2.cpp +++ b/firmware/controllers/algo/engine2.cpp @@ -116,18 +116,6 @@ EngineState::EngineState() { void EngineState::updateSlowSensors(DECLARE_ENGINE_PARAMETER_SIGNATURE) { // this feeds rusEfi console Live Data engine->engineState.isCrankingState = ENGINE(rpmCalculator).isCranking(PASS_ENGINE_PARAMETER_SIGNATURE); - - - engine->sensors.iat = getIntakeAirTemperatureM(PASS_ENGINE_PARAMETER_SIGNATURE); -#if !EFI_CANBUS_SLAVE - engine->sensors.clt = getCoolantTemperatureM(PASS_ENGINE_PARAMETER_SIGNATURE); -#endif /* EFI_CANBUS_SLAVE */ - -#if EFI_UNIT_TEST - if (!cisnan(engine->sensors.mockClt)) { - engine->sensors.clt = engine->sensors.mockClt; - } -#endif } void EngineState::periodicFastCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) { diff --git a/firmware/controllers/algo/engine_parts.h b/firmware/controllers/algo/engine_parts.h index a5e6b2728a..462bf1061a 100644 --- a/firmware/controllers/algo/engine_parts.h +++ b/firmware/controllers/algo/engine_parts.h @@ -10,7 +10,6 @@ #include "global.h" #include "engine_configuration_generated_structures.h" #include "cyclic_buffer.h" -#include "thermistor_generated.h" #define MOCK_ADC_SIZE 26 @@ -24,19 +23,6 @@ public: int getMockAdcValue(int hwChannel) const; }; -class ThermistorMath : public thermistor_state_s { -public: - void setConfig(thermistor_conf_s *config); - void prepareThermistorCurve(thermistor_conf_s *tc); - float getKelvinTemperatureByResistance(float resistance) const; - float s_h_a = 0; - float s_h_b = 0; - float s_h_c = 0; - bool isLinear; -private: - thermistor_conf_s currentConfig = {0,0,0,0,0,0,0}; -}; - class Accelerometer { public: float x = 0; // G value @@ -47,19 +33,6 @@ public: class SensorsState { public: SensorsState(); - /** - * Performance optimization: - * log() function needed for thermistor logic is relatively heavy, to avoid it we have these - * pre-calculated values - * Access to these two fields is not synchronized in any way - that should work since float read/write are atomic. - * - * values are in Celsius - */ - float iat = NAN; -#if EFI_UNIT_TEST - float mockClt = NAN; -#endif - float clt = NAN; Accelerometer accelerometer; diff --git a/firmware/controllers/algo/engine_state.h b/firmware/controllers/algo/engine_state.h index 24589e6b95..0d3845da56 100644 --- a/firmware/controllers/algo/engine_state.h +++ b/firmware/controllers/algo/engine_state.h @@ -43,10 +43,6 @@ public: float auxValveStart = 0; float auxValveEnd = 0; - // too much copy-paste here, something should be improved :) - ThermistorMath iatCurve; - ThermistorMath cltCurve; - /** * MAP averaging angle start, in relation to 'mapAveragingSchedulingAtIndex' trigger index index */ diff --git a/firmware/controllers/can/can_rx.cpp b/firmware/controllers/can/can_rx.cpp index b76ff4b9d9..7159868743 100644 --- a/firmware/controllers/can/can_rx.cpp +++ b/firmware/controllers/can/can_rx.cpp @@ -61,13 +61,11 @@ void processCanRxMessage(const CANRxFrame& frame, Logging* logger, efitick_t now // AEM x-series lambda sensor reports in 0.0001 lambda per bit uint16_t lambdaInt = SWAP_UINT16(frame.data16[0]); aemXSeriesLambda = 0.0001f * lambdaInt; +#if EFI_CANBUS_SLAVE } else if (frame.EID == CONFIG(verboseCanBaseAddress) + CAN_SENSOR_1_OFFSET) { int16_t mapScaled = *reinterpret_cast(&frame.data8[0]); canMap = mapScaled / (1.0 * PACK_MULT_PRESSURE); - uint8_t cltShifted = *reinterpret_cast(&frame.data8[2]); -#if EFI_CANBUS_SLAVE - engine->sensors.clt = cltShifted - PACK_ADD_TEMPERATURE; -#endif /* EFI_CANBUS_SLAVE */ +#endif } else { obdOnCanPacketRx(frame); } diff --git a/firmware/controllers/generated/thermistor_generated.h b/firmware/controllers/generated/thermistor_generated.h deleted file mode 100644 index 095c73ec81..0000000000 --- a/firmware/controllers/generated/thermistor_generated.h +++ /dev/null @@ -1,28 +0,0 @@ -// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/thermistor.txt Sat Aug 31 23:11:36 EDT 2019 -// by class com.rusefi.output.CHeaderConsumer -// begin -#ifndef CONTROLLERS_GENERATED_THERMISTOR_GENERATED_H -#define CONTROLLERS_GENERATED_THERMISTOR_GENERATED_H -#include "rusefi_types.h" -// start of thermistor_state_s -struct thermistor_state_s { - /** - * offset 0 - */ - float resistance = (float)0; - /** - * offset 4 - */ - float voltageMCU = (float)0; - /** - * offset 8 - */ - float voltageBoard = (float)0; - /** total size 12*/ -}; - -typedef struct thermistor_state_s thermistor_state_s; - -#endif -// end -// this section was generated automatically by rusEfi tool ConfigDefinition.jar based on integration/thermistor.txt Sat Aug 31 23:11:36 EDT 2019 diff --git a/firmware/controllers/sensors/allsensors.cpp b/firmware/controllers/sensors/allsensors.cpp index aa940e00b6..eeeb8c9f29 100644 --- a/firmware/controllers/sensors/allsensors.cpp +++ b/firmware/controllers/sensors/allsensors.cpp @@ -13,7 +13,6 @@ EXTERN_ENGINE; void initSensors(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) { - initThermistors(sharedLogger PASS_ENGINE_PARAMETER_SUFFIX); initMapDecoder(sharedLogger PASS_ENGINE_PARAMETER_SUFFIX); } diff --git a/firmware/controllers/sensors/thermistors.cpp b/firmware/controllers/sensors/thermistors.cpp index b4c88b583a..b837abb4fb 100644 --- a/firmware/controllers/sensors/thermistors.cpp +++ b/firmware/controllers/sensors/thermistors.cpp @@ -12,195 +12,9 @@ #include "global.h" #include "thermistors.h" -#include "adc_inputs.h" #include "engine_configuration.h" #include "engine_math.h" -#define _5_VOLTS 5.0 - -// Celsius -#define NO_IAT_SENSOR_TEMPERATURE 32.0f -#define LIMPING_MODE_IAT_TEMPERATURE 30.0f -#define LIMPING_MODE_CLT_TEMPERATURE 70.0f -#define NO_CLT_SENSOR_TEMPERATURE 72.0f - -EXTERN_ENGINE; - -static Logging *logger = nullptr; - -/** - * http://en.wikipedia.org/wiki/Voltage_divider - */ -float getR1InVoltageDividor(float Vout, float Vin, float r2) { - return r2 * Vin / Vout - r2; -} - -float getR2InVoltageDividor(float Vout, float Vin, float r1) { - if (Vout == 0) { - return NAN; - } - return r1 / (Vin / Vout - 1); -} - -float getVoutInVoltageDividor(float Vin, float r1, float r2) { - return r2 * Vin / (r1 + r2); -} - -float ThermistorMath::getKelvinTemperatureByResistance(float resistance) const { - if (resistance <= 0) { - //warning("Invalid resistance in getKelvinTemperature=", resistance); - return 0.0f; - } - float logR = logf(resistance); - return 1 / (s_h_a + s_h_b * logR + s_h_c * logR * logR * logR); -} - -float getResistance(ThermistorConf *config, float voltage) { - efiAssert(CUSTOM_ERR_ASSERT, config != NULL, "thermistor config is null", NAN); - thermistor_conf_s *tc = &config->config; - - float resistance = getR2InVoltageDividor(voltage, _5_VOLTS, tc->bias_resistor); - return resistance; -} - -temperature_t getTemperatureC(ThermistorConf *cfg, ThermistorMath *tm, bool useLinear DECLARE_ENGINE_PARAMETER_SUFFIX) { - tm->setConfig(&cfg->config); // implementation checks if configuration has changed or not - - DISPLAY_TEXT(Analog_MCU_reads); - tm->DISPLAY_FIELD(voltageMCU) = DISPLAY_TEXT(from_pin) getVoltage("term", cfg->DISPLAY_CONFIG(adcChannel) PASS_ENGINE_PARAMETER_SUFFIX); - DISPLAY_TEXT(EOL); - - DISPLAY_TEXT(Analog_ECU_reads); -#if EFI_UNIT_TEST -// todo: get rid of this branch, unify unit test with real firmware. maybe analogInputDividerCoefficient needs to be set? - tm->voltageBoard = getVoltageDivided("term", cfg->adcChannel PASS_ENGINE_PARAMETER_SUFFIX); -// CONFIG(analogInputDividerCoefficient) = 1; -// tm-> ISPLAY_FIELD(voltageBoard) = ISPLAY_TEXT(Rdivider) tm->voltageMCU * CONFIG( ISPLAY_CONFIG(analogInputDividerCoefficient)); -#else - tm->DISPLAY_FIELD(voltageBoard) = DISPLAY_TEXT(Rdivider) tm->voltageMCU * CONFIG(DISPLAY_CONFIG(analogInputDividerCoefficient)); -#endif /* EFI_UNIT_TEST */ - DISPLAY_TEXT(EOL); - - if ((tm->isLinear = useLinear)) { - // todo: fix this horrible code! - // should work as a short term fix. - // todo: move 'useLinearXXXSensor' into thermistor configuration record - // yes, we use 'resistance' setting for 'voltage' here - return interpolateMsg("temp", cfg->config.resistance_1, cfg->config.tempC_1, - cfg->config.resistance_2, cfg->config.tempC_2, - tm->voltageBoard); - - } - DISPLAY_TEXT(Measured_resistance); - tm->DISPLAY_FIELD(resistance) = getResistance(cfg, tm->voltageBoard); - - float kelvinTemperature = tm->getKelvinTemperatureByResistance(tm->resistance); - return convertKelvinToCelcius(kelvinTemperature); -} - -static bool isValidCoolantTemperature(temperature_t temperature) { - // I hope magic constants are appropriate here - return !cisnan(temperature) && temperature > -50 && temperature < 250; -} - -static bool isValidIntakeAirTemperature(temperature_t temperature) { - // I hope magic constants are appropriate here - return !cisnan(temperature) && temperature > -50 && temperature < 100; -} - -/** - * @return coolant temperature, in Celsius - */ -temperature_t getCoolantTemperatureM(DECLARE_ENGINE_PARAMETER_SIGNATURE) { - if (engineConfiguration->clt.adcChannel == EFI_ADC_NONE) { - engine->isCltBroken = false; - return NO_CLT_SENSOR_TEMPERATURE; - } - float temperature = getTemperatureC(&engineConfiguration->clt, &engine->engineState.cltCurve, - engineConfiguration->useLinearCltSensor PASS_ENGINE_PARAMETER_SUFFIX); - if (!isValidCoolantTemperature(temperature)) { - efiAssert(CUSTOM_ERR_ASSERT, engineConfiguration!=NULL, "NULL engineConfiguration", NAN); - engine->isCltBroken = true; - return LIMPING_MODE_CLT_TEMPERATURE; - } - engine->isCltBroken = false; - return temperature; -} - -void setThermistorConfiguration(ThermistorConf * thermistor, float tempC1, float r1, float tempC2, float r2, float tempC3, - float r3) { - thermistor_conf_s *tc = &thermistor->config; - tc->tempC_1 = tempC1; - tc->resistance_1 = r1; - - tc->tempC_2 = tempC2; - tc->resistance_2 = r2; - - tc->tempC_3 = tempC3; - tc->resistance_3 = r3; -} - -void ThermistorMath::prepareThermistorCurve(thermistor_conf_s *tc) { - float T1 = tc->tempC_1 + KELV; - float T2 = tc->tempC_2 + KELV; - float T3 = tc->tempC_3 + KELV; -#if EXTREME_TERM_LOGGING - scheduleMsg(logger, "T1=%.5f/T2=%.5f/T3=%.5f", T1, T2, T3); -#endif - - float L1 = logf(tc->resistance_1); - if (L1 == tc->resistance_1) { - /** - * See https://github.com/rusefi/rusefi/issues/375 - * See https://sourceforge.net/p/rusefi/tickets/149/ - */ - firmwareError(CUSTOM_ERR_NATURAL_LOGARITHM_ERROR, "Natural logarithm logf() is broken: %.2f", tc->resistance_1); - } - float L2 = logf(tc->resistance_2); - float L3 = logf(tc->resistance_3); -#if EXTREME_TERM_LOGGING - scheduleMsg(logger, "R1=%.5f/R2=%.5f/R3=%.5f", tc->resistance_1, tc->resistance_2, - tc->resistance_3); - scheduleMsg(logger, "L1=%.5f/L2=%.5f/L3=%.5f", L1, L2, L3); -#endif - - float Y1 = 1 / T1; - float Y2 = 1 / T2; - float Y3 = 1 / T3; - - - float U2 = (Y2 - Y1) / (L2 - L1); - float U3 = (Y3 - Y1) / (L3 - L1); - - - s_h_c = (U3 - U2) / (L3 - L2) * pow(L1 + L2 + L3, -1); - s_h_b = U2 - s_h_c * (L1 * L1 + L1 * L2 + L2 * L2); - s_h_a = Y1 - (s_h_b + L1 * L1 * s_h_c) * L1; - -#if EXTREME_TERM_LOGGING - scheduleMsg(logger, "Y1=%.5f/Y2=%.5f/Y3=%.5f", Y1, Y2, Y3); - scheduleMsg(logger, "U2=%.5f/U3=%.5f", U2, U3); - scheduleMsg(logger, "s_h_c=%.5f/s_h_b=%.5f/s_h_a=%.5f", curve->s_h_c, curve->s_h_b, - curve->s_h_a); -#endif -} - -/** - * @return Celsius value - */ -temperature_t getIntakeAirTemperatureM(DECLARE_ENGINE_PARAMETER_SIGNATURE) { - if (engineConfiguration->iat.adcChannel == EFI_ADC_NONE) { - return NO_IAT_SENSOR_TEMPERATURE; - } - float temperature = getTemperatureC(&engineConfiguration->iat, &engine->engineState.iatCurve, - engineConfiguration->useLinearIatSensor PASS_ENGINE_PARAMETER_SUFFIX); - if (!isValidIntakeAirTemperature(temperature)) { - efiAssert(CUSTOM_ERR_ASSERT, engineConfiguration!=NULL, "NULL engineConfiguration", NAN); - return LIMPING_MODE_IAT_TEMPERATURE; - } - return temperature; -} - void setDodgeSensor(ThermistorConf *thermistorConf, float pullup) { thermistorConf->config = {-40, 30, 120, 336660, 7550, 390, pullup}; } @@ -220,34 +34,3 @@ void set10K_4050K(ThermistorConf *thermistorConf, float pullup) { // see https://www.taydaelectronics.com/datasheets/A-409.pdf thermistorConf->config = {-30, 25, 130, 108000, 10000, 225, pullup}; } - -#if EFI_PROD_CODE -static void testCltByR(float resistance) { - if (logger == nullptr) { - firmwareError(CUSTOM_ERR_THERM, "thermstr not initialized"); - return; - } - - // we expect periodicSlowCallback to already update configuration in the curve helper class see setConfig - float kTemp = engine->engineState.cltCurve.getKelvinTemperatureByResistance(resistance); - scheduleMsg(logger, "for R=%.2f we have %.2f", resistance, (kTemp - KELV)); -} -#endif - -void initThermistors(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) { - logger = sharedLogger; - efiAssertVoid(CUSTOM_NULL_ENGINE_PTR, engine!=NULL, "e NULL initThermistors"); - -#if EFI_PROD_CODE - addConsoleActionF("test_clt_by_r", testCltByR); -#endif -} - -void ThermistorMath::setConfig(thermistor_conf_s *config) { - bool isSameConfig = memcmp(config, ¤tConfig, sizeof(currentConfig)) == 0; - if (isSameConfig) { - return; - } - memcpy(¤tConfig, config, sizeof(currentConfig)); - prepareThermistorCurve(config); -} diff --git a/firmware/controllers/sensors/thermistors.h b/firmware/controllers/sensors/thermistors.h index ee3e1e2c5d..2a553d5f3d 100644 --- a/firmware/controllers/sensors/thermistors.h +++ b/firmware/controllers/sensors/thermistors.h @@ -13,29 +13,12 @@ #include "engine.h" -/** - * Vout=r2/(r1+r2)*Vin - */ -float getR1InVoltageDividor(float Vout, float Vin, float r2); -float getR2InVoltageDividor(float Vout, float Vin, float r1); -float getTempK(float resistance); /** * converts Kelvin temperature into Celsius temperature */ #define convertKelvinToCelcius(tempK) ((tempK) - KELV) #define convertCelsiusToKelvin(tempC) ((tempC) + KELV) -float convertCelciustoF(float tempC); -float convertFtoCelcius(float tempF); - -float getKelvinTemperature(float resistance, ThermistorMath *tm); -float getResistance(ThermistorConf *cfg, float voltage); -temperature_t getTemperatureC(ThermistorConf *cfg, ThermistorMath *tm, bool useLinear DECLARE_ENGINE_PARAMETER_SUFFIX); -temperature_t getCoolantTemperatureM(DECLARE_ENGINE_PARAMETER_SIGNATURE); -temperature_t getIntakeAirTemperatureM(DECLARE_ENGINE_PARAMETER_SIGNATURE); - -void initThermistors(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX); - void setCommonNTCSensor(ThermistorConf *thermistorConf, float pullup); void setDodgeSensor(ThermistorConf *thermistorConf, float pullup); void set10K_4050K(ThermistorConf *thermistorConf, float pullup); diff --git a/firmware/gen_live_documentation.bat b/firmware/gen_live_documentation.bat index 69e286c6d8..5690b4fe36 100644 --- a/firmware/gen_live_documentation.bat +++ b/firmware/gen_live_documentation.bat @@ -14,12 +14,6 @@ java -DSystemOut.name=gen_live_documentation ^ -java_destination ../java_console/models/src/com/rusefi/config/generated/EngineState.java ^ -c_destination controllers/generated/engine_state_generated.h -java -DSystemOut.name=gen_live_documentation ^ - -jar ../java_tools/ConfigDefinition.jar ^ - -definition integration/thermistor_state.txt ^ - -java_destination ../java_console/models/src/com/rusefi/config/generated/ThermistorState.java ^ - -c_destination controllers/generated/thermistor_generated.h - java -DSystemOut.name=gen_live_documentation ^ -jar ../java_tools/ConfigDefinition.jar ^ -definition integration/trigger_central.txt ^ diff --git a/firmware/integration/rusefi_config.txt b/firmware/integration/rusefi_config.txt index f75febd367..55dca19563 100644 --- a/firmware/integration/rusefi_config.txt +++ b/firmware/integration/rusefi_config.txt @@ -1421,8 +1421,6 @@ end_struct ! Live Documentation Structure -#define LDS_CLT_STATE_INDEX 0 -#define LDS_IAT_STATE_INDEX 1 #define LDS_SPEED_DENSITY_STATE_INDEX 2 #define LDS_ENGINE_STATE_INDEX 3 #define LDS_FUEL_TRIM_STATE_INDEX 4 diff --git a/firmware/integration/thermistor_state.txt b/firmware/integration/thermistor_state.txt deleted file mode 100644 index d359a16c56..0000000000 --- a/firmware/integration/thermistor_state.txt +++ /dev/null @@ -1,8 +0,0 @@ - -struct thermistor_state_s - -float resistance -float voltageMCU -float voltageBoard - -end_struct diff --git a/java_console/io/src/com/rusefi/ldmp/StateDictionary.java b/java_console/io/src/com/rusefi/ldmp/StateDictionary.java index 79f317f82d..d9d3888a87 100644 --- a/java_console/io/src/com/rusefi/ldmp/StateDictionary.java +++ b/java_console/io/src/com/rusefi/ldmp/StateDictionary.java @@ -16,9 +16,7 @@ public enum StateDictionary { private Map map = new HashMap<>(); StateDictionary() { - register(Fields.LDS_CLT_STATE_INDEX, ThermistorState.VALUES); // 0 - register(Fields.LDS_IAT_STATE_INDEX, ThermistorState.VALUES); - register(Fields.LDS_SPEED_DENSITY_STATE_INDEX, EngineState.VALUES); + register(Fields.LDS_SPEED_DENSITY_STATE_INDEX, EngineState.VALUES); // 2 register(Fields.LDS_ENGINE_STATE_INDEX, EngineState.VALUES); // 3 register(Fields.LDS_FUEL_TRIM_STATE_INDEX, EngineState.VALUES); register(Fields.LDS_TPS_TPS_ENEICHMENT_STATE_INDEX, EngineState.VALUES); // 5 diff --git a/java_console/ui/src/com/rusefi/ui/livedocs/LiveDocPanel.java b/java_console/ui/src/com/rusefi/ui/livedocs/LiveDocPanel.java index d6de128e46..a2d0932dda 100644 --- a/java_console/ui/src/com/rusefi/ui/livedocs/LiveDocPanel.java +++ b/java_console/ui/src/com/rusefi/ui/livedocs/LiveDocPanel.java @@ -232,12 +232,6 @@ public class LiveDocPanel { public static JPanel createSensorsLiveDataPanel() { JPanel liveDocs = new JPanel(new MigLayout(LAYOUT)); - liveDocs.add(createPanel("Coolant Sensor", ThermistorsMeta.CONTENT, "CLT", Fields.LDS_CLT_STATE_INDEX - ), CONSTRAINTS); - - liveDocs.add(createPanel("Intake Air Sensor", ThermistorsMeta.CONTENT, "IAT", Fields.LDS_IAT_STATE_INDEX - ), CONSTRAINTS); - /* One day we shall have this back liveDocs.add(createPanel("Throttle Position Sensor", TpsMeta.TPS_SECTION), CONSTRAINTS); diff --git a/unit_tests/engine_test_helper.cpp b/unit_tests/engine_test_helper.cpp index 6e42e69f83..ae37ace222 100644 --- a/unit_tests/engine_test_helper.cpp +++ b/unit_tests/engine_test_helper.cpp @@ -249,9 +249,6 @@ void setupSimpleTestEngineWithMaf(EngineTestHelper *eth, injection_mode_e inject // this is needed to update injectorLag engine->updateSlowSensors(PASS_ENGINE_PARAMETER_SIGNATURE); - ASSERT_NEAR( 70, engine->sensors.clt, EPS4D) << "CLT"; - - ASSERT_EQ( 0, isTriggerConfigChanged(PASS_ENGINE_PARAMETER_SIGNATURE)) << "trigger #1"; eth->setTriggerType(trigger PASS_ENGINE_PARAMETER_SUFFIX); } diff --git a/unit_tests/tests/test_fuelCut.cpp b/unit_tests/tests/test_fuelCut.cpp index 9df1d37ca9..b93adc842f 100644 --- a/unit_tests/tests/test_fuelCut.cpp +++ b/unit_tests/tests/test_fuelCut.cpp @@ -113,7 +113,6 @@ TEST(fuelCut, criticalEngineTemperature) { ASSERT_FALSE(engine->stopEngineRequestTimeNt > 0); - engine->sensors.mockClt = 200; // 200C is really hot! Sensor::setMockValue(SensorType::Clt, 200); eth.engine.periodicFastCallback(PASS_ENGINE_PARAMETER_SIGNATURE); eth.engine.periodicSlowCallback(PASS_ENGINE_PARAMETER_SIGNATURE); diff --git a/unit_tests/tests/test_fuel_map.cpp b/unit_tests/tests/test_fuel_map.cpp index 872bf7a64d..e602473ecf 100644 --- a/unit_tests/tests/test_fuel_map.cpp +++ b/unit_tests/tests/test_fuel_map.cpp @@ -47,9 +47,6 @@ TEST(misc, testFuelMap) { ASSERT_EQ( 1005, getBaseTableFuel(5, 5)) << "base fuel table"; - printf("*************************************************** initThermistors\r\n"); - - printf("*** getInjectorLag\r\n"); // engine->engineState.vb assertEqualsM("lag", 1.04, getInjectorLag(12 PASS_ENGINE_PARAMETER_SUFFIX)); diff --git a/unit_tests/tests/test_sensors.cpp b/unit_tests/tests/test_sensors.cpp index 1689c962fc..b50b65387c 100644 --- a/unit_tests/tests/test_sensors.cpp +++ b/unit_tests/tests/test_sensors.cpp @@ -23,32 +23,3 @@ TEST(sensors, mapDecoding) { ASSERT_EQ( 8, decodePressure(0, &s PASS_ENGINE_PARAMETER_SUFFIX)) << "MPX_4250 0 volts"; ASSERT_FLOAT_EQ(58.4, decodePressure(1, &s PASS_ENGINE_PARAMETER_SUFFIX)); } - -TEST(sensors, Thermistor1) { - - ThermistorMath tm; - thermistor_conf_s tc = {32, 75, 120, 9500, 2100, 1000, 0}; - tm.setConfig(&tc); - - float t = tm.getKelvinTemperatureByResistance(2100); - ASSERT_FLOAT_EQ(75 + KELV, t); - - ASSERT_NEAR(-0.003, tm.s_h_a, EPS4D); - ASSERT_NEAR(0.001, tm.s_h_b, EPS4D); - ASSERT_NEAR(0.0, tm.s_h_c, EPS5D); -} - -TEST(sensors, ThermistorNeon) -{ - ThermistorMath tm; - // 2003 Neon sensor - thermistor_conf_s tc = {0, 30, 100, 32500, 7550, 700, 0}; - tm.setConfig(&tc); - - float t = tm.getKelvinTemperatureByResistance(38000); - ASSERT_NEAR(-2.7983, t - KELV, EPS4D); - - assertEqualsM("A", 0.0009, tm.s_h_a); - assertEqualsM("B", 0.0003, tm.s_h_b); - ASSERT_NEAR(0.0, tm.s_h_c, EPS4D); -} diff --git a/unit_tests/tests/test_startOfCrankingPrimingPulse.cpp b/unit_tests/tests/test_startOfCrankingPrimingPulse.cpp index a13a96d6e4..b07688d261 100644 --- a/unit_tests/tests/test_startOfCrankingPrimingPulse.cpp +++ b/unit_tests/tests/test_startOfCrankingPrimingPulse.cpp @@ -37,11 +37,7 @@ TEST(engine, testStartOfCrankingPrimingPulse) { ASSERT_EQ( 0, GET_RPM()) << "RPM=0"; - // this -70 value comes from CLT error handling code - ASSERT_NEAR( 70, engine->sensors.clt, EPS4D) << "CLT#1"; - // we need below freezing temperature to get prime fuel - engine->sensors.clt = -10; Sensor::setMockValue(SensorType::Clt, -10); // prod code invokes this on ECU start, here we have to mimic this behavior diff --git a/unit_tests/tests/trigger/test_trigger_decoder.cpp b/unit_tests/tests/trigger/test_trigger_decoder.cpp index da2ac59637..8ccef8dc43 100644 --- a/unit_tests/tests/trigger/test_trigger_decoder.cpp +++ b/unit_tests/tests/trigger/test_trigger_decoder.cpp @@ -312,8 +312,6 @@ TEST(misc, testRpmCalculator) { setFlatInjectorLag(0 PASS_CONFIG_PARAMETER_SUFFIX); engine->updateSlowSensors(PASS_ENGINE_PARAMETER_SIGNATURE); - engine->sensors.clt = 70; // 'testCltValue' does not give us exact number so we have to hack here. todo: migrate test - engine->sensors.iat = 30; // 'testIatValue' does not give us exact number so we have to hack here. todo: migrate test ASSERT_EQ(0, GET_RPM()); @@ -582,7 +580,6 @@ static void setTestBug299(EngineTestHelper *eth) { eth->assertRpm(0, "RPM=0"); ASSERT_EQ( 0, getEngineLoadT(PASS_ENGINE_PARAMETER_SIGNATURE)) << "setTestBug299 EL"; - ASSERT_NEAR( 30, engine->sensors.iat, EPS4D) << "setTestBug299 IAT"; eth->fireTriggerEventsWithDuration(20); // still no RPM since need to cycles measure cycle duration eth->assertRpm(0, "setTestBug299: RPM#1"); @@ -1119,8 +1116,6 @@ TEST(big, testSparkReverseOrderBug319) { // this is needed to update injectorLag engine->updateSlowSensors(PASS_ENGINE_PARAMETER_SIGNATURE); - ASSERT_NEAR( 70, engine->sensors.clt, EPS4D) << "CLT"; - eth.setTriggerType(TT_ONE PASS_ENGINE_PARAMETER_SUFFIX); eth.engine.periodicFastCallback(PASS_ENGINE_PARAMETER_SIGNATURE);