only:removing scheduleForLater, making API simpler

This commit is contained in:
Matthew Kennedy 2024-07-11 19:27:30 -04:00 committed by Andrey
parent 485a6cf22d
commit 5b1e70f422
8 changed files with 0 additions and 26 deletions

View File

@ -98,7 +98,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, efitick_t timeNt, 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;
};

View File

@ -45,10 +45,6 @@ SingleTimerExecutor::SingleTimerExecutor()
{
}
void SingleTimerExecutor::scheduleForLater(const char *msg, scheduling_s *scheduling, int delayUs, action_s action) {
scheduleByTimestamp(msg, scheduling, getTimeNowUs() + delayUs, action);
}
/**
* @brief Schedule an event at specific delay after now
*

View File

@ -15,7 +15,6 @@ 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, efitick_t timeNt, 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();

View File

@ -106,10 +106,6 @@ static void doScheduleForLater(scheduling_s *scheduling, int delayUs, action_s a
chVTSetI(&scheduling->timer, delaySt, (vtfunc_t)timerCallback, ctx);
}
void SleepExecutor::scheduleForLater(const char *msg, scheduling_s *scheduling, int delayUs, action_s action) {
doScheduleForLater(scheduling, delayUs, action);
}
void SleepExecutor::cancel(scheduling_s* s) {
chibios_rt::CriticalSectionLocker csl;

View File

@ -13,6 +13,5 @@ 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(const char *msg, scheduling_s *scheduling, int delayUs, action_s action) override;
void cancel(scheduling_s* s) override;
};

View File

@ -82,7 +82,6 @@ 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, efitick_t timeNt, 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));
};

View File

@ -15,19 +15,6 @@ TestExecutor::~TestExecutor() {
clear();
}
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(msg, scheduling, delayUs, action);
return;
}
scheduleByTimestamp(msg, scheduling, getTimeNowUs() + delayUs, action);
}
int TestExecutor::executeAll(efitimeus_t nowUs) {
return schedulingQueue.executeAll(US2NT(nowUs));
}

View File

@ -17,7 +17,6 @@ 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(const char *msg, scheduling_s *scheduling, int delayUs, action_s action) override;
void cancel(scheduling_s* scheduling) override;
void clear();