From 6b95579706f7d5de1da7ec26529834fc333e1fc5 Mon Sep 17 00:00:00 2001 From: rusefillc Date: Sun, 4 Oct 2020 01:26:29 -0400 Subject: [PATCH] 60/2 perf grab #1850 --- firmware/controllers/engine_controller.cpp | 3 +++ firmware/controllers/engine_cycle/main_trigger_callback.cpp | 6 +----- firmware/controllers/trigger/trigger_central.cpp | 1 - 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/firmware/controllers/engine_controller.cpp b/firmware/controllers/engine_controller.cpp index eed064aa41..c61130b7cd 100644 --- a/firmware/controllers/engine_controller.cpp +++ b/firmware/controllers/engine_controller.cpp @@ -232,6 +232,9 @@ static void doPeriodicSlowCallback(DECLARE_ENGINE_PARAMETER_SIGNATURE) { engine->triggerCentral.vvtSyncTimeNt = 0; } + // for performance reasons this assertion related to mainTriggerCallback should better be here + efiAssertVoid(CUSTOM_IGN_MATH_STATE, !CONFIG(useOnlyRisingEdgeForTrigger) || CONFIG(ignMathCalculateAtIndex) % 2 == 0, "invalid ignMathCalculateAtIndex"); + /** * Update engine RPM state if needed (check timeouts). diff --git a/firmware/controllers/engine_cycle/main_trigger_callback.cpp b/firmware/controllers/engine_cycle/main_trigger_callback.cpp index b80b6d9e74..8169e5cf48 100644 --- a/firmware/controllers/engine_cycle/main_trigger_callback.cpp +++ b/firmware/controllers/engine_cycle/main_trigger_callback.cpp @@ -195,7 +195,6 @@ void InjectionEvent::onTriggerTooth(size_t trgEventIndex, int rpm, efitick_t now // set engine_type seems to be resetting those references (todo: where exactly? why exactly?) so an event during // engine_type would not end well efiAssertVoid(CUSTOM_ERR_ASSERT, engineConfiguration != nullptr, "assert#1"); - efiAssertVoid(CUSTOM_ERR_ASSERT, getCurrentRemainingStack() > 128, "assert#2"); uint32_t eventIndex = injectionStart.triggerEventIndex; // right after trigger change we are still using old & invalid fuel schedule. good news is we do not change trigger on the fly in real life @@ -392,8 +391,6 @@ static void mainTriggerCallback(trigger_event_e ckpSignalType, uint32_t trgEvent } #endif // HW_CHECK_MODE - efiAssertVoid(CUSTOM_STACK_6629, getCurrentRemainingStack() > EXPECTED_REMAINING_STACK, "lowstck#2a"); - #if EFI_CDM_INTEGRATION if (trgEventIndex == 0 && CONFIG(cdmInputPin) != GPIO_UNASSIGNED) { int cdmKnockValue = getCurrentCdmValue(engine->triggerCentral.triggerState.getTotalRevolutionCounter()); @@ -425,6 +422,7 @@ static void mainTriggerCallback(trigger_event_e ckpSignalType, uint32_t trgEvent bool limitedFuel = ENGINE(isRpmHardLimit); if (CONFIG(boostCutPressure) != 0) { + // todo: move part of this to periodicFast? probably not cool to decode MAP sensor inside trigger callback? if (getMap(PASS_ENGINE_PARAMETER_SIGNATURE) > CONFIG(boostCutPressure)) { limitedSpark = true; limitedFuel = true; @@ -452,8 +450,6 @@ static void mainTriggerCallback(trigger_event_e ckpSignalType, uint32_t trgEvent } } - efiAssertVoid(CUSTOM_IGN_MATH_STATE, !CONFIG(useOnlyRisingEdgeForTrigger) || CONFIG(ignMathCalculateAtIndex) % 2 == 0, "invalid ignMathCalculateAtIndex"); - if (trgEventIndex == (uint32_t)CONFIG(ignMathCalculateAtIndex)) { if (CONFIG(externalKnockSenseAdc) != EFI_ADC_NONE) { float externalKnockValue = getVoltageDivided("knock", engineConfiguration->externalKnockSenseAdc PASS_ENGINE_PARAMETER_SUFFIX); diff --git a/firmware/controllers/trigger/trigger_central.cpp b/firmware/controllers/trigger/trigger_central.cpp index afda853d93..d2418911ca 100644 --- a/firmware/controllers/trigger/trigger_central.cpp +++ b/firmware/controllers/trigger/trigger_central.cpp @@ -309,7 +309,6 @@ void hwHandleShaftSignal(trigger_event_e signal, efitick_t timestamp) { maxTriggerReentraint = triggerReentraint; triggerReentraint++; - efiAssertVoid(CUSTOM_ERR_6636, getCurrentRemainingStack() > 128, "lowstck#8"); ENGINE(triggerCentral).handleShaftSignal(signal, timestamp PASS_ENGINE_PARAMETER_SUFFIX); triggerReentraint--;