This commit is contained in:
rusefi 2020-05-19 08:33:18 -04:00
commit 6a762017c2
10 changed files with 146 additions and 81 deletions

View File

@ -26,6 +26,8 @@ enum class TsCalMode : uint8_t {
EtbKp = 3,
EtbKi = 4,
EtbKd = 5,
Tps1SecondaryMax = 6,
Tps1SecondaryMin = 7,
};
/**

View File

@ -1006,7 +1006,8 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_
tsOutputChannels->debugFloatField7 = (engineConfiguration->afr.hwChannel != EFI_ADC_NONE) ? getVoltageDivided("ego", engineConfiguration->afr.hwChannel PASS_ENGINE_PARAMETER_SUFFIX) : 0.0f;
break;
case DBG_ANALOG_INPUTS2:
tsOutputChannels->debugFloatField4 = getVoltage("debug", engineConfiguration->throttlePedalPositionAdcChannel PASS_ENGINE_PARAMETER_SUFFIX);
tsOutputChannels->debugFloatField1 = Sensor::get(SensorType::Tps1Primary).value_or(0) - Sensor::get(SensorType::Tps1Secondary).value_or(0);
tsOutputChannels->debugFloatField2 = Sensor::get(SensorType::Tps2Primary).value_or(0) - Sensor::get(SensorType::Tps2Secondary).value_or(0);
break;
case DBG_INSTANT_RPM:
{

View File

@ -105,6 +105,20 @@ static SensorType indexToTpsSensor(size_t index) {
}
}
static SensorType indexToTpsSensorPrimary(size_t index) {
switch(index) {
case 0: return SensorType::Tps1Primary;
default: return SensorType::Tps2Primary;
}
}
static SensorType indexToTpsSensorSecondary(size_t index) {
switch(index) {
case 0: return SensorType::Tps1Secondary;
default: return SensorType::Tps2Secondary;
}
}
static percent_t directPwmValue = NAN;
static percent_t currentEtbDuty;
@ -449,8 +463,8 @@ struct EtbImpl final : public EtbController, public PeriodicController<512> {
motor->set(0.5f);
motor->enable();
chThdSleepMilliseconds(1000);
tsOutputChannels.calibrationMode = TsCalMode::Tps1Max;
tsOutputChannels.calibrationValue = Sensor::getRaw(indexToTpsSensor(myIndex)) * TPS_TS_CONVERSION;
float primaryMax = Sensor::getRaw(indexToTpsSensorPrimary(myIndex)) * TPS_TS_CONVERSION;
float secondaryMax = Sensor::getRaw(indexToTpsSensorSecondary(myIndex)) * TPS_TS_CONVERSION;
// Let it return
motor->set(0);
@ -459,14 +473,27 @@ struct EtbImpl final : public EtbController, public PeriodicController<512> {
// Now grab closed
motor->set(-0.5f);
chThdSleepMilliseconds(1000);
tsOutputChannels.calibrationMode = TsCalMode::Tps1Min;
tsOutputChannels.calibrationValue = Sensor::getRaw(indexToTpsSensor(myIndex)) * TPS_TS_CONVERSION;
float primaryMin = Sensor::getRaw(indexToTpsSensorPrimary(myIndex)) * TPS_TS_CONVERSION;
float secondaryMin = Sensor::getRaw(indexToTpsSensorSecondary(myIndex)) * TPS_TS_CONVERSION;
// Finally disable and reset state
motor->disable();
// Wait to let TS grab the state before we leave cal mode
// Write out the learned values to TS, waiting briefly after setting each to let TS grab it
tsOutputChannels.calibrationMode = TsCalMode::Tps1Max;
tsOutputChannels.calibrationValue = primaryMax;
chThdSleepMilliseconds(500);
tsOutputChannels.calibrationMode = TsCalMode::Tps1Min;
tsOutputChannels.calibrationValue = primaryMin;
chThdSleepMilliseconds(500);
tsOutputChannels.calibrationMode = TsCalMode::Tps1SecondaryMax;
tsOutputChannels.calibrationValue = secondaryMax;
chThdSleepMilliseconds(500);
tsOutputChannels.calibrationMode = TsCalMode::Tps1SecondaryMin;
tsOutputChannels.calibrationValue = secondaryMin;
chThdSleepMilliseconds(500);
tsOutputChannels.calibrationMode = TsCalMode::None;
m_isAutocal = false;

View File

@ -312,6 +312,7 @@ void prepareVoidConfiguration(engine_configuration_s *engineConfiguration) {
engineConfiguration->auxTempSensor2.adcChannel = EFI_ADC_NONE;
engineConfiguration->baroSensor.hwChannel = EFI_ADC_NONE;
engineConfiguration->throttlePedalPositionAdcChannel = EFI_ADC_NONE;
engineConfiguration->throttlePedalPositionSecondAdcChannel = EFI_ADC_NONE;
engineConfiguration->oilPressure.hwChannel = EFI_ADC_NONE;
engineConfiguration->vRefAdcChannel = EFI_ADC_NONE;
engineConfiguration->vbattAdcChannel = EFI_ADC_NONE;

View File

@ -696,7 +696,7 @@ void initEngineContoller(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX)
* UNUSED_SIZE contants.
*/
#ifndef RAM_UNUSED_SIZE
#define RAM_UNUSED_SIZE 10000
#define RAM_UNUSED_SIZE 9800
#endif
#ifndef CCM_UNUSED_SIZE
#define CCM_UNUSED_SIZE 2900

