diff --git a/firmware/controllers/actuators/electronic_throttle.cpp b/firmware/controllers/actuators/electronic_throttle.cpp index 771b5ff50e..222a3b17dd 100644 --- a/firmware/controllers/actuators/electronic_throttle.cpp +++ b/firmware/controllers/actuators/electronic_throttle.cpp @@ -939,6 +939,12 @@ void doInitElectronicThrottle(DECLARE_ENGINE_PARAMETER_SIGNATURE) { addConsoleAction("ethinfo", showEthInfo); addConsoleAction("etbreset", etbReset); addConsoleActionI("etb_freq", setEtbFrequency); + + // this command is useful for real hardware test with known cheap hardware + addConsoleAction("etb_test_hw", [](){ + setToyota89281_33010_pedal_position_sensor(PASS_CONFIG_PARAMETER_SIGNATURE); + }); + #endif /* EFI_PROD_CODE */ pedal2tpsMap.init(config->pedalToTpsTable, config->pedalToTpsPedalBins, config->pedalToTpsRpmBins); @@ -1028,26 +1034,15 @@ void setEtbWastegatePosition(percent_t pos DECLARE_ENGINE_PARAMETER_SUFFIX) { } } -static void toyota89281_33010_pedal_position_sensor(DECLARE_CONFIG_PARAMETER_SIGNATURE) { +void setToyota89281_33010_pedal_position_sensor(DECLARE_CONFIG_PARAMETER_SIGNATURE) { engineConfiguration->throttlePedalUpVoltage = 0; engineConfiguration->throttlePedalWOTVoltage = 4.1; engineConfiguration->throttlePedalSecondaryUpVoltage = 0.73; engineConfiguration->throttlePedalSecondaryWOTVoltage = 4.9; } -void setProteusHitachiEtbDefaults(DECLARE_CONFIG_PARAMETER_SIGNATURE) { - // EFI_ADC_12: "Analog Volt 3" - engineConfiguration->tps1_2AdcChannel = EFI_ADC_12; - // EFI_ADC_13: "Analog Volt 4" - engineConfiguration->tps2_1AdcChannel = EFI_ADC_13; - // EFI_ADC_0: "Analog Volt 5" - engineConfiguration->tps2_2AdcChannel = EFI_ADC_0; - // EFI_ADC_1: "Analog Volt 6" - engineConfiguration->throttlePedalPositionAdcChannel = EFI_ADC_1; - toyota89281_33010_pedal_position_sensor(PASS_CONFIG_PARAMETER_SIGNATURE); - - // EFI_ADC_2: "Analog Volt 7" - engineConfiguration->throttlePedalPositionSecondAdcChannel = EFI_ADC_2; +void setHitachiEtbCalibration(DECLARE_CONFIG_PARAMETER_SIGNATURE) { + setToyota89281_33010_pedal_position_sensor(PASS_CONFIG_PARAMETER_SIGNATURE); setHitachiEtbBiasBins(PASS_CONFIG_PARAMETER_SIGNATURE); @@ -1066,4 +1061,20 @@ void setProteusHitachiEtbDefaults(DECLARE_CONFIG_PARAMETER_SIGNATURE) { CONFIG(tps1SecondaryMax) = CONFIG(tps2SecondaryMax) = 161; } +void setProteusHitachiEtbDefaults(DECLARE_CONFIG_PARAMETER_SIGNATURE) { + setHitachiEtbCalibration(PASS_CONFIG_PARAMETER_SIGNATURE); + + // EFI_ADC_12: "Analog Volt 3" + engineConfiguration->tps1_2AdcChannel = EFI_ADC_12; + // EFI_ADC_13: "Analog Volt 4" + engineConfiguration->tps2_1AdcChannel = EFI_ADC_13; + // EFI_ADC_0: "Analog Volt 5" + engineConfiguration->tps2_2AdcChannel = EFI_ADC_0; + // EFI_ADC_1: "Analog Volt 6" + engineConfiguration->throttlePedalPositionAdcChannel = EFI_ADC_1; + + // EFI_ADC_2: "Analog Volt 7" + engineConfiguration->throttlePedalPositionSecondAdcChannel = EFI_ADC_2; +} + #endif /* EFI_ELECTRONIC_THROTTLE_BODY */ diff --git a/firmware/controllers/actuators/electronic_throttle.h b/firmware/controllers/actuators/electronic_throttle.h index a438f06d7b..1a9f4ea17a 100644 --- a/firmware/controllers/actuators/electronic_throttle.h +++ b/firmware/controllers/actuators/electronic_throttle.h @@ -16,6 +16,8 @@ void doInitElectronicThrottle(DECLARE_ENGINE_PARAMETER_SIGNATURE); void setEtbIdlePosition(percent_t pos DECLARE_ENGINE_PARAMETER_SUFFIX); void setEtbWastegatePosition(percent_t pos DECLARE_ENGINE_PARAMETER_SUFFIX); +void setToyota89281_33010_pedal_position_sensor(DECLARE_CONFIG_PARAMETER_SIGNATURE); +void setHitachiEtbCalibration(DECLARE_CONFIG_PARAMETER_SIGNATURE); void setDefaultEtbBiasCurve(DECLARE_CONFIG_PARAMETER_SIGNATURE); void setDefaultEtbParameters(DECLARE_CONFIG_PARAMETER_SIGNATURE);