diff --git a/firmware/controllers/engine_cycle/main_trigger_callback.cpp b/firmware/controllers/engine_cycle/main_trigger_callback.cpp index 97824ba665..98f7199079 100644 --- a/firmware/controllers/engine_cycle/main_trigger_callback.cpp +++ b/firmware/controllers/engine_cycle/main_trigger_callback.cpp @@ -36,12 +36,7 @@ static void handleFuel(efitick_t nowNt, float currentPhase, float nextPhase) { efiAssertVoid(ObdCode::CUSTOM_STACK_6627, getCurrentRemainingStack() > 128, "lowstck#3"); - LimpState limitedFuelState = getLimpManager()->allowInjection(); - - // todo: eliminate state copy logic by giving limpManager it's owm limp_manager.txt and leveraging LiveData - engine->outputChannels.fuelCutReason = (int8_t)limitedFuelState.reason; - bool limitedFuel = !limitedFuelState.value; - if (limitedFuel) { + if (!getLimpManager()->allowInjection().value) { return; } diff --git a/firmware/controllers/engine_cycle/spark_logic.cpp b/firmware/controllers/engine_cycle/spark_logic.cpp index 9ecff14644..61e7f168cd 100644 --- a/firmware/controllers/engine_cycle/spark_logic.cpp +++ b/firmware/controllers/engine_cycle/spark_logic.cpp @@ -374,11 +374,7 @@ void onTriggerEventSparkLogic(efitick_t edgeTimestamp, float currentPhase, float return; } - LimpState limitedSparkState = getLimpManager()->allowIgnition(); - - // todo: eliminate state copy logic by giving limpManager it's owm limp_manager.txt and leveraging LiveData - engine->outputChannels.sparkCutReason = (int8_t)limitedSparkState.reason; - bool limitedSpark = !limitedSparkState.value; + bool limitedSpark = !getLimpManager()->allowIgnition().value; const floatms_t dwellMs = engine->ignitionState.getDwell(); if (std::isnan(dwellMs) || dwellMs <= 0) { diff --git a/firmware/controllers/limp_manager.cpp b/firmware/controllers/limp_manager.cpp index cef930a9ae..4a6c4938fa 100644 --- a/firmware/controllers/limp_manager.cpp +++ b/firmware/controllers/limp_manager.cpp @@ -221,6 +221,10 @@ todo AndreiKA this change breaks 22 unit tests? // Tracks the last time any cut happened m_lastCutTime.reset(nowNt); } + + // Update output channels + engine->outputChannels.fuelCutReason = static_cast(allowInjection().reason); + engine->outputChannels.sparkCutReason = static_cast(allowIgnition().reason); } void LimpManager::onIgnitionStateChanged(bool ignitionOn) {