diff --git a/firmware/config/stm32f4ems/efifeatures.h b/firmware/config/stm32f4ems/efifeatures.h index e22baed2bf..3e35b54acb 100644 --- a/firmware/config/stm32f4ems/efifeatures.h +++ b/firmware/config/stm32f4ems/efifeatures.h @@ -13,7 +13,7 @@ #define EFI_BOOST_CONTROL TRUE -#define EFI_LAUNCH_CONTROL FALSE +#define EFI_LAUNCH_CONTROL TRUE #define EFI_FSIO TRUE diff --git a/firmware/controllers/algo/launch_control.cpp b/firmware/controllers/algo/launch_control.cpp index abc2da7a21..4b6cb15194 100644 --- a/firmware/controllers/algo/launch_control.cpp +++ b/firmware/controllers/algo/launch_control.cpp @@ -145,7 +145,7 @@ void applyLaunchControlLimiting(bool *limitedSpark, bool *limitedFuel DECLARE_EN (CONFIG(enableLaunchRetard) ? CONFIG(launchAdvanceRpmRange) : 0) + CONFIG(hardCutRpmRange); - if (retardThresholdRpm > GET_RPM()) { + if (retardThresholdRpm < GET_RPM()) { *limitedSpark = engine->isLaunchCondition && engineConfiguration->launchSparkCutEnable; *limitedFuel = engine->isLaunchCondition && engineConfiguration->launchFuelCutEnable; engine->rpmHardCut = true; diff --git a/firmware/controllers/algo/launch_control.h b/firmware/controllers/algo/launch_control.h index 71d48bf8fa..b9a16ddcbd 100644 --- a/firmware/controllers/algo/launch_control.h +++ b/firmware/controllers/algo/launch_control.h @@ -11,3 +11,4 @@ void initLaunchControl(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX); void setDefaultLaunchParameters(DECLARE_CONFIG_PARAMETER_SIGNATURE); +void applyLaunchControlLimiting(bool *limitedSpark, bool *limitedFuel DECLARE_ENGINE_PARAMETER_SUFFIX); diff --git a/firmware/controllers/engine_cycle/main_trigger_callback.cpp b/firmware/controllers/engine_cycle/main_trigger_callback.cpp index 0f6e095dc1..7ea4c63d8c 100644 --- a/firmware/controllers/engine_cycle/main_trigger_callback.cpp +++ b/firmware/controllers/engine_cycle/main_trigger_callback.cpp @@ -52,6 +52,9 @@ #include "engine.h" #include "perf_trace.h" #include "sensor.h" +#if EFI_LAUNCH_CONTROL +#include "launch_control.h" +#endif #include "backup_ram.h" @@ -427,7 +430,13 @@ static void mainTriggerCallback(trigger_event_e ckpSignalType, uint32_t trgEvent limitedFuel = true; } } - +#if EFI_LAUNCH_CONTROL + if ((!limitedSpark)&&(!limitedFuel)) + { + /* in case we are not already on a limited conditions, check launch as well */ + applyLaunchControlLimiting(&limitedSpark,&limitedFuel PASS_ENGINE_PARAMETER_SUFFIX); + } +#endif if (trgEventIndex == 0) { if (HAVE_CAM_INPUT()) { engine->triggerCentral.validateCamVvtCounters(); diff --git a/firmware/tunerstudio/rusefi.input b/firmware/tunerstudio/rusefi.input index b9e6be0ce8..a00df0c126 100644 --- a/firmware/tunerstudio/rusefi.input +++ b/firmware/tunerstudio/rusefi.input @@ -1446,8 +1446,8 @@ menuDialog = main subMenu = etbTpsBiasCurve, "Electronic throttle body bias curve" @@if_ts_show_etb subMenu = pedalToTpsTbl, "Electronic Pedal Map" @@if_ts_show_etb subMenu = std_separator -# subMenu = smLaunchControl, "Launch Control" -# subMenu = std_separator + subMenu = smLaunchControl, "Launch Control" + subMenu = std_separator # subMenu = smRollingLaunch, "Rolling Launch" # subMenu = std_separator # subMenu = antiLag, "Antilag Setup" @@ -3158,7 +3158,7 @@ cmd_set_engine_type_default = "@@TS_IO_TEST_COMMAND_char@@\x00\x31\x00\x00" field = "Log recent errors list", enableLogErrorList ; Racing Features->Launch Control - dialog = smLaunchControl, "Launch Control Settings NOT WORKING" + dialog = smLaunchControl, "Launch Control Settings EXPERIMENTAL" field = "Enable Launch Control", launchControlEnabled field = "Activation Mode", launchActivationMode field = "Switch Input", launchActivatePin, {launchActivationMode == 0 && launchControlEnabled == 1} @@ -3170,6 +3170,7 @@ cmd_set_engine_type_default = "@@TS_IO_TEST_COMMAND_char@@\x00\x31\x00\x00" field = "Launch RPM", launchRpm, {launchControlEnabled == 1} field = "Extra Fuel", launchFuelAdded, {launchControlEnabled == 1} field = "Boost Solenoid Duty", launchBoostDuty, {launchControlEnabled == 1} + field = "Ignition Retard enable", enableLaunchRetard, {launchControlEnabled == 1} field = "Ignition Retard", launchTimingRetard, {launchControlEnabled == 1} field = "Ignition Retard RPM Range", launchTimingRpmRange, {launchControlEnabled == 1} field = "Smooth Retard Mode", launchSmoothRetard, {launchControlEnabled == 1}