From 1903462b037fda9dab5a969bddaa6964207a38c2 Mon Sep 17 00:00:00 2001 From: rusEfi Date: Mon, 31 Oct 2016 19:02:32 -0400 Subject: [PATCH] auto-sync --- firmware/controllers/trigger/spark_logic.cpp | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/firmware/controllers/trigger/spark_logic.cpp b/firmware/controllers/trigger/spark_logic.cpp index 8d7cff9978..9fefc3764b 100644 --- a/firmware/controllers/trigger/spark_logic.cpp +++ b/firmware/controllers/trigger/spark_logic.cpp @@ -25,6 +25,9 @@ int isIgnitionTimingError(void) { } void turnSparkPinLow(NamedOutputPin *output) { +#if SPARK_EXTREME_LOGGING || defined(__DOXYGEN__) + scheduleMsg(logger, "spark goes low %d %s %d", getRevolutionCounter(), output->name, (int)getTimeNowUs()); +#endif /* FUEL_MATH_EXTREME_LOGGING */ turnPinLow(output); #if EFI_PROD_CODE || defined(__DOXYGEN__) if (CONFIG(dizzySparkOutputPin) != GPIO_UNASSIGNED) { @@ -34,6 +37,9 @@ void turnSparkPinLow(NamedOutputPin *output) { } void turnSparkPinHigh(NamedOutputPin *output) { +#if SPARK_EXTREME_LOGGING || defined(__DOXYGEN__) + scheduleMsg(logger, "spark goes high %d %s %d", getRevolutionCounter(), output->name, (int)getTimeNowUs()); +#endif /* FUEL_MATH_EXTREME_LOGGING */ turnPinHigh(output); #if EFI_PROD_CODE || defined(__DOXYGEN__) if (CONFIG(dizzySparkOutputPin) != GPIO_UNASSIGNED) { @@ -78,7 +84,7 @@ static ALWAYS_INLINE void handleSparkEvent(bool limitedSpark, uint32_t trgEventI #endif #if SPARK_EXTREME_LOGGING || defined(__DOXYGEN__) - scheduleMsg(logger, "sparkUp ind=%d %d %s", trgEventIndex, getRevolutionCounter(), iEvent->output->name); + scheduleMsg(logger, "sparkUp ind=%d %d %s %d", trgEventIndex, getRevolutionCounter(), iEvent->output->name, (int)getTimeNowUs()); #endif /* FUEL_MATH_EXTREME_LOGGING */ /** @@ -105,20 +111,24 @@ static ALWAYS_INLINE void handleSparkEvent(bool limitedSpark, uint32_t trgEventI #endif #if SPARK_EXTREME_LOGGING || defined(__DOXYGEN__) - scheduleMsg(logger, "scheduling sparkDown ind=%d %d %s", trgEventIndex, getRevolutionCounter(), iEvent->output->name); + scheduleMsg(logger, "scheduling sparkDown ind=%d %d %s %d", trgEventIndex, getRevolutionCounter(), iEvent->output->name, (int)getTimeNowUs()); #endif /* FUEL_MATH_EXTREME_LOGGING */ scheduleTask(true, "spark1 down", sDown, (int) timeTillIgnitionUs, (schfunc_t) &turnSparkPinLow, iEvent->output); } else { #if SPARK_EXTREME_LOGGING || defined(__DOXYGEN__) - scheduleMsg(logger, "to queue sparkDown ind=%d %d %s", trgEventIndex, getRevolutionCounter(), iEvent->output->name); + scheduleMsg(logger, "to queue sparkDown ind=%d %d %s %d", trgEventIndex, getRevolutionCounter(), iEvent->output->name, (int)getTimeNowUs()); #endif /* FUEL_MATH_EXTREME_LOGGING */ /** * Spark should be scheduled in relation to some future trigger event, this way we get better firing precision */ bool isPending = assertNotInList(ENGINE(iHead), iEvent); - if (isPending) + if (isPending) { +#if SPARK_EXTREME_LOGGING || defined(__DOXYGEN__) + scheduleMsg(logger, "not adding to queue sparkDown ind=%d %d %s %d", trgEventIndex, getRevolutionCounter(), iEvent->output->name, (int)getTimeNowUs()); +#endif /* FUEL_MATH_EXTREME_LOGGING */ return; + } LL_APPEND(ENGINE(iHead), iEvent); } @@ -186,7 +196,7 @@ void handleSpark(int revolutionIndex, bool limitedSpark, uint32_t trgEventIndex, scheduling_s * sDown = ¤t->signalTimerDown; #if SPARK_EXTREME_LOGGING || defined(__DOXYGEN__) - scheduleMsg(logger, "time to sparkDown ind=%d %d %s", trgEventIndex, getRevolutionCounter(), current->output->name); + scheduleMsg(logger, "time to sparkDown ind=%d %d %s %d", trgEventIndex, getRevolutionCounter(), current->output->name, (int)getTimeNowUs()); #endif /* FUEL_MATH_EXTREME_LOGGING */