diff --git a/firmware/controllers/system/timer/scheduler.h b/firmware/controllers/system/timer/scheduler.h index 352504056a..681c328a6a 100644 --- a/firmware/controllers/system/timer/scheduler.h +++ b/firmware/controllers/system/timer/scheduler.h @@ -64,6 +64,6 @@ struct ExecutorInterface { */ virtual void scheduleByTimestamp(const char *msg, scheduling_s *scheduling, efitimeus_t timeUs, action_s action) = 0; virtual void scheduleByTimestampNt(const char *msg, scheduling_s *scheduling, efitime_t timeUs, action_s action) = 0; - virtual void scheduleForLater(scheduling_s *scheduling, int delayUs, action_s action) = 0; + virtual void scheduleForLater(const char *msg, scheduling_s *scheduling, int delayUs, action_s action) = 0; virtual void cancel(scheduling_s* scheduling) = 0; }; diff --git a/firmware/controllers/system/timer/signal_executor_sleep.cpp b/firmware/controllers/system/timer/signal_executor_sleep.cpp index 69f29567b3..96db12062b 100644 --- a/firmware/controllers/system/timer/signal_executor_sleep.cpp +++ b/firmware/controllers/system/timer/signal_executor_sleep.cpp @@ -34,7 +34,7 @@ bool printSchedulerDebug = true; #if EFI_SIGNAL_EXECUTOR_SLEEP void SleepExecutor::scheduleByTimestamp(const char *msg, scheduling_s *scheduling, efitimeus_t timeUs, action_s action) { - scheduleForLater(scheduling, timeUs - getTimeNowUs(), action); + scheduleForLater(msg, scheduling, timeUs - getTimeNowUs(), action); } void SleepExecutor::scheduleByTimestampNt(const char *msg, scheduling_s* scheduling, efitick_t timeNt, action_s action) { @@ -87,7 +87,7 @@ static void doScheduleForLater(scheduling_s *scheduling, int delayUs, action_s a chVTSetI(&scheduling->timer, delaySt, (vtfunc_t)timerCallback, scheduling); } -void SleepExecutor::scheduleForLater(scheduling_s *scheduling, int delayUs, action_s action) { +void SleepExecutor::scheduleForLater(const char *msg, scheduling_s *scheduling, int delayUs, action_s action) { doScheduleForLater(scheduling, delayUs, action); } diff --git a/firmware/controllers/system/timer/signal_executor_sleep.h b/firmware/controllers/system/timer/signal_executor_sleep.h index 952781a023..095c71626e 100644 --- a/firmware/controllers/system/timer/signal_executor_sleep.h +++ b/firmware/controllers/system/timer/signal_executor_sleep.h @@ -13,6 +13,6 @@ class SleepExecutor : public ExecutorInterface { public: void scheduleByTimestamp(const char *msg, scheduling_s *scheduling, efitimeus_t timeUs, action_s action) override; void scheduleByTimestampNt(const char *msg, scheduling_s *scheduling, efitick_t timeNt, action_s action) override; - void scheduleForLater(scheduling_s *scheduling, int delayUs, action_s action) override; + void scheduleForLater(const char *msg, scheduling_s *scheduling, int delayUs, action_s action) override; void cancel(scheduling_s* s) override; }; diff --git a/firmware/controllers/system/timer/single_timer_executor.cpp b/firmware/controllers/system/timer/single_timer_executor.cpp index 3275f33328..b76cb2560c 100644 --- a/firmware/controllers/system/timer/single_timer_executor.cpp +++ b/firmware/controllers/system/timer/single_timer_executor.cpp @@ -45,8 +45,8 @@ SingleTimerExecutor::SingleTimerExecutor() { } -void SingleTimerExecutor::scheduleForLater(scheduling_s *scheduling, int delayUs, action_s action) { - scheduleByTimestamp("scheduleForLater", scheduling, getTimeNowUs() + delayUs, action); +void SingleTimerExecutor::scheduleForLater(const char *msg, scheduling_s *scheduling, int delayUs, action_s action) { + scheduleByTimestamp(msg, scheduling, getTimeNowUs() + delayUs, action); } /** diff --git a/firmware/controllers/system/timer/single_timer_executor.h b/firmware/controllers/system/timer/single_timer_executor.h index 8465d5d769..e8c055cd0e 100644 --- a/firmware/controllers/system/timer/single_timer_executor.h +++ b/firmware/controllers/system/timer/single_timer_executor.h @@ -15,7 +15,7 @@ public: SingleTimerExecutor(); void scheduleByTimestamp(const char *msg, scheduling_s *scheduling, efitimeus_t timeUs, action_s action) override; void scheduleByTimestampNt(const char *msg, scheduling_s *scheduling, efitime_t timeNt, action_s action) override; - void scheduleForLater(scheduling_s *scheduling, int delayUs, action_s action) override; + void scheduleForLater(const char *msg, scheduling_s *scheduling, int delayUs, action_s action) override; void cancel(scheduling_s* scheduling) override; void onTimerCallback(); diff --git a/firmware/hw_layer/microsecond_timer/microsecond_timer.cpp b/firmware/hw_layer/microsecond_timer/microsecond_timer.cpp index 157b72dde3..aa95bdc315 100644 --- a/firmware/hw_layer/microsecond_timer/microsecond_timer.cpp +++ b/firmware/hw_layer/microsecond_timer/microsecond_timer.cpp @@ -132,7 +132,7 @@ static void watchDogBuddyCallback(void*) { * watchdog happy by ensuring that we have scheduler activity even in case of very broken configuration * without any PWM or input pins */ - engine->executor.scheduleForLater(&watchDogBuddy, MS2US(1000), watchDogBuddyCallback); + engine->executor.scheduleForLater("watch", &watchDogBuddy, MS2US(1000), watchDogBuddyCallback); } static volatile bool testSchedulingHappened = false; @@ -158,7 +158,7 @@ static void validateHardwareTimer() { testSchedulingStart = currentTimeMillis(); // to save RAM let's use 'watchDogBuddy' here once before we enable watchdog - engine->executor.scheduleForLater(&watchDogBuddy, MS2US(TEST_CALLBACK_DELAY), timerValidationCallback); + engine->executor.scheduleForLater("hw-validate", &watchDogBuddy, MS2US(TEST_CALLBACK_DELAY), timerValidationCallback); chThdSleepMilliseconds(TEST_CALLBACK_DELAY + 2); if (!testSchedulingHappened) { diff --git a/firmware/hw_layer/servo.cpp b/firmware/hw_layer/servo.cpp index 8d1c3402e3..096046ba92 100644 --- a/firmware/hw_layer/servo.cpp +++ b/firmware/hw_layer/servo.cpp @@ -46,7 +46,7 @@ static msg_t seThread(void *arg) { float durationMs = 0 + position * 0.02f; - engine->executor.scheduleForLater(&servoTurnSignalOff, (int)MS2US(durationMs), { &servoTachPinLow, pin }); + engine->executor.scheduleForLater("servo", &servoTurnSignalOff, (int)MS2US(durationMs), { &servoTachPinLow, pin }); chThdSleepMilliseconds(19); diff --git a/unit_tests/global_execution_queue.cpp b/unit_tests/global_execution_queue.cpp index 0902d3a785..303ab01d51 100644 --- a/unit_tests/global_execution_queue.cpp +++ b/unit_tests/global_execution_queue.cpp @@ -15,13 +15,13 @@ TestExecutor::~TestExecutor() { clear(); } -void TestExecutor::scheduleForLater(scheduling_s *scheduling, int delayUs, action_s action) { +void TestExecutor::scheduleForLater(const char *msg, scheduling_s *scheduling, int delayUs, action_s action) { if (debugSignalExecutor) { printf("scheduleTask %d\r\n", delayUs); } if (m_mockExecutor) { - m_mockExecutor->scheduleForLater(scheduling, delayUs, action); + m_mockExecutor->scheduleForLater(msg, scheduling, delayUs, action); return; } diff --git a/unit_tests/global_execution_queue.h b/unit_tests/global_execution_queue.h index 90787ef96e..79fd4834fc 100644 --- a/unit_tests/global_execution_queue.h +++ b/unit_tests/global_execution_queue.h @@ -16,7 +16,7 @@ public: void scheduleByTimestamp(const char *msg, scheduling_s *scheduling, efitimeus_t timeUs, action_s action) override; void scheduleByTimestampNt(const char *msg, scheduling_s *scheduling, efitick_t timeNt, action_s action) override; - void scheduleForLater(scheduling_s *scheduling, int delayUs, action_s action) override; + void scheduleForLater(const char *msg, scheduling_s *scheduling, int delayUs, action_s action) override; void cancel(scheduling_s* scheduling) override; void clear(); diff --git a/unit_tests/mocks.h b/unit_tests/mocks.h index fb637373e0..a47add3f6b 100644 --- a/unit_tests/mocks.h +++ b/unit_tests/mocks.h @@ -77,7 +77,7 @@ public: MOCK_METHOD(void, scheduleByTimestamp, (const char *msg, scheduling_s *scheduling, efitimeus_t timeUs, action_s action), (override)); MOCK_METHOD(void, scheduleByTimestampNt, (const char *msg, scheduling_s *scheduling, efitime_t timeUs, action_s action), (override)); - MOCK_METHOD(void, scheduleForLater, (scheduling_s *scheduling, int delayUs, action_s action), (override)); + MOCK_METHOD(void, scheduleForLater, (const char *msg, scheduling_s *scheduling, int delayUs, action_s action), (override)); MOCK_METHOD(void, cancel, (scheduling_s*), (override)); };