diff --git a/firmware/controllers/algo/antilag_system.cpp b/firmware/controllers/algo/antilag_system.cpp index 778fe6c449..551d74d9a5 100644 --- a/firmware/controllers/algo/antilag_system.cpp +++ b/firmware/controllers/algo/antilag_system.cpp @@ -54,10 +54,10 @@ bool AntilagSystemBase::isALSMaxCLTCondition() const { return engineConfiguration->ALSMaxCLT > clt; } -bool AntilagSystemBase::isALSMaxTPSCondition() const { - int tps = Sensor::getOrZero(SensorType::Tps1); +bool AntilagSystemBase::isALSMaxThrottleIntentCondition() const { + int throttleIntent = Sensor::getOrZero(SensorType::DriverThrottleIntent); - return engineConfiguration->ALSMaxTPS > tps; + return engineConfiguration->ALSMaxTPS > throttleIntent; } bool AntilagSystemBase::isAntilagConditionMet() { @@ -66,18 +66,19 @@ bool AntilagSystemBase::isAntilagConditionMet() { ALSMaxRPMCondition = isALSMaxRPMCondition(); ALSMinCLTCondition = isALSMinCLTCondition(); ALSMaxCLTCondition = isALSMaxCLTCondition(); - ALSMaxTPSCondition = isALSMaxTPSCondition(); + ALSMaxThrottleIntentCondition = isALSMaxThrottleIntentCondition(); ALSSwitchCondition = isInsideALSSwitchCondition(); - return ALSMinRPMCondition && ALSMaxRPMCondition && ALSMinCLTCondition && ALSMaxCLTCondition && ALSMaxTPSCondition && ALSSwitchCondition; + return ALSMinRPMCondition && + ALSMaxRPMCondition && + ALSMinCLTCondition && + ALSMaxCLTCondition && + ALSMaxThrottleIntentCondition && + ALSSwitchCondition; } void AntilagSystemBase::update() { - if (!engineConfiguration->antiLagEnabled) { - return; - } - - isAntilagCondition = isAntilagConditionMet(); + isAntilagCondition = engineConfiguration->antiLagEnabled && isAntilagConditionMet(); } #endif /* EFI_ANTILAG_SYSTEM */ diff --git a/firmware/controllers/algo/antilag_system.h b/firmware/controllers/algo/antilag_system.h index 847b2317f1..4048c18a5c 100644 --- a/firmware/controllers/algo/antilag_system.h +++ b/firmware/controllers/algo/antilag_system.h @@ -20,7 +20,8 @@ public: bool isALSMaxRPMCondition() const; bool isALSMinCLTCondition() const; bool isALSMaxCLTCondition() const; - bool isALSMaxTPSCondition() const; - bool isAntilagConditionMet(); + bool isALSMaxThrottleIntentCondition() const; bool isInsideALSSwitchCondition(); + /* enabled and all conditions above */ + bool isAntilagConditionMet(); }; diff --git a/firmware/controllers/algo/antilag_system_state.txt b/firmware/controllers/algo/antilag_system_state.txt index e8c64e0812..b998117969 100644 --- a/firmware/controllers/algo/antilag_system_state.txt +++ b/firmware/controllers/algo/antilag_system_state.txt @@ -5,7 +5,7 @@ bit ALSMinRPMCondition bit ALSMaxRPMCondition bit ALSMinCLTCondition bit ALSMaxCLTCondition -bit ALSMaxTPSCondition +bit ALSMaxThrottleIntentCondition bit isALSSwitchActivated bit ALSActivatePinState bit ALSSwitchCondition