From 2b80929ac6676577157f934ea65809535dccba57 Mon Sep 17 00:00:00 2001 From: rusefillc Date: Wed, 21 Feb 2024 17:31:02 -0500 Subject: [PATCH] only:reducing unit test logging --- .../engine_cycle/main_trigger_callback.cpp | 2 +- firmware/controllers/system/timer/event_queue.cpp | 2 +- firmware/controllers/trigger/trigger_decoder.cpp | 12 ++++++------ unit_tests/main.cpp | 4 +++- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/firmware/controllers/engine_cycle/main_trigger_callback.cpp b/firmware/controllers/engine_cycle/main_trigger_callback.cpp index 95750564bf..10f6d3697c 100644 --- a/firmware/controllers/engine_cycle/main_trigger_callback.cpp +++ b/firmware/controllers/engine_cycle/main_trigger_callback.cpp @@ -197,7 +197,7 @@ void InjectionEvent::onTriggerTooth(efitick_t nowNt, float currentPhase, float n getExecutorInterface()->scheduleByTimestampNt("inj stage 2", nullptr, turnOffTimeStage2, endActionStage2); } -#if EFI_UNIT_TEST +#if EFI_DEFAILED_LOGGING printf("scheduling injection angle=%.2f/delay=%d injectionDuration=%d %d\r\n", angleFromNow, (int)NT2US(startTime - nowNt), (int)durationUsStage1, (int)durationUsStage2); #endif #if EFI_DEFAILED_LOGGING diff --git a/firmware/controllers/system/timer/event_queue.cpp b/firmware/controllers/system/timer/event_queue.cpp index 7852c0fbf4..5515ec957c 100644 --- a/firmware/controllers/system/timer/event_queue.cpp +++ b/firmware/controllers/system/timer/event_queue.cpp @@ -250,7 +250,7 @@ bool EventQueue::executeOne(efitick_t now) { tryReturnScheduling(current); current = nullptr; -#if EFI_UNIT_TEST +#if EFI_DEFAILED_LOGGING printf("QUEUE: execute current=%d param=%d\r\n", (uintptr_t)current, (uintptr_t)action.getArgument()); #endif diff --git a/firmware/controllers/trigger/trigger_decoder.cpp b/firmware/controllers/trigger/trigger_decoder.cpp index b02d61e069..eda799a40d 100644 --- a/firmware/controllers/trigger/trigger_decoder.cpp +++ b/firmware/controllers/trigger/trigger_decoder.cpp @@ -305,11 +305,11 @@ bool TriggerDecoderBase::validateEventCounters(const TriggerWaveform& triggerSha isDecodingError |= (currentCycle.eventCount[i] != triggerShape.getExpectedEventCount((TriggerWheel)i)); } -#if EFI_UNIT_TEST +#if EFI_DEFAILED_LOGGING printf("validateEventCounters: isDecodingError=%d\n", isDecodingError); if (isDecodingError) { for (int i = 0;i < PWM_PHASE_MAX_WAVE_PER_PWM;i++) { - printf("count: cur=%d exp=%d\n", currentCycle.eventCount[i], triggerShape.getExpectedEventCount((TriggerWheel)i)); + printf(" count: cur=%d exp=%d\n", currentCycle.eventCount[i], triggerShape.getExpectedEventCount((TriggerWheel)i)); } } #endif /* EFI_UNIT_TEST */ @@ -344,7 +344,7 @@ void TriggerDecoderBase::onShaftSynchronization( static bool shouldConsiderEdge(const TriggerWaveform& triggerShape, TriggerWheel triggerWheel, TriggerValue edge) { if (triggerWheel != TriggerWheel::T_PRIMARY && triggerShape.useOnlyPrimaryForSync) { - // Non-primary events ignored + // Non-primary events ignored return false; } @@ -377,7 +377,7 @@ expected TriggerDecoderBase::decodeTriggerEvent( const trigger_event_e signal, const efitick_t nowNt) { ScopePerf perf(PE::DecodeTriggerEvent); - + if (previousEventTimer.getElapsedSecondsAndReset(nowNt) > 1) { /** * We are here if there is a time gap between now and previous shaft event - that means the engine is not running. @@ -634,7 +634,7 @@ bool TriggerDecoderBase::isSyncPoint(const TriggerWaveform& triggerShape, trigge // Miata NB needs a special decoder. // The problem is that the crank wheel only has 4 teeth, also symmetrical, so the pattern // is long-short-long-short for one crank rotation. - // A quick acceleration can result in two successive "short gaps", so we see + // A quick acceleration can result in two successive "short gaps", so we see // long-short-short-short-long instead of the correct long-short-long-short-long // This logic expands the lower bound on a "long" tooth, then compares the last // tooth to the current one. @@ -670,7 +670,7 @@ bool TriggerDecoderBase::isSyncPoint(const TriggerWaveform& triggerShape, trigge // toothDurations[i] / toothDurations[i+1] > from // is an equivalent comparison to // toothDurations[i] > toothDurations[i+1] * from - bool isGapCondition = + bool isGapCondition = (toothDurations[i] > toothDurations[i + 1] * from && toothDurations[i] < toothDurations[i + 1] * to); diff --git a/unit_tests/main.cpp b/unit_tests/main.cpp index 32a37468b1..836519e108 100644 --- a/unit_tests/main.cpp +++ b/unit_tests/main.cpp @@ -23,5 +23,7 @@ GTEST_API_ int main(int argc, char **argv) { //::testing::GTEST_FLAG(filter) = "*AllTriggersFixture*"; int result = RUN_ALL_TESTS(); // windows ERRORLEVEL in Jenkins batch file seems to want negative value to detect failure - return result == 0 ? 0 : -1; + int returnCode = result == 0 ? 0 : -1; + printf("DONE returning %d\n", returnCode); + return returnCode; }