From e6bac27c70ef03608fc2a84bd983f7ba27533120 Mon Sep 17 00:00:00 2001 From: rusefillc Date: Sun, 4 Oct 2020 02:09:12 -0400 Subject: [PATCH] 60/2 perf grab #1850 unused parameter --- firmware/controllers/engine_cycle/main_trigger_callback.cpp | 5 +---- firmware/controllers/engine_cycle/main_trigger_callback.h | 2 +- firmware/controllers/engine_cycle/map_averaging.cpp | 6 ++++-- firmware/controllers/engine_cycle/map_averaging.h | 2 +- firmware/controllers/engine_cycle/rpm_calculator.cpp | 3 +-- firmware/controllers/engine_cycle/rpm_calculator.h | 2 +- firmware/controllers/trigger/trigger_central.cpp | 6 +++--- 7 files changed, 12 insertions(+), 14 deletions(-) diff --git a/firmware/controllers/engine_cycle/main_trigger_callback.cpp b/firmware/controllers/engine_cycle/main_trigger_callback.cpp index db2bd03283..5633d1df0c 100644 --- a/firmware/controllers/engine_cycle/main_trigger_callback.cpp +++ b/firmware/controllers/engine_cycle/main_trigger_callback.cpp @@ -368,12 +368,9 @@ uint32_t *cyccnt = (uint32_t*) &DWT->CYCCNT; * This is the main trigger event handler. * Both injection and ignition are controlled from this method. */ -void mainTriggerCallback(trigger_event_e ckpSignalType, uint32_t trgEventIndex, efitick_t edgeTimestamp DECLARE_ENGINE_PARAMETER_SUFFIX) { +void mainTriggerCallback(uint32_t trgEventIndex, efitick_t edgeTimestamp DECLARE_ENGINE_PARAMETER_SUFFIX) { ScopePerf perf(PE::MainTriggerCallback); - (void) ckpSignalType; - - if (CONFIG(vvtMode) == MIATA_NB2 && ENGINE(triggerCentral.vvtSyncTimeNt) == 0) { // this is a bit spaghetti code for sure // do not spark & do not fuel until we have VVT sync. NB2 is a special case diff --git a/firmware/controllers/engine_cycle/main_trigger_callback.h b/firmware/controllers/engine_cycle/main_trigger_callback.h index 62e6e0201e..67ab309397 100644 --- a/firmware/controllers/engine_cycle/main_trigger_callback.h +++ b/firmware/controllers/engine_cycle/main_trigger_callback.h @@ -15,7 +15,7 @@ void initMainEventListener(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX); -void mainTriggerCallback(trigger_event_e ckpSignalType, uint32_t trgEventIndex, efitick_t edgeTimestamp DECLARE_ENGINE_PARAMETER_SUFFIX); +void mainTriggerCallback(uint32_t trgEventIndex, efitick_t edgeTimestamp DECLARE_ENGINE_PARAMETER_SUFFIX); void startPrimeInjectionPulse(DECLARE_ENGINE_PARAMETER_SIGNATURE); diff --git a/firmware/controllers/engine_cycle/map_averaging.cpp b/firmware/controllers/engine_cycle/map_averaging.cpp index 071100984a..ba5d3ecee8 100644 --- a/firmware/controllers/engine_cycle/map_averaging.cpp +++ b/firmware/controllers/engine_cycle/map_averaging.cpp @@ -267,14 +267,13 @@ void refreshMapAveragingPreCalc(DECLARE_ENGINE_PARAMETER_SIGNATURE) { /** * Shaft Position callback used to schedule start and end of MAP averaging */ -void mapAveragingTriggerCallback(trigger_event_e ckpEventType, +void mapAveragingTriggerCallback( uint32_t index, efitick_t edgeTimestamp DECLARE_ENGINE_PARAMETER_SUFFIX) { ScopePerf perf(PE::MapAveragingTriggerCallback); #if EFI_ENGINE_CONTROL // this callback is invoked on interrupt thread - UNUSED(ckpEventType); if (index != (uint32_t)CONFIG(mapAveragingSchedulingAtIndex)) return; @@ -290,12 +289,14 @@ void mapAveragingTriggerCallback(trigger_event_e ckpEventType, measurementsPerRevolution = measurementsPerRevolutionCounter; measurementsPerRevolutionCounter = 0; + // todo: this could be pre-calculated int samplingCount = CONFIG(measureMapOnlyInOneCylinder) ? 1 : engineConfiguration->specs.cylindersCount; for (int i = 0; i < samplingCount; i++) { angle_t samplingStart = ENGINE(engineState.mapAveragingStart[i]); angle_t samplingDuration = ENGINE(engineState.mapAveragingDuration); + // todo: this assertion could be moved out of trigger handler assertAngleRange(samplingDuration, "samplingDuration", CUSTOM_ERR_6563); if (samplingDuration <= 0) { warning(CUSTOM_MAP_ANGLE_PARAM, "map sampling angle should be positive"); @@ -310,6 +311,7 @@ void mapAveragingTriggerCallback(trigger_event_e ckpEventType, return; } + // todo: pre-calculate samplingEnd for each cylinder fixAngle(samplingEnd, "samplingEnd", CUSTOM_ERR_6563); // only if value is already prepared int structIndex = getRevolutionCounter() % 2; diff --git a/firmware/controllers/engine_cycle/map_averaging.h b/firmware/controllers/engine_cycle/map_averaging.h index 3b0fe66b66..d09b493f81 100644 --- a/firmware/controllers/engine_cycle/map_averaging.h +++ b/firmware/controllers/engine_cycle/map_averaging.h @@ -18,7 +18,7 @@ void mapAveragingAdcCallback(adcsample_t newValue); void initMapAveraging(Logging *sharedLogger DECLARE_ENGINE_PARAMETER_SUFFIX); void refreshMapAveragingPreCalc(DECLARE_ENGINE_PARAMETER_SIGNATURE); -void mapAveragingTriggerCallback(trigger_event_e ckpEventType, +void mapAveragingTriggerCallback( uint32_t index, efitick_t edgeTimestamp DECLARE_ENGINE_PARAMETER_SUFFIX); #if EFI_TUNER_STUDIO diff --git a/firmware/controllers/engine_cycle/rpm_calculator.cpp b/firmware/controllers/engine_cycle/rpm_calculator.cpp index 160e0fd427..b028692f14 100644 --- a/firmware/controllers/engine_cycle/rpm_calculator.cpp +++ b/firmware/controllers/engine_cycle/rpm_calculator.cpp @@ -325,9 +325,8 @@ static void onTdcCallback(Engine *engine) { /** * This trigger callback schedules the actual physical TDC callback in relation to trigger synchronization point. */ -void tdcMarkCallback(trigger_event_e ckpSignalType, +void tdcMarkCallback( uint32_t index0, efitick_t edgeTimestamp DECLARE_ENGINE_PARAMETER_SUFFIX) { - (void) ckpSignalType; bool isTriggerSynchronizationPoint = index0 == 0; if (isTriggerSynchronizationPoint && ENGINE(isEngineChartEnabled)) { // two instances of scheduling_s are needed to properly handle event overlap diff --git a/firmware/controllers/engine_cycle/rpm_calculator.h b/firmware/controllers/engine_cycle/rpm_calculator.h index 6b33859a6a..2552788357 100644 --- a/firmware/controllers/engine_cycle/rpm_calculator.h +++ b/firmware/controllers/engine_cycle/rpm_calculator.h @@ -156,7 +156,7 @@ private: void rpmShaftPositionCallback(trigger_event_e ckpSignalType, uint32_t index, efitick_t edgeTimestamp DECLARE_ENGINE_PARAMETER_SUFFIX); -void tdcMarkCallback(trigger_event_e ckpSignalType, +void tdcMarkCallback( uint32_t index0, efitick_t edgeTimestamp DECLARE_ENGINE_PARAMETER_SUFFIX); /** diff --git a/firmware/controllers/trigger/trigger_central.cpp b/firmware/controllers/trigger/trigger_central.cpp index ffb59dce0a..861cae13cb 100644 --- a/firmware/controllers/trigger/trigger_central.cpp +++ b/firmware/controllers/trigger/trigger_central.cpp @@ -489,12 +489,12 @@ void TriggerCentral::handleShaftSignal(trigger_event_e signal, efitick_t timesta rpmShaftPositionCallback(signal, triggerIndexForListeners, timestamp PASS_ENGINE_PARAMETER_SUFFIX); #if !EFI_UNIT_TEST - tdcMarkCallback(signal, triggerIndexForListeners, timestamp PASS_ENGINE_PARAMETER_SUFFIX); + tdcMarkCallback(triggerIndexForListeners, timestamp PASS_ENGINE_PARAMETER_SUFFIX); #endif #if !EFI_UNIT_TEST #if EFI_SHAFT_POSITION_INPUT - mapAveragingTriggerCallback(signal, triggerIndexForListeners, timestamp PASS_ENGINE_PARAMETER_SUFFIX); + mapAveragingTriggerCallback(triggerIndexForListeners, timestamp PASS_ENGINE_PARAMETER_SUFFIX); #endif /* EFI_SHAFT_POSITION_INPUT */ #endif /* EFI_UNIT_TEST */ @@ -509,7 +509,7 @@ void TriggerCentral::handleShaftSignal(trigger_event_e signal, efitick_t timesta (listener)(signal, triggerIndexForListeners, timestamp PASS_ENGINE_PARAMETER_SUFFIX); } - mainTriggerCallback(signal, triggerIndexForListeners, timestamp PASS_ENGINE_PARAMETER_SUFFIX); + mainTriggerCallback(triggerIndexForListeners, timestamp PASS_ENGINE_PARAMETER_SUFFIX); }