diff --git a/firmware/controllers/actuators/electronic_throttle.cpp b/firmware/controllers/actuators/electronic_throttle.cpp index e90c8e5fc5..a63f570a77 100644 --- a/firmware/controllers/actuators/electronic_throttle.cpp +++ b/firmware/controllers/actuators/electronic_throttle.cpp @@ -578,10 +578,6 @@ void initElectronicThrottle(DECLARE_ENGINE_PARAMETER_SIGNATURE) { startETBPins(PASS_ENGINE_PARAMETER_SIGNATURE); - // manual duty cycle control without PID. Percent value from 0 to 100 - addConsoleActionNANF(CMD_ETB_DUTY, setThrottleDutyCycle); - - tuneWorkingPidSettings.pFactor = 1; tuneWorkingPidSettings.iFactor = 0; tuneWorkingPidSettings.dFactor = 0; @@ -592,6 +588,8 @@ void initElectronicThrottle(DECLARE_ENGINE_PARAMETER_SIGNATURE) { tuneWorkingPidSettings.periodMs = 100; #if EFI_PROD_CODE + // manual duty cycle control without PID. Percent value from 0 to 100 + addConsoleActionNANF(CMD_ETB_DUTY, setThrottleDutyCycle); // this is useful once you do "enable etb_auto" addConsoleActionF("set_etbat_output", setTempOutput); addConsoleActionF("set_etbat_step", setAutoStep); diff --git a/firmware/controllers/engine_controller.cpp b/firmware/controllers/engine_controller.cpp index fed3520f6f..58c6519da0 100644 --- a/firmware/controllers/engine_controller.cpp +++ b/firmware/controllers/engine_controller.cpp @@ -109,6 +109,11 @@ void mostCommonInitEngineController(Logging *sharedLogger DECLARE_ENGINE_PARAMET #if EFI_IDLE_CONTROL startIdleThread(sharedLogger PASS_ENGINE_PARAMETER_SUFFIX); #endif /* EFI_IDLE_CONTROL */ + +#if EFI_ELECTRONIC_THROTTLE_BODY + initElectronicThrottle(PASS_ENGINE_PARAMETER_SIGNATURE); +#endif /* EFI_ELECTRONIC_THROTTLE_BODY */ + } EXTERN_ENGINE; @@ -760,10 +765,6 @@ void initEngineContoller(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX) initAuxPid(sharedLogger); #endif -#if EFI_ELECTRONIC_THROTTLE_BODY - initElectronicThrottle(); -#endif /* EFI_ELECTRONIC_THROTTLE_BODY */ - #if EFI_MALFUNCTION_INDICATOR initMalfunctionIndicator(); #endif /* EFI_MALFUNCTION_INDICATOR */ diff --git a/unit_tests/efifeatures.h b/unit_tests/efifeatures.h index de50ada738..4f79e19f19 100644 --- a/unit_tests/efifeatures.h +++ b/unit_tests/efifeatures.h @@ -16,6 +16,8 @@ #define EFI_IDLE_CONTROL TRUE +#define EFI_ELECTRONIC_THROTTLE_BODY TRUE + #define SPARK_EXTREME_LOGGING TRUE #define EFI_ENABLE_MOCK_ADC FALSE diff --git a/unit_tests/tests/test_idle_controller.cpp b/unit_tests/tests/test_idle_controller.cpp index 3daa1b86ab..17816d6e5a 100644 --- a/unit_tests/tests/test_idle_controller.cpp +++ b/unit_tests/tests/test_idle_controller.cpp @@ -182,3 +182,11 @@ TEST(idle, timingPid) { ASSERT_FLOAT_EQ(-5.0f, corr) << "getAdvanceCorrections#7"; } + + +TEST(idle, testTargetTpsIsFloatBug945) { + + WITH_ENGINE_TEST_HELPER(TEST_ENGINE); + + +}