From 888ece1749bea8289e931f01b0748f8bc30d5d09 Mon Sep 17 00:00:00 2001 From: rusefi Date: Sat, 4 Mar 2017 08:55:53 -0500 Subject: [PATCH] better variable name & docs --- firmware/controllers/trigger/trigger_decoder.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/firmware/controllers/trigger/trigger_decoder.cpp b/firmware/controllers/trigger/trigger_decoder.cpp index 51ae72937c..d04d692eaf 100644 --- a/firmware/controllers/trigger/trigger_decoder.cpp +++ b/firmware/controllers/trigger/trigger_decoder.cpp @@ -676,13 +676,19 @@ uint32_t findTriggerZeroEventIndex(TriggerState *state, TriggerShape * shape, // todo: should this variable be declared 'static' to reduce stack usage? TriggerStimulatorHelper helper; - uint32_t index = helper.doFindTrigger(shape, triggerConfig, state PASS_ENGINE_PARAMETER); - if (index == EFI_ERROR_CODE) { + uint32_t syncIndex = helper.doFindTrigger(shape, triggerConfig, state PASS_ENGINE_PARAMETER); + if (syncIndex == EFI_ERROR_CODE) { isInitializingTrigger = false; - return index; + return syncIndex; } efiAssert(state->getTotalRevolutionCounter() == 1, "totalRevolutionCounter", EFI_ERROR_CODE); +#if EFI_UNIT_TEST || defined(__DOXYGEN__) + if (printTriggerDebug) { + printf("syncIndex located %d\r\n", syncIndex); + } +#endif /* EFI_UNIT_TEST */ + /** * Now that we have just located the synch point, we can simulate the whole cycle * in order to calculate expected duty cycle @@ -691,10 +697,10 @@ uint32_t findTriggerZeroEventIndex(TriggerState *state, TriggerShape * shape, */ state->cycleCallback = onFindIndex; - helper.assertSyncPositionAndSetDutyCycle(index, state, shape, triggerConfig PASS_ENGINE_PARAMETER); + helper.assertSyncPositionAndSetDutyCycle(syncIndex, state, shape, triggerConfig PASS_ENGINE_PARAMETER); isInitializingTrigger = false; - return index % shape->getSize(); + return syncIndex % shape->getSize(); } void initTriggerDecoderLogger(Logging *sharedLogger) {