From a11559f8017ae981c8fca57aae8f9cb80e919db4 Mon Sep 17 00:00:00 2001 From: kifir Date: Fri, 27 Sep 2024 23:39:51 +0300 Subject: [PATCH] enhance configuration of torque reduction trigger PIN #5608 --- firmware/controllers/algo/rusefi_enums.h | 5 +++++ firmware/integration/rusefi_config.txt | 10 +++++++--- firmware/tunerstudio/tunerstudio.template.ini | 19 +++++++++++++------ 3 files changed, 25 insertions(+), 9 deletions(-) diff --git a/firmware/controllers/algo/rusefi_enums.h b/firmware/controllers/algo/rusefi_enums.h index fb851733ce..5f02bc241a 100644 --- a/firmware/controllers/algo/rusefi_enums.h +++ b/firmware/controllers/algo/rusefi_enums.h @@ -584,6 +584,11 @@ typedef enum __attribute__ ((__packed__)) { STOP_INPUT_LAUNCH = 3, } launchActivationMode_e; +typedef enum __attribute__ ((__packed__)) { + TORQUE_REDUCTION_BUTTON = 0, + LAUNCH_BUTTON = 1, +} torqueReductionActivationMode_e; + typedef enum __attribute__ ((__packed__)) { SWITCH_INPUT_ANTILAG = 0, ALWAYS_ON_ANTILAG = 1, diff --git a/firmware/integration/rusefi_config.txt b/firmware/integration/rusefi_config.txt index b66a847858..f72ee179fb 100644 --- a/firmware/integration/rusefi_config.txt +++ b/firmware/integration/rusefi_config.txt @@ -1067,8 +1067,8 @@ bit cutFuelOnHardLimit,"yes","no" bit cutSparkOnHardLimit,"yes","no";Be careful enabling this: some engines are known to self-disassemble their valvetrain with a spark cut. Fuel cut is much safer. bit launchFuelCutEnable bit launchSparkCutEnable;This is the Cut Mode normally used - bit unusedFancy1 - bit unusedFancy2 + bit torqueReductionEnabled + bit torqueReductionTriggerPinInverted bit unusedFancy14 bit unusedFancy7 bit unusedFancy8 @@ -1438,7 +1438,11 @@ float tChargeAirDecrLimit;Maximum allowed rate of decrease allowed for the estim pid_s idleTimingPid;See useIdleTimingPidControl float idleTimingSoftEntryTime;When entering idle, and the PID settings are aggressive, it's good to make a soft entry upon entering closed loop;"", 1, 0, 0, 100, 1 - int16_t unusedEtbRocExpAverageLength + pin_input_mode_e torqueReductionTriggerPinMode; + + #define torqueReductionActivationMode_e_enum "Torque Reduction Button", "Launch Button" + custom torqueReductionActivationMode_e 1 bits, S08, @OFFSET@, [0:0], @@torqueReductionActivationMode_e_enum@@ + torqueReductionActivationMode_e torqueReductionActivationMode; int16_t tpsAccelFractionPeriod;A delay in cycles between fuel-enrich. portions;"cycles", 1, 0, 0, 500, 0 float tpsAccelFractionDivisor;A fraction divisor: 1 or less = entire portion at once, or split into diminishing fractions;"coef", 1, 0, 1, 100, 2 diff --git a/firmware/tunerstudio/tunerstudio.template.ini b/firmware/tunerstudio/tunerstudio.template.ini index 3d0c61d2fc..2b5855227e 100644 --- a/firmware/tunerstudio/tunerstudio.template.ini +++ b/firmware/tunerstudio/tunerstudio.template.ini @@ -4983,15 +4983,22 @@ dialog = tcuControls, "Transmission Settings" field = "Fuel Cut", launchFuelCutEnable, {launchControlEnabled == 1} dialog = TorqueReductionSettings, "Torque Reduction" - field = "Trigger Pin", torqueReductionTriggerPin - field = "Time", torqueReductionTime, {torqueReductionTriggerPin != 0} - field = "Arming RPM", torqueReductionArmingRpm, {torqueReductionTriggerPin != 0} - field = "Arming APP", torqueReductionArmingApp, {torqueReductionTriggerPin != 0} - field = "Ignition Retard", torqueReductionIgnitionRetard, {torqueReductionTriggerPin != 0} - field = "Ignition Cut", torqueReductionIgnitionCut, {torqueReductionTriggerPin != 0} + field = "Enable", torqueReductionEnabled + field = "Activation Mode", torqueReductionActivationMode, {torqueReductionEnabled == 1} + field = "Button" torqueReductionTriggerPin, {torqueReductionEnabled == 1 && torqueReductionActivationMode == @@torqueReductionActivationMode_e_TORQUE_REDUCTION_BUTTON@@} + field = "Button inverted", torqueReductionTriggerPinInverted, {torqueReductionEnabled == 1 && torqueReductionActivationMode == @@torqueReductionActivationMode_e_TORQUE_REDUCTION_BUTTON@@ && torqueReductionTriggerPin != 0} + field = "Button mode", torqueReductionTriggerPinMode, {torqueReductionEnabled == 1 && torqueReductionActivationMode == @@torqueReductionActivationMode_e_TORQUE_REDUCTION_BUTTON@@ && torqueReductionTriggerPin != 0} + field = "Time", torqueReductionTime, {torqueReductionEnabled == 1} + field = "Arming RPM", torqueReductionArmingRpm, {torqueReductionEnabled == 1} + field = "Arming APP", torqueReductionArmingApp, {torqueReductionEnabled == 1} + field = "Ignition Retard", torqueReductionIgnitionRetard, {torqueReductionEnabled == 1} + field = "Ignition Cut", torqueReductionIgnitionCut, {torqueReductionEnabled == 1} dialog = FlatShiftSettingsDialog, "", border panel = TorqueReductionSettings, West + field = "Launch Button", launchActivatePin, {torqueReductionEnabled == 1 && torqueReductionActivationMode == @@torqueReductionActivationMode_e_LAUNCH_BUTTON@@} + field = "Launch Button inverted", launchActivateInverted, {torqueReductionEnabled == 1 && torqueReductionActivationMode == @@torqueReductionActivationMode_e_LAUNCH_BUTTON@@ && launchActivatePin != 0} + field = "Launch Button mode", launchActivatePinMode, {torqueReductionEnabled == 1 && torqueReductionActivationMode == @@torqueReductionActivationMode_e_LAUNCH_BUTTON@@ && launchActivatePin != 0} dialog = smLaunchControl, "", border panel = smLaunchControlWest, West