more detailed warning
This commit is contained in:
parent
9158dc22f2
commit
e3dfcc4df9
|
@ -215,7 +215,7 @@ float getAdvanceForRpm(int rpm, float advanceMax) {
|
||||||
return advanceMax;
|
return advanceMax;
|
||||||
if (rpm < 600)
|
if (rpm < 600)
|
||||||
return 10;
|
return 10;
|
||||||
return interpolate(600, 10, 3000, advanceMax, rpm);
|
return interpolateMsg("advance", 600, 10, 3000, advanceMax, rpm);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define round10(x) efiRound(x, 0.1)
|
#define round10(x) efiRound(x, 0.1)
|
||||||
|
|
|
@ -73,7 +73,7 @@ void Engine::updateSlowSensors(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
// todo: move this logic somewhere to sensors folder?
|
// todo: move this logic somewhere to sensors folder?
|
||||||
if (engineConfiguration->fuelLevelSensor != EFI_ADC_NONE) {
|
if (engineConfiguration->fuelLevelSensor != EFI_ADC_NONE) {
|
||||||
float fuelLevelVoltage = getVoltageDivided("fuel", engineConfiguration->fuelLevelSensor);
|
float fuelLevelVoltage = getVoltageDivided("fuel", engineConfiguration->fuelLevelSensor);
|
||||||
sensors.fuelTankGauge = interpolate(boardConfiguration->fuelLevelEmptyTankVoltage, 0,
|
sensors.fuelTankGauge = interpolateMsg("fgauge", boardConfiguration->fuelLevelEmptyTankVoltage, 0,
|
||||||
boardConfiguration->fuelLevelFullTankVoltage, 100,
|
boardConfiguration->fuelLevelFullTankVoltage, 100,
|
||||||
fuelLevelVoltage);
|
fuelLevelVoltage);
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,7 +100,7 @@ float FastInterpolation::getValue(float x) {
|
||||||
* @param y2 value of the second point
|
* @param y2 value of the second point
|
||||||
* @param X key to be interpolated
|
* @param X key to be interpolated
|
||||||
*
|
*
|
||||||
* @note For example, "interpolate(engineConfiguration.tpsMin, 0, engineConfiguration.tpsMax, 100, adc);"
|
* @note For example, "interpolateMsg("", engineConfiguration.tpsMin, 0, engineConfiguration.tpsMax, 100, adc);"
|
||||||
*/
|
*/
|
||||||
float interpolateMsg(const char *msg, float x1, float y1, float x2, float y2, float x) {
|
float interpolateMsg(const char *msg, float x1, float y1, float x2, float y2, float x) {
|
||||||
// todo: double comparison using EPS
|
// todo: double comparison using EPS
|
||||||
|
@ -125,10 +125,6 @@ float interpolateMsg(const char *msg, float x1, float y1, float x2, float y2, fl
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
float interpolate(float x1, float y1, float x2, float y2, float x) {
|
|
||||||
return interpolateMsg("", x1, y1, x2, y2, x);
|
|
||||||
}
|
|
||||||
|
|
||||||
float interpolateClamped(float x1, float y1, float x2, float y2, float x) {
|
float interpolateClamped(float x1, float y1, float x2, float y2, float x) {
|
||||||
if (x <= x1)
|
if (x <= x1)
|
||||||
return y1;
|
return y1;
|
||||||
|
|
|
@ -24,7 +24,6 @@ int findIndex(const float array[], int size, float value);
|
||||||
int findIndexMsg(const char *msg, const float array[], int size, float value);
|
int findIndexMsg(const char *msg, const float array[], int size, float value);
|
||||||
void ensureArrayIsAscending(const char *msg, const float array[], int size);
|
void ensureArrayIsAscending(const char *msg, const float array[], int size);
|
||||||
int findIndex2(const float array[], unsigned size, float value);
|
int findIndex2(const float array[], unsigned size, float value);
|
||||||
float interpolate(float x1, float y1, float x2, float y2, float x);
|
|
||||||
float interpolateClamped(float x1, float y1, float x2, float y2, float x);
|
float interpolateClamped(float x1, float y1, float x2, float y2, float x);
|
||||||
float interpolateMsg(const char *msg, float x1, float y1, float x2, float y2, float x);
|
float interpolateMsg(const char *msg, float x1, float y1, float x2, float y2, float x);
|
||||||
float interpolate2d(const char *msg, float value, float bin[], float values[], int size);
|
float interpolate2d(const char *msg, float value, float bin[], float values[], int size);
|
||||||
|
@ -119,7 +118,7 @@ float interpolate3d(float x, float xBin[], int xBinSize, float y, float yBin[],
|
||||||
float rpmMinKeyMinValue = map[xIndex][yIndex];
|
float rpmMinKeyMinValue = map[xIndex][yIndex];
|
||||||
float rpmMaxKeyMinValue = map[xIndex + 1][yIndex];
|
float rpmMaxKeyMinValue = map[xIndex + 1][yIndex];
|
||||||
|
|
||||||
float keyMinValue = interpolate(xMin, rpmMinKeyMinValue, xMax, rpmMaxKeyMinValue, x);
|
float keyMinValue = interpolateMsg("", xMin, rpmMinKeyMinValue, xMax, rpmMaxKeyMinValue, x);
|
||||||
|
|
||||||
#if DEBUG_INTERPOLATION
|
#if DEBUG_INTERPOLATION
|
||||||
if (needInterpolationLogging()) {
|
if (needInterpolationLogging()) {
|
||||||
|
|
|
@ -733,5 +733,5 @@ int getRusEfiVersion(void) {
|
||||||
if (initBootloader() != 0)
|
if (initBootloader() != 0)
|
||||||
return 123;
|
return 123;
|
||||||
#endif /* EFI_BOOTLOADER_INCLUDE_CODE */
|
#endif /* EFI_BOOTLOADER_INCLUDE_CODE */
|
||||||
return 20180531;
|
return 20180612;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,12 +32,12 @@ float getTCharge(int rpm, float tps, float coolantTemp, float airTemp DECLARE_EN
|
||||||
warning(CUSTOM_ERR_6147, "t-getTCharge NaN");
|
warning(CUSTOM_ERR_6147, "t-getTCharge NaN");
|
||||||
return coolantTemp;
|
return coolantTemp;
|
||||||
}
|
}
|
||||||
float minRpmKcurrentTPS = interpolate(tpMin, engineConfiguration->tChargeMinRpmMinTps, tpMax,
|
float minRpmKcurrentTPS = interpolateMsg("minRpm", tpMin, engineConfiguration->tChargeMinRpmMinTps, tpMax,
|
||||||
engineConfiguration->tChargeMinRpmMaxTps, tps);
|
engineConfiguration->tChargeMinRpmMaxTps, tps);
|
||||||
float maxRpmKcurrentTPS = interpolate(tpMin, engineConfiguration->tChargeMaxRpmMinTps, tpMax,
|
float maxRpmKcurrentTPS = interpolateMsg("maxRpm", tpMin, engineConfiguration->tChargeMaxRpmMinTps, tpMax,
|
||||||
engineConfiguration->tChargeMaxRpmMaxTps, tps);
|
engineConfiguration->tChargeMaxRpmMaxTps, tps);
|
||||||
|
|
||||||
float Tcharge_coff = interpolate(rpmMin, minRpmKcurrentTPS, rpmMax, maxRpmKcurrentTPS, rpm);
|
float Tcharge_coff = interpolateMsg("Kcurr", rpmMin, minRpmKcurrentTPS, rpmMax, maxRpmKcurrentTPS, rpm);
|
||||||
if (cisnan(Tcharge_coff)) {
|
if (cisnan(Tcharge_coff)) {
|
||||||
warning(CUSTOM_ERR_6148, "t2-getTCharge NaN");
|
warning(CUSTOM_ERR_6148, "t2-getTCharge NaN");
|
||||||
return coolantTemp;
|
return coolantTemp;
|
||||||
|
|
|
@ -121,7 +121,7 @@ float getAfr(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
return interpolate(sensor->v1, sensor->value1, sensor->v2, sensor->value2, volts)
|
return interpolateMsg("AFR", sensor->v1, sensor->value1, sensor->v2, sensor->value2, volts)
|
||||||
+ engineConfiguration->egoValueShift;
|
+ engineConfiguration->egoValueShift;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,7 @@ float decodePressure(float voltage, air_pressure_sensor_config_s * mapConfig DEC
|
||||||
switch (mapConfig->type) {
|
switch (mapConfig->type) {
|
||||||
case MT_CUSTOM:
|
case MT_CUSTOM:
|
||||||
// todo: migrate to 'FastInterpolation customMap'
|
// todo: migrate to 'FastInterpolation customMap'
|
||||||
return interpolate(engineConfiguration->mapLowValueVoltage, mapConfig->lowValue,
|
return interpolateMsg("map", engineConfiguration->mapLowValueVoltage, mapConfig->lowValue,
|
||||||
engineConfiguration->mapHighValueVoltage, mapConfig->highValue, voltage);
|
engineConfiguration->mapHighValueVoltage, mapConfig->highValue, voltage);
|
||||||
case MT_DENSO183:
|
case MT_DENSO183:
|
||||||
case MT_MPX4250:
|
case MT_MPX4250:
|
||||||
|
@ -146,7 +146,7 @@ float getMapByVoltage(float voltage DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||||
*/
|
*/
|
||||||
float getRawMap(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
float getRawMap(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
if (engineConfiguration->hasFrequencyReportingMapSensor) {
|
if (engineConfiguration->hasFrequencyReportingMapSensor) {
|
||||||
return interpolate(boardConfiguration->mapFrequency0Kpa, 0, boardConfiguration->mapFrequency100Kpa, 100, mapFreq);
|
return interpolateMsg("rmap", boardConfiguration->mapFrequency0Kpa, 0, boardConfiguration->mapFrequency100Kpa, 100, mapFreq);
|
||||||
}
|
}
|
||||||
|
|
||||||
float voltage = getVoltageDivided("map", engineConfiguration->map.sensor.hwChannel);
|
float voltage = getVoltageDivided("map", engineConfiguration->map.sensor.hwChannel);
|
||||||
|
|
|
@ -23,5 +23,5 @@ float getOilPressure(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
|
|
||||||
float volts = getVoltageDivided("oilp", sensor->hwChannel);
|
float volts = getVoltageDivided("oilp", sensor->hwChannel);
|
||||||
|
|
||||||
return interpolate(sensor->v1, sensor->value1, sensor->v2, sensor->value2, volts);
|
return interpolateMsg("oil", sensor->v1, sensor->value1, sensor->v2, sensor->value2, volts);
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,7 +86,7 @@ float getTemperatureC(ThermistorConf *config, ThermistorMath *tm, bool useLinear
|
||||||
// should work as a short term fix.
|
// should work as a short term fix.
|
||||||
// todo: move 'useLinearXXXSensor' into termistor configuration record
|
// todo: move 'useLinearXXXSensor' into termistor configuration record
|
||||||
// yes, we use 'resistance' setting for 'voltage' here
|
// yes, we use 'resistance' setting for 'voltage' here
|
||||||
return interpolate(config->config.resistance_1, config->config.tempC_1,
|
return interpolateMsg("temp", config->config.resistance_1, config->config.tempC_1,
|
||||||
config->config.resistance_2, config->config.tempC_2,
|
config->config.resistance_2, config->config.tempC_2,
|
||||||
voltage);
|
voltage);
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,7 @@ percent_t getTpsValue(int adc DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||||
warning(CUSTOM_INVALID_TPS_SETTING, "Invalid TPS configuration: same value %d", engineConfiguration->tpsMin);
|
warning(CUSTOM_INVALID_TPS_SETTING, "Invalid TPS configuration: same value %d", engineConfiguration->tpsMin);
|
||||||
return NAN;
|
return NAN;
|
||||||
}
|
}
|
||||||
float result = interpolate(TPS_TS_CONVERSION * engineConfiguration->tpsMax, 100, TPS_TS_CONVERSION * engineConfiguration->tpsMin, 0, adc);
|
float result = interpolateMsg("TPS", TPS_TS_CONVERSION * engineConfiguration->tpsMax, 100, TPS_TS_CONVERSION * engineConfiguration->tpsMin, 0, adc);
|
||||||
if (result < engineConfiguration->tpsErrorDetectionTooLow) {
|
if (result < engineConfiguration->tpsErrorDetectionTooLow) {
|
||||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
||||||
// too much noise with simulator
|
// too much noise with simulator
|
||||||
|
@ -142,7 +142,7 @@ percent_t getPedalPosition(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
return mockPedalPosition;
|
return mockPedalPosition;
|
||||||
}
|
}
|
||||||
float voltage = getVoltageDivided("pPS", engineConfiguration->pedalPositionChannel);
|
float voltage = getVoltageDivided("pPS", engineConfiguration->pedalPositionChannel);
|
||||||
float result = interpolate(engineConfiguration->throttlePedalUpVoltage, 0, engineConfiguration->throttlePedalWOTVoltage, 100, voltage);
|
float result = interpolateMsg("pedal", engineConfiguration->throttlePedalUpVoltage, 0, engineConfiguration->throttlePedalWOTVoltage, 100, voltage);
|
||||||
|
|
||||||
// this would put the value into the 0-100 range
|
// this would put the value into the 0-100 range
|
||||||
return maxF(0, minF(100, result));
|
return maxF(0, minF(100, result));
|
||||||
|
|
Loading…
Reference in New Issue