From da347433323b3d8461ea640007fdc3ac57ef95a7 Mon Sep 17 00:00:00 2001 From: rusefi Date: Thu, 25 Apr 2024 17:45:14 -0400 Subject: [PATCH] only:minor progress --- firmware/controllers/core/error_handling.h | 4 ++-- firmware/hw_layer/microsecond_timer/microsecond_timer.cpp | 6 ++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/firmware/controllers/core/error_handling.h b/firmware/controllers/core/error_handling.h index e6b04ce09b..4e20c07fe6 100644 --- a/firmware/controllers/core/error_handling.h +++ b/firmware/controllers/core/error_handling.h @@ -50,8 +50,8 @@ int getRusEfiVersion(void); #define efiAssert(code, condition, message, result) { if (!(condition)) { firmwareError(code, message); return result; } } #define efiAssertVoid(code, condition, message) { if (!(condition)) { firmwareError(code, message); return; } } #else /* EFI_ENABLE_ASSERTS */ - #define efiAssert(code, condition, message, result) { } - #define efiAssertVoid(code, condition, message) { UNUSED(condition);} + #define efiAssert(code, condition, message, result) { UNUSED(code);UNUSED(condition);UNUSED(message);UNUSED(result); } + #define efiAssertVoid(code, condition, message) { UNUSED(condition);UNUSED(message);} #endif /* EFI_ENABLE_ASSERTS */ #define criticalAssert(condition, message, result) efiAssert(ObdCode::OBD_PCM_Processor_Fault, condition, message, result) diff --git a/firmware/hw_layer/microsecond_timer/microsecond_timer.cpp b/firmware/hw_layer/microsecond_timer/microsecond_timer.cpp index 001a0b5f30..a7882ecdaf 100644 --- a/firmware/hw_layer/microsecond_timer/microsecond_timer.cpp +++ b/firmware/hw_layer/microsecond_timer/microsecond_timer.cpp @@ -39,8 +39,6 @@ static bool isTimerPending = false; static int timerCallbackCounter = 0; static int timerRestartCounter = 0; -static const char * msg; - static int timerFreezeCounter = 0; static int setHwTimerCounter = 0; static bool hwStarted = false; @@ -112,7 +110,7 @@ class MicrosecondTimerWatchdogController : public PeriodicTimerController { return; } - msg = isTimerPending ? "No_cb too long" : "Timer not awhile"; + const char* msg = isTimerPending ? "No_cb too long" : "Timer not awhile"; // 2 seconds of inactivity would not look right efiAssertVoid(ObdCode::CUSTOM_TIMER_WATCHDOG, nowNt < lastSetTimerTimeNt + 2 * CORE_CLOCK, msg); } @@ -141,7 +139,7 @@ static efitimems_t testSchedulingStart; static void timerValidationCallback(void*) { testSchedulingHappened = true; efitimems_t actualTimeSinceScheduling = (getTimeNowMs() - testSchedulingStart); - + if (absI(actualTimeSinceScheduling - TEST_CALLBACK_DELAY) > TEST_CALLBACK_DELAY * TIMER_PRECISION_THRESHOLD) { firmwareError(ObdCode::CUSTOM_ERR_TIMER_TEST_CALLBACK_WRONG_TIME, "hwTimer broken precision: %ld ms", actualTimeSinceScheduling); }