View File

@ -3,6 +3,7 @@
#include "error_handling.h"
#include "global.h"
#include "functional_sensor.h"
#include "redundant_sensor.h"
#include "proxy_sensor.h"
#include "linear_func.h"
#include "tps.h"
@ -10,14 +11,17 @@
EXTERN_ENGINE;
LinearFunc tpsFunc1p(TPS_TS_CONVERSION);
//LinearFunc tpsFunc1s(TPS_TS_CONVERSION);
LinearFunc tpsFunc1s(TPS_TS_CONVERSION);
LinearFunc tpsFunc2p(TPS_TS_CONVERSION);
//LinearFunc tpsFunc2s(TPS_TS_CONVERSION);
LinearFunc tpsFunc2s(TPS_TS_CONVERSION);
FunctionalSensor tpsSens1p(SensorType::Tps1, MS2NT(10));
//FunctionalSensor tpsSens1s(SensorType::Tps1Secondary, MS2NT(10));
FunctionalSensor tpsSens2p(SensorType::Tps2, MS2NT(10));
//FunctionalSensor tpsSens2s(SensorType::Tps2Secondary, MS2NT(10));
FunctionalSensor tpsSens1p(SensorType::Tps1Primary, MS2NT(10));
FunctionalSensor tpsSens1s(SensorType::Tps1Secondary, MS2NT(10));
FunctionalSensor tpsSens2p(SensorType::Tps2Primary, MS2NT(10));
FunctionalSensor tpsSens2s(SensorType::Tps2Secondary, MS2NT(10));
RedundantSensor tps1(SensorType::Tps1, SensorType::Tps1Primary, SensorType::Tps1Secondary);
RedundantSensor tps2(SensorType::Tps2, SensorType::Tps2Primary, SensorType::Tps2Secondary);
LinearFunc pedalFunc;
FunctionalSensor pedalSensor(SensorType::AcceleratorPedal, MS2NT(10));
@ -33,10 +37,10 @@ static void configureTps(LinearFunc& func, float closed, float open, float min,
);
}
static void initTpsFunc(LinearFunc& func, FunctionalSensor& sensor, adc_channel_e channel, float closed, float open, float min, float max) {
static bool initTpsFunc(LinearFunc& func, FunctionalSensor& sensor, adc_channel_e channel, float closed, float open, float min, float max) {
// Only register if we have a sensor
if (channel == EFI_ADC_NONE) {
return;
return false;
}
configureTps(func, closed, open, min, max);
@ -47,6 +51,19 @@ static void initTpsFunc(LinearFunc& func, FunctionalSensor& sensor, adc_channel_
if (!sensor.Register()) {
firmwareError(CUSTOM_INVALID_TPS_SETTING, "Duplicate registration for sensor \"%s\"", sensor.getSensorName());
return false;
}
return true;
}
static void initTpsFuncAndRedund(RedundantSensor& redund, LinearFunc& func, FunctionalSensor& sensor, adc_channel_e channel, float closed, float open, float min, float max) {
bool hasSecond = initTpsFunc(func, sensor, channel, closed, open, min, max);
redund.configure(5.0f, !hasSecond);
if (!redund.Register()) {
firmwareError(CUSTOM_INVALID_TPS_SETTING, "Duplicate registration for sensor \"%s\"", redund.getSensorName());
}
}
@ -55,7 +72,9 @@ void initTps(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
float max = CONFIG(tpsErrorDetectionTooHigh);
initTpsFunc(tpsFunc1p, tpsSens1p, CONFIG(tps1_1AdcChannel), CONFIG(tpsMin), CONFIG(tpsMax), min, max);
initTpsFuncAndRedund(tps1, tpsFunc1s, tpsSens1s, CONFIG(tps1_2AdcChannel), CONFIG(tps1SecondaryMin), CONFIG(tps1SecondaryMax), min, max);
initTpsFunc(tpsFunc2p, tpsSens2p, CONFIG(tps2_1AdcChannel), CONFIG(tps2Min), CONFIG(tps2Max), min, max);
initTpsFuncAndRedund(tps2, tpsFunc2s, tpsSens2s, CONFIG(tps2_2AdcChannel), CONFIG(tps2SecondaryMin), CONFIG(tps2SecondaryMax), min, max);
initTpsFunc(pedalFunc, pedalSensor, CONFIG(throttlePedalPositionAdcChannel), CONFIG(throttlePedalUpVoltage), CONFIG(throttlePedalWOTVoltage), min, max);
// Route the pedal or TPS to driverIntent as appropriate
@ -75,6 +94,9 @@ void reconfigureTps(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
float max = CONFIG(tpsErrorDetectionTooHigh);
configureTps(tpsFunc1p, CONFIG(tpsMin), CONFIG(tpsMax), min, max);
configureTps(tpsFunc1s, CONFIG(tps1SecondaryMin), CONFIG(tps1SecondaryMax), min, max);
configureTps(tpsFunc2p, CONFIG(tps2Min), CONFIG(tps2Max), min, max);
configureTps(tpsFunc2s, CONFIG(tps2SecondaryMin), CONFIG(tps2SecondaryMax), min, max);
configureTps(pedalFunc, CONFIG(throttlePedalUpVoltage), CONFIG(throttlePedalWOTVoltage), min, max);
}

View File

@ -167,6 +167,7 @@ struct_no_prefix engine_configuration_s
#define TPS_TPS_ACCEL_TABLE 8
#define MAP_ACCEL_TAPER 8
#define ADC_CHANNEL_NONE 16
#define BARO_CORR_SIZE 4

View File

@ -389,21 +389,21 @@ enable2ndByteCanID = false
; wall of debug mode :)
; https://rusefi.com/wiki/index.php?title=Manual:Debug_fields
; 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
; Alternator TPS Acceleration Warmup-Pid Idle Engine Load Acc Trigger Counters VVT Cranking Ignition Timing ETB PID CJ125 CAN TLE8888 Boost Start Launcher ETB Autotune
debugFieldF1List = bits, U08, [0:7], "Controller Output", "From TPS", "", "Controller Output", "Idle output", "Channel 1 Rise Counter", "", "", "VVT Event Position","", "Ign IAT Corr", "", "", "", "", "", "", "ETB Controller Output", "", "", "df1", "df1", "22df1", "", "23:df1", "CJ125: output", "", "", "", "", "", "", "", "", "", "", "Boost Open Loop Duty", "S unused" "", "Osc Amplitude"
debugFieldF2List = bits, U08, [0:7], "I-Term", "To TPS", "", "I-Term", "Idle df2", "Channel 2 Rise Counter", "", "", "VVT Ratio", "", "Ign CLT Corr", "", "", "", "", "", "", "ETB I-Term", "", "", "df2", "df2", "22df2", "", "23:df2", "CJ125: i-term", "", "", "", "", "", "", "", "", "", "", "Boost Closed Loop Duty","S unused" "", "Duty Amplitude"
debugFieldF3List = bits, U08, [0:7], "Previous Error", "Current TPS<>TPS", "", "", "Idle df3", "ICU sum", "", "", "", "", "Ign FSIO Adj", "", "", "", "", "", "", "ETB err", "", "", "df3", "df3", "22df3", "", "23:df3", "CJ125: err", "", "", "", "", "", "", "", "", "", "", "", "S unused" "", "Tu"
debugFieldF4List = bits, U08, [0:7], "I Gain", "Extra Fuel", "", "", "Idle df4", "VVT rise", "", "", "", "", "Ign PID Adj", "", "", "", "", "", "", "ETB I setting", "", "", "df4", "df4", "22df4", "", "23:df4", "CJ125: UA", "", "", "", "", "", "", "", "", "", "", "", "S unused" "", "Ku"
debugFieldF5List = bits, U08, [0:7], "D Gain", "df5", "df5", "df5", "Idle df5", "VVT fall", "df5", "", "", "", "", "", "", "", "", "", "", "ETB D setting", "df5", "df5", "df5", "df5", "22df5", "", "23:df5", "CJ125: UR", "", "", "", "", "", "", "", "", "", "", "", "S unused" "", "Kp"
debugFieldF6List = bits, U08, [0:7], "D Term", "", "", "", "Idle df6", "Current Gap", "", "", "", "", "", "", "", "", "", "", "", "ETB df6", "", "", "df6", "df6", "22df6", "", "23:df6", "cj: f7", "", "", "", "", "", "", "", "", "", "", "", "S unused" "", "Ki"
debugFieldF7List = bits, U08, [0:7], "Max-Value", "", "", "", "Idle df7", "", "", "", "", "", "", "", "", "", "", "", "", "ETB df7", "", "", "df7", "df7", "22df7", "", "23:df7", "cj: f7", "", "", "", "", "", "", "", "", "", "", "", "S unused" "", "Kd"
; 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
; Alternator TPS Acceleration Warmup-Pid Idle Engine Load Acc Trigger Counters VVT Cranking Ignition Timing ETB PID CJ125 CAN TLE8888 Analog inputs 2 Boost Start Launcher ETB Autotune
debugFieldF1List = bits, U08, [0:7], "Controller Output", "From TPS", "", "Controller Output", "Idle output", "Channel 1 Rise Counter", "", "", "VVT Event Position","", "Ign IAT Corr", "", "", "", "", "", "", "ETB Controller Output", "", "", "df1", "df1", "22df1", "", "23:df1", "CJ125: output", "", "", "", "", "", "", "TPS1 Pri/Sec Diff", "", "", "", "Boost Open Loop Duty", "S unused" "", "Osc Amplitude"
debugFieldF2List = bits, U08, [0:7], "I-Term", "To TPS", "", "I-Term", "Idle df2", "Channel 2 Rise Counter", "", "", "VVT Ratio", "", "Ign CLT Corr", "", "", "", "", "", "", "ETB I-Term", "", "", "df2", "df2", "22df2", "", "23:df2", "CJ125: i-term", "", "", "", "", "", "", "TPS2 Pri/Sec Diff", "", "", "", "Boost Closed Loop Duty","S unused" "", "Duty Amplitude"
debugFieldF3List = bits, U08, [0:7], "Previous Error", "Current TPS<>TPS", "", "", "Idle df3", "ICU sum", "", "", "", "", "Ign FSIO Adj", "", "", "", "", "", "", "ETB err", "", "", "df3", "df3", "22df3", "", "23:df3", "CJ125: err", "", "", "", "", "", "", "", "", "", "", "", "S unused" "", "Tu"
debugFieldF4List = bits, U08, [0:7], "I Gain", "Extra Fuel", "", "", "Idle df4", "VVT rise", "", "", "", "", "Ign PID Adj", "", "", "", "", "", "", "ETB I setting", "", "", "df4", "df4", "22df4", "", "23:df4", "CJ125: UA", "", "", "", "", "", "", "", "", "", "", "", "S unused" "", "Ku"
debugFieldF5List = bits, U08, [0:7], "D Gain", "df5", "df5", "df5", "Idle df5", "VVT fall", "df5", "", "", "", "", "", "", "", "", "", "", "ETB D setting", "df5", "df5", "df5", "df5", "22df5", "", "23:df5", "CJ125: UR", "", "", "", "", "", "", "", "", "", "", "", "S unused" "", "Kp"
debugFieldF6List = bits, U08, [0:7], "D Term", "", "", "", "Idle df6", "Current Gap", "", "", "", "", "", "", "", "", "", "", "", "ETB df6", "", "", "df6", "df6", "22df6", "", "23:df6", "cj: f7", "", "", "", "", "", "", "", "", "", "", "", "S unused" "", "Ki"
debugFieldF7List = bits, U08, [0:7], "Max-Value", "", "", "", "Idle df7", "", "", "", "", "", "", "", "", "", "", "", "", "ETB df7", "", "", "df7", "df7", "22df7", "", "23:df7", "cj: f7", "", "", "", "", "", "", "", "", "", "", "", "S unused" "", "Kd"
debugFieldI1List = bits, U08, [0:7], "P-Gain", "", "", "", "Idle di1", "Channel 1 Fall Counter", "", "", "VVT Sync Counter", "", "Multispark Count", "", "", "", "", "", "", "ETB P-Gain", "", "", "di1", "di1", "22di1", "", "23:di1", "CJ125: state", "read count","", "", "", "", "SPI Counter", "", "", "", "", "", "Start Count" "", ""
debugFieldI2List = bits, U08, [0:7], "Offset", "", "", "", "Idle di2", "Channel 2 Fall Counter", "", "", "", "", "", "", "", "", "", "", "", "ETB di2", "", "", "di2", "di2", "22di2", "", "23:di2", "", "", "", "", "", "", "Latest Transmit","", "", "", "", "", "S unused" "", ""
debugFieldI3List = bits, U08, [0:7], "", "", "", "", "Idle di3", "Cycle Index", "", "", "", "", "", "", "", "", "", "", "", "ETB di3", "", "", "di3", "di3", "22di3", "", "23:di3", "", "", "", "", "", "", "Latest Received","", "", "", "", "", "S unused" "", ""
debugFieldI4List = bits, U08, [0:7], "", "", "", "", "Idle di4", "Cycle Cnt 1", "", "", "", "", "", "", "", "", "", "", "", "ETB di4", "", "", "di4", "di4", "22di4", "", "23:di4", "", "", "", "", "", "", "Init Count", "", "", "", "", "", "S unused" "", ""
debugFieldI5List = bits, U08, [0:7], "", "", "", "", "Idle di5", "Cycle Cnt 2", "", "", "", "", "", "", "", "", "", "di5", "di5", "ETB di5", "di5", "di5", "di5", "di5", "22di5", "di5", "di5", "di5", "di5", "di5", "di5", "di5", "di5", "di5", "di5", "di5", "di5", "di5", "di5", "S di5" "", ""
debugFieldI1List = bits, U08, [0:7], "P-Gain", "", "", "", "Idle di1", "Channel 1 Fall Counter", "", "", "VVT Sync Counter", "", "Multispark Count", "", "", "", "", "", "", "ETB P-Gain", "", "", "di1", "di1", "22di1", "", "23:di1", "CJ125: state", "read count","", "", "", "", "SPI Counter", "", "", "", "", "", "Start Count" "", ""
debugFieldI2List = bits, U08, [0:7], "Offset", "", "", "", "Idle di2", "Channel 2 Fall Counter", "", "", "", "", "", "", "", "", "", "", "", "ETB di2", "", "", "di2", "di2", "22di2", "", "23:di2", "", "", "", "", "", "", "Latest Transmit","", "", "", "", "", "S unused" "", ""
debugFieldI3List = bits, U08, [0:7], "", "", "", "", "Idle di3", "Cycle Index", "", "", "", "", "", "", "", "", "", "", "", "ETB di3", "", "", "di3", "di3", "22di3", "", "23:di3", "", "", "", "", "", "", "Latest Received","", "", "", "", "", "S unused" "", ""
debugFieldI4List = bits, U08, [0:7], "", "", "", "", "Idle di4", "Cycle Cnt 1", "", "", "", "", "", "", "", "", "", "", "", "ETB di4", "", "", "di4", "di4", "22di4", "", "23:di4", "", "", "", "", "", "", "Init Count", "", "", "", "", "", "S unused" "", ""
debugFieldI5List = bits, U08, [0:7], "", "", "", "", "Idle di5", "Cycle Cnt 2", "", "", "", "", "", "", "", "", "", "di5", "di5", "ETB di5", "di5", "di5", "di5", "di5", "22di5", "di5", "di5", "di5", "di5", "di5", "di5", "di5", "di5", "di5", "", "di5", "di5", "di5", "di5", "S di5" "", ""
[ConstantsExtensions]
; defaultValue is used to provide TunerStudio with a value to use in the case of
@ -412,9 +412,15 @@ enable2ndByteCanID = false
; defaultValue = constantName, value;
defaultValue = wueAfrTargetOffset, -1.5 -1.4 -1.15 -0.95 -0.775 -0.65 -0.5625 -0.5 -0.4375 -0.375 -0.3125 -0.25 -0.1875 -0.125 -0.0625 0
; TPS 1 Primary
maintainConstantValue = tpsMax, { (calibrationMode == 1 ) ? calibrationValue : tpsMax }
maintainConstantValue = tpsMin, { (calibrationMode == 2 ) ? calibrationValue : tpsMin }
; TPS 1 Secondary
maintainConstantValue = tps1SecondaryMax, { (calibrationMode == 6 ) ? calibrationValue : tps1SecondaryMax }
maintainConstantValue = tps1SecondaryMin, { (calibrationMode == 7 ) ? calibrationValue : tps1SecondaryMin }
; ETB Auto Gain Calibration
maintainConstantValue = etb_pFactor, { (calibrationMode == 3 ) ? calibrationValue : etb_pFactor }
maintainConstantValue = etb_iFactor, { (calibrationMode == 4 ) ? calibrationValue : etb_iFactor }
maintainConstantValue = etb_dFactor, { (calibrationMode == 5 ) ? calibrationValue : etb_dFactor }
@ -1384,7 +1390,7 @@ menuDialog = main
# MAF
subMenu = mafSettings, "MAF sensor"
subMenu = mafDecodingCurve, "MAF transfer function", 0, {mafAdcChannel != 16}
subMenu = mafDecodingCurve, "MAF transfer function", 0, {mafAdcChannel != @@ADC_CHANNEL_NONE@@ }
subMenu = std_separator
# O2 sensor(s)
@ -1747,57 +1753,57 @@ cmd_set_engine_type_default = "w\x00\x31\x00\x00"
; Sensors->AUX1 Thermistor Sensor Setting
dialog = auxTempSensor1Sensor, "aux1 Thermistor Settings"
field = "Input channel", auxTempSensor1_adcChannel
field = "Bias resistor", auxTempSensor1_bias_resistor, {auxTempSensor1_adcChannel != 16}
field = "Bias resistor", auxTempSensor1_bias_resistor, {auxTempSensor1_adcChannel != @@ADC_CHANNEL_NONE@@}
field = "#Here is three pairs of thermistor temperature and resistance."
field = "#Typical temperatures is -40 deg C, 0 deg C and 100 deg C"
field = ""
field = "Lowest temperature", auxTempSensor1_tempC_1, {auxTempSensor1_adcChannel != 16}
field = "Resistance @ LT", auxTempSensor1_resistance_1, {auxTempSensor1_adcChannel != 16}
field = "Lowest temperature", auxTempSensor1_tempC_1, {auxTempSensor1_adcChannel != @@ADC_CHANNEL_NONE@@}
field = "Resistance @ LT", auxTempSensor1_resistance_1, {auxTempSensor1_adcChannel != @@ADC_CHANNEL_NONE@@}
field = ""
field = "Middle temperature", auxTempSensor1_tempC_2, {auxTempSensor1_adcChannel != 16}
field = "Resistance @ MT", auxTempSensor1_resistance_2, {auxTempSensor1_adcChannel != 16}
field = "Middle temperature", auxTempSensor1_tempC_2, {auxTempSensor1_adcChannel != @@ADC_CHANNEL_NONE@@}
field = "Resistance @ MT", auxTempSensor1_resistance_2, {auxTempSensor1_adcChannel != @@ADC_CHANNEL_NONE@@}
field = ""
field = "Highest temperature", auxTempSensor1_tempC_3, {auxTempSensor1_adcChannel != 16}
field = "Resistance @ HT", auxTempSensor1_resistance_3, {auxTempSensor1_adcChannel != 16}
field = "Highest temperature", auxTempSensor1_tempC_3, {auxTempSensor1_adcChannel != @@ADC_CHANNEL_NONE@@}
field = "Resistance @ HT", auxTempSensor1_resistance_3, {auxTempSensor1_adcChannel != @@ADC_CHANNEL_NONE@@}
; Sensors->AUX2 Thermistor Sensor Setting
dialog = auxTempSensor2Sensor, "aux2 Thermistor Settings"
field = "Input channel", auxTempSensor2_adcChannel
field = "Bias resistor", auxTempSensor2_bias_resistor, {auxTempSensor2_adcChannel != 16}
field = "Bias resistor", auxTempSensor2_bias_resistor, {auxTempSensor2_adcChannel != @@ADC_CHANNEL_NONE@@}
field = "#Here is three pairs of thermistor temperature and resistance."
field = "#Typical temperatures is -40 deg C, 0 deg C and 100 deg C"
field = ""
field = "Lowest temperature", auxTempSensor2_tempC_1, {auxTempSensor2_adcChannel != 16}
field = "Resistance @ LT", auxTempSensor2_resistance_1, {auxTempSensor2_adcChannel != 16}
field = "Lowest temperature", auxTempSensor2_tempC_1, {auxTempSensor2_adcChannel != @@ADC_CHANNEL_NONE@@}
field = "Resistance @ LT", auxTempSensor2_resistance_1, {auxTempSensor2_adcChannel != @@ADC_CHANNEL_NONE@@}
field = ""
field = "Middle temperature", auxTempSensor2_tempC_2, {auxTempSensor2_adcChannel != 16}
field = "Resistance @ MT", auxTempSensor2_resistance_2, {auxTempSensor2_adcChannel != 16}
field = "Middle temperature", auxTempSensor2_tempC_2, {auxTempSensor2_adcChannel != @@ADC_CHANNEL_NONE@@}
field = "Resistance @ MT", auxTempSensor2_resistance_2, {auxTempSensor2_adcChannel != @@ADC_CHANNEL_NONE@@}
field = ""
field = "Highest temperature", auxTempSensor2_tempC_3, {auxTempSensor2_adcChannel != 16}
field = "Resistance @ HT", auxTempSensor2_resistance_3, {auxTempSensor2_adcChannel != 16}
field = "Highest temperature", auxTempSensor2_tempC_3, {auxTempSensor2_adcChannel != @@ADC_CHANNEL_NONE@@}
field = "Resistance @ HT", auxTempSensor2_resistance_3, {auxTempSensor2_adcChannel != @@ADC_CHANNEL_NONE@@}
dialog = tpsNum1, "Throttle #1"
field = "!See Tools>Calibrate TPS"
field = "Primary sensor", tps1_1AdcChannel
field = "Primary min", tpsMin, {tps1_1AdcChannel != 16}
field = "Primary max", tpsMax, {tps1_1AdcChannel != 16}
field = "Primary min", tpsMin, {tps1_1AdcChannel != @@ADC_CHANNEL_NONE@@}
field = "Primary max", tpsMax, {tps1_1AdcChannel != @@ADC_CHANNEL_NONE@@}
field = "Secondary sensor", tps1_2AdcChannel
field = "Secondary min", tps1SecondaryMin, {tps1_2AdcChannel != 16}
field = "Secondary max", tps1SecondaryMax, {tps1_2AdcChannel != 16}
field = "Secondary min", tps1SecondaryMin, {tps1_2AdcChannel != @@ADC_CHANNEL_NONE@@}
field = "Secondary max", tps1SecondaryMax, {tps1_2AdcChannel != @@ADC_CHANNEL_NONE@@}
dialog = tpsNum2, "Throttle #2"
field = "Primary sensor", tps2_1AdcChannel
field = "Primary min", tps2Min, {tps2_1AdcChannel != 16}
field = "Primary max", tps2Max, {tps2_1AdcChannel != 16}
field = "Primary min", tps2Min, {tps2_1AdcChannel != @@ADC_CHANNEL_NONE@@}
field = "Primary max", tps2Max, {tps2_1AdcChannel != @@ADC_CHANNEL_NONE@@}
field = "Secondary sensor", tps2_2AdcChannel
field = "Secondary min", tps2SecondaryMin, {tps2_2AdcChannel != 16}
field = "Secondary max", tps2SecondaryMax, {tps2_2AdcChannel != 16}
field = "Secondary min", tps2SecondaryMin, {tps2_2AdcChannel != @@ADC_CHANNEL_NONE@@}
field = "Secondary max", tps2SecondaryMax, {tps2_2AdcChannel != @@ADC_CHANNEL_NONE@@}
dialog = tpsLimits, "TPS Limits"
field = "TPS minimum valid value", tpsErrorDetectionTooLow, {tps1_1AdcChannel != 16}
field = "TPS maximum valid value", tpsErrorDetectionTooHigh, {tps1_1AdcChannel != 16}
field = "TPS minimum valid value", tpsErrorDetectionTooLow, {tps1_1AdcChannel != @@ADC_CHANNEL_NONE@@}
field = "TPS maximum valid value", tpsErrorDetectionTooHigh, {tps1_1AdcChannel != @@ADC_CHANNEL_NONE@@}
dialog = tpsSensor, "TPS"
panel = tpsLimits
@ -2062,21 +2068,21 @@ cmd_set_engine_type_default = "w\x00\x31\x00\x00"
; Sensors->CLT sensor
dialog = clt_thermistor, "CLT sensor"
field = "Input channel", clt_adcChannel
field = "Bias resistor", clt_bias_resistor, {clt_adcChannel != 16}
field = "Bias resistor", clt_bias_resistor, {clt_adcChannel != @@ADC_CHANNEL_NONE@@}
field = "#Input three pairs of thermistor temperature and resistance."
field = "#Typical temperatures are -40 deg C, 0 deg C and 100 deg C"
field = ""
field = "Lowest temperature", clt_tempC_1, {clt_adcChannel != 16}
field = "Resistance @ LT", clt_resistance_1, {clt_adcChannel != 16}
field = "Lowest temperature", clt_tempC_1, {clt_adcChannel != @@ADC_CHANNEL_NONE@@}
field = "Resistance @ LT", clt_resistance_1, {clt_adcChannel != @@ADC_CHANNEL_NONE@@}
field = ""
field = "Middle temperature", clt_tempC_2, {clt_adcChannel != 16}
field = "Resistance @ MT", clt_resistance_2, {clt_adcChannel != 16}
field = "Middle temperature", clt_tempC_2, {clt_adcChannel != @@ADC_CHANNEL_NONE@@}
field = "Resistance @ MT", clt_resistance_2, {clt_adcChannel != @@ADC_CHANNEL_NONE@@}
field = ""
field = "Highest temperature", clt_tempC_3, {clt_adcChannel != 16}
field = "Resistance @ HT", clt_resistance_3, {clt_adcChannel != 16}
field = "Highest temperature", clt_tempC_3, {clt_adcChannel != @@ADC_CHANNEL_NONE@@}
field = "Resistance @ HT", clt_resistance_3, {clt_adcChannel != @@ADC_CHANNEL_NONE@@}
field = ""
field = "Linear characteristic", useLinearCltSensor, {clt_adcChannel != 16}
field = "Linear characteristic", useLinearCltSensor, {clt_adcChannel != @@ADC_CHANNEL_NONE@@}
dialog = cltGauges
gauge = CLTGauge
@ -2089,21 +2095,21 @@ cmd_set_engine_type_default = "w\x00\x31\x00\x00"
; Sensors->IAT sensor
dialog = iat_thermistor, "IAT sensor"
field = "Input channel", iat_adcChannel
field = "Bias resistor", iat_bias_resistor, {iat_adcChannel != 16}
field = "Bias resistor", iat_bias_resistor, {iat_adcChannel != @@ADC_CHANNEL_NONE@@}
field = "#Input three pairs of thermistor temperature and resistance."
field = "#Typical temperatures are -40 deg C, 0 deg C and 100 deg C"
field = ""
field = "Lowest temperature", iat_tempC_1, {iat_adcChannel != 16}
field = "Resistance @ LT", iat_resistance_1, {iat_adcChannel != 16}
field = "Lowest temperature", iat_tempC_1, {iat_adcChannel != @@ADC_CHANNEL_NONE@@}
field = "Resistance @ LT", iat_resistance_1, {iat_adcChannel != @@ADC_CHANNEL_NONE@@}
field = ""
field = "Middle temperature", iat_tempC_2, {iat_adcChannel != 16}
field = "Resistance @ MT", iat_resistance_2, {iat_adcChannel != 16}
field = "Middle temperature", iat_tempC_2, {iat_adcChannel != @@ADC_CHANNEL_NONE@@}
field = "Resistance @ MT", iat_resistance_2, {iat_adcChannel != @@ADC_CHANNEL_NONE@@}
field = ""
field = "Highest temperature", iat_tempC_3, {iat_adcChannel != 16}
field = "Resistance @ HT", iat_resistance_3, {iat_adcChannel != 16}
field = "Highest temperature", iat_tempC_3, {iat_adcChannel != @@ADC_CHANNEL_NONE@@}
field = "Resistance @ HT", iat_resistance_3, {iat_adcChannel != @@ADC_CHANNEL_NONE@@}
field = ""
field = "Linear characteristic", useLinearIatSensor, {iat_adcChannel != 16}
field = "Linear characteristic", useLinearIatSensor, {iat_adcChannel != @@ADC_CHANNEL_NONE@@}
dialog = iatGauges
gauge = IATGauge
@ -2116,10 +2122,10 @@ cmd_set_engine_type_default = "w\x00\x31\x00\x00"
; Sensors->Oil pressure sensor
dialog = oilp_settings, "Oil Pressure Sensor"
field = "Oil Pressure ADC input", oilPressure_hwChannel
field = "low voltage", oilPressure_v1, {oilPressure_hwChannel != 16}
field = "low pressure", oilPressure_value1, {oilPressure_hwChannel != 16}
field = "high voltage", oilPressure_v2, {oilPressure_hwChannel != 16}
field = "high pressure", oilPressure_value2, {oilPressure_hwChannel != 16}
field = "low voltage", oilPressure_v1, {oilPressure_hwChannel != @@ADC_CHANNEL_NONE@@}
field = "low pressure", oilPressure_value1, {oilPressure_hwChannel != @@ADC_CHANNEL_NONE@@}
field = "high voltage", oilPressure_v2, {oilPressure_hwChannel != @@ADC_CHANNEL_NONE@@}
field = "high pressure", oilPressure_value2, {oilPressure_hwChannel != @@ADC_CHANNEL_NONE@@}
dialog = oilPressureGauges
gauge = OilPressGauge
@ -2132,11 +2138,11 @@ cmd_set_engine_type_default = "w\x00\x31\x00\x00"
; Sensors->MAP sensor
dialog = mapSensorAnalog, "MAP sensor", yAxis
field = "MAP ADC input", map_sensor_hwChannel
field = "MAP type", map_sensor_type
field = "MAP value low point", map_sensor_lowValue
field = "MAP voltage low point", mapLowValueVoltage
field = "MAP value high point", map_sensor_highValue
field = "MAP voltage high value", mapHighValueVoltage
field = "MAP type", map_sensor_type, { map_sensor_hwChannel != @@ADC_CHANNEL_NONE@@ }
field = "MAP value low point", map_sensor_lowValue, { map_sensor_hwChannel != @@ADC_CHANNEL_NONE@@ && map_sensor_type == 0 }
field = "MAP voltage low point", mapLowValueVoltage, { map_sensor_hwChannel != @@ADC_CHANNEL_NONE@@ && map_sensor_type == 0 }
field = "MAP value high point", map_sensor_highValue,{ map_sensor_hwChannel != @@ADC_CHANNEL_NONE@@ && map_sensor_type == 0 }
field = "MAP voltage high value", mapHighValueVoltage, { map_sensor_hwChannel != @@ADC_CHANNEL_NONE@@ && map_sensor_type == 0 }
dialog = mapSensorFreq, "MAP frequency sensor", yAxis
field = "MAP Freq", frequencyReportingMapInputPin

View File

@ -1,6 +1,6 @@
package com.rusefi.config.generated;
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.bat integration\rusefi_config.txt Fri May 15 21:04:15 EDT 2020
// this file was generated automatically by rusEfi tool ConfigDefinition.jar based on gen_config.bat integration\rusefi_config.txt Mon May 18 01:21:34 EDT 2020
// by class com.rusefi.output.FileJavaFieldsConsumer
import com.rusefi.config.*;
@ -18,6 +18,7 @@ public class Fields {
public static final int activateAuxPid2_offset = 76;
public static final int activateAuxPid3_offset = 76;
public static final int activateAuxPid4_offset = 76;
public static final int ADC_CHANNEL_NONE = 16;
public static final int adcVcc_offset = 548;
public static final int adcVcc_offset_hex = 224;
public static final int afr_alignAf_offset = 561;

View File

@ -34,7 +34,7 @@ TEST(SensorInit, Tps) {
initTps(PASS_ENGINE_PARAMETER_SIGNATURE);
// Ensure the sensors were registered
auto s = const_cast<Sensor*>(Sensor::getSensorOfType(SensorType::Tps1));
auto s = const_cast<Sensor*>(Sensor::getSensorOfType(SensorType::Tps1Primary));
ASSERT_NE(nullptr, s);
// Test in range
@ -45,6 +45,10 @@ TEST(SensorInit, Tps) {
// Test out of range
EXPECT_POINT_INVALID(s, 0.0f);
EXPECT_POINT_INVALID(s, 5.0f);
// Test that the passthru (redundant sensor) is working
EXPECT_POINT_VALID(s, 2.5f, 50.0f);
EXPECT_NEAR(50.0f, Sensor::get(SensorType::Tps1).value_or(-1), EPS2D);
}
TEST(SensorInit, Pedal) {