diff --git a/firmware/controllers/actuators/electronic_throttle.cpp b/firmware/controllers/actuators/electronic_throttle.cpp index d006adcf8b..e1116e818d 100644 --- a/firmware/controllers/actuators/electronic_throttle.cpp +++ b/firmware/controllers/actuators/electronic_throttle.cpp @@ -79,7 +79,8 @@ #endif /* ETB_MAX_COUNT */ static pedal2tps_t pedal2tpsMap; -static Map3D<6, 6, int8_t, uint8_t, uint8_t> throttle2TrimTable; +static Map3D throttle2TrimTable; +static Map3D tcEtbDropTable; constexpr float etbPeriodSeconds = 1.0f / ETB_LOOP_FREQUENCY; @@ -325,10 +326,14 @@ expected EtbController::getSetpointEtb() { } #endif /* EFI_ANTILAG_SYSTEM */ + float vehicleSpeed = Sensor::getOrZero(SensorType::VehicleSpeed); + float wheelSlip = Sensor::getOrZero(SensorType::WheelSlipRatio); + tcEtbDrop = tcEtbDropTable.getValue(vehicleSpeed, wheelSlip); + // Apply any adjustment that this throttle alone needs // Clamped to +-10 to prevent anything too wild trim = clampF(-10, getThrottleTrim(rpm, targetPosition), 10); - targetPosition += trim; + targetPosition += trim + tcEtbDrop; // Clamp before rev limiter to avoid ineffective rev limit due to crazy out of range position target targetPosition = clampF(0, targetPosition, 100); @@ -1032,6 +1037,7 @@ void initElectronicThrottle() { pedal2tpsMap.init(config->pedalToTpsTable, config->pedalToTpsPedalBins, config->pedalToTpsRpmBins); throttle2TrimTable.init(config->throttle2TrimTable, config->throttle2TrimTpsBins, config->throttle2TrimRpmBins); + tcEtbDropTable.init(engineConfiguration->tractionControlEtbDrop, engineConfiguration->tractionControlSpeedBins, engineConfiguration->tractionControlSlipBins); doInitElectronicThrottle(); } diff --git a/firmware/tunerstudio/rusefi.input b/firmware/tunerstudio/rusefi.input index 8adc0b48a4..cecd18bbb7 100644 --- a/firmware/tunerstudio/rusefi.input +++ b/firmware/tunerstudio/rusefi.input @@ -2028,7 +2028,7 @@ menuDialog = main subMenu = hpfpCompensationTable, "HPFP Pump Compensation", {hpfpCamLobes != 0} subMenu = std_separator subMenu = fancyHardwareDialog, "Fancy Hardware" - subMenu = tractionEtbTableTbl + subMenu = tractionEtbTableTbl, "Traction Control ETB Drop" subMenu = std_separator subMenu = hipFunction, "HIP9011 settings (knock sensor) (alpha version)" @@if_ts_show_hip9011