From 7da4196f9c413e81677d0f72f981008b5806f35b Mon Sep 17 00:00:00 2001 From: rusefi Date: Sun, 19 Jan 2020 03:49:35 -0500 Subject: [PATCH] NT not US not MS thank you Matt --- .../controllers/system/timer/single_timer_executor.cpp | 7 +++---- firmware/hw_layer/microsecond_timer.cpp | 2 +- firmware/hw_layer/microsecond_timer.h | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/firmware/controllers/system/timer/single_timer_executor.cpp b/firmware/controllers/system/timer/single_timer_executor.cpp index 2f117ac7fb..c2f06bad58 100644 --- a/firmware/controllers/system/timer/single_timer_executor.cpp +++ b/firmware/controllers/system/timer/single_timer_executor.cpp @@ -88,12 +88,11 @@ void SingleTimerExecutor::scheduleByTimestampNt(scheduling_s* scheduling, efitim ScopePerf perf(PE::SingleTimerExecutorScheduleByTimestamp); #if EFI_ENABLE_ASSERTS - int deltaTimeUs = nt - getTimeNowNt(); + int deltaTimeUs = NT2US(nt - getTimeNowNt()); - if (deltaTimeUs >= TOO_FAR_INTO_FUTURE) { + if (deltaTimeUs >= TOO_FAR_INTO_FUTURE_US) { // we are trying to set callback for too far into the future. This does not look right at all - // this does not pass CI :( - // firmwareError(CUSTOM_ERR_TASK_TIMER_OVERFLOW, "scheduleByTimestampNt() too far: %d", deltaTimeUs); + firmwareError(CUSTOM_ERR_TASK_TIMER_OVERFLOW, "scheduleByTimestampNt() too far: %d", deltaTimeUs); return; } #endif diff --git a/firmware/hw_layer/microsecond_timer.cpp b/firmware/hw_layer/microsecond_timer.cpp index 8b43f9fd8c..2d8db0d587 100644 --- a/firmware/hw_layer/microsecond_timer.cpp +++ b/firmware/hw_layer/microsecond_timer.cpp @@ -82,7 +82,7 @@ void setHardwareUsTimer(int32_t deltaTimeUs) { if (deltaTimeUs < 2) deltaTimeUs = 2; // for some reason '1' does not really work efiAssertVoid(CUSTOM_ERR_6681, deltaTimeUs > 0, "not positive deltaTimeUs"); - if (deltaTimeUs >= TOO_FAR_INTO_FUTURE) { + if (deltaTimeUs >= TOO_FAR_INTO_FUTURE_US) { // we are trying to set callback for too far into the future. This does not look right at all firmwareError(CUSTOM_ERR_TIMER_OVERFLOW, "setHardwareUsTimer() too far: %d", deltaTimeUs); // let's make this look special and NOT toggle enginePins.debugSetTimer diff --git a/firmware/hw_layer/microsecond_timer.h b/firmware/hw_layer/microsecond_timer.h index 52e02d7cc2..d20b710d6c 100644 --- a/firmware/hw_layer/microsecond_timer.h +++ b/firmware/hw_layer/microsecond_timer.h @@ -15,7 +15,7 @@ extern "C" void initMicrosecondTimer(void); void setHardwareUsTimer(int32_t deltaTimeUs); -#define TOO_FAR_INTO_FUTURE 10 * US_PER_SECOND +#define TOO_FAR_INTO_FUTURE_US 10 * US_PER_SECOND #ifdef __cplusplus }