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
This commit is contained in:
parent
3a7c6f242b
commit
105460dada
|
@ -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<thermistor_state_s*>(&engine->engineState.cltCurve);
|
||||
case LDS_IAT_STATE_INDEX:
|
||||
return static_cast<thermistor_state_s*>(&engine->engineState.iatCurve);
|
||||
case LDS_ENGINE_STATE_INDEX:
|
||||
return static_cast<engine_state2_s*>(&engine->engineState);
|
||||
case LDS_FUEL_TRIM_STATE_INDEX:
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
|
|
@ -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<const int16_t*>(&frame.data8[0]);
|
||||
canMap = mapScaled / (1.0 * PACK_MULT_PRESSURE);
|
||||
uint8_t cltShifted = *reinterpret_cast<const uint8_t*>(&frame.data8[2]);
|
||||
#if EFI_CANBUS_SLAVE
|
||||
engine->sensors.clt = cltShifted - PACK_ADD_TEMPERATURE;
|
||||
#endif /* EFI_CANBUS_SLAVE */
|
||||
#endif
|
||||
} else {
|
||||
obdOnCanPacketRx(frame);
|
||||
}
|
||||
|
|
|
@ -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
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 ^
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
|
||||
struct thermistor_state_s
|
||||
|
||||
float resistance
|
||||
float voltageMCU
|
||||
float voltageBoard
|
||||
|
||||
end_struct
|
|
@ -16,9 +16,7 @@ public enum StateDictionary {
|
|||
private Map<Integer, Field[]> 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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue