only:removing scheduleForLater, making API simpler
This commit is contained in:
parent
485a6cf22d
commit
5b1e70f422
|
@ -98,7 +98,6 @@ struct ExecutorInterface {
|
||||||
*/
|
*/
|
||||||
virtual void scheduleByTimestamp(const char *msg, scheduling_s *scheduling, efitimeus_t timeUs, action_s action) = 0;
|
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 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;
|
virtual void cancel(scheduling_s* scheduling) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -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
|
* @brief Schedule an event at specific delay after now
|
||||||
*
|
*
|
||||||
|
|
|
@ -15,7 +15,6 @@ public:
|
||||||
SingleTimerExecutor();
|
SingleTimerExecutor();
|
||||||
void scheduleByTimestamp(const char *msg, scheduling_s *scheduling, efitimeus_t timeUs, action_s action) override;
|
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 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 cancel(scheduling_s* scheduling) override;
|
||||||
|
|
||||||
void onTimerCallback();
|
void onTimerCallback();
|
||||||
|
|
|
@ -106,10 +106,6 @@ static void doScheduleForLater(scheduling_s *scheduling, int delayUs, action_s a
|
||||||
chVTSetI(&scheduling->timer, delaySt, (vtfunc_t)timerCallback, ctx);
|
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) {
|
void SleepExecutor::cancel(scheduling_s* s) {
|
||||||
chibios_rt::CriticalSectionLocker csl;
|
chibios_rt::CriticalSectionLocker csl;
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,5 @@ class SleepExecutor : public ExecutorInterface {
|
||||||
public:
|
public:
|
||||||
void scheduleByTimestamp(const char *msg, scheduling_s *scheduling, efitimeus_t timeUs, action_s action) override;
|
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 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;
|
void cancel(scheduling_s* s) override;
|
||||||
};
|
};
|
||||||
|
|
|
@ -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, 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, 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));
|
MOCK_METHOD(void, cancel, (scheduling_s*), (override));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -15,19 +15,6 @@ TestExecutor::~TestExecutor() {
|
||||||
clear();
|
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) {
|
int TestExecutor::executeAll(efitimeus_t nowUs) {
|
||||||
return schedulingQueue.executeAll(US2NT(nowUs));
|
return schedulingQueue.executeAll(US2NT(nowUs));
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,6 @@ public:
|
||||||
|
|
||||||
void scheduleByTimestamp(const char *msg, scheduling_s *scheduling, efitimeus_t timeUs, action_s action) override;
|
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 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 cancel(scheduling_s* scheduling) override;
|
||||||
|
|
||||||
void clear();
|
void clear();
|
||||||
|
|
Loading…
Reference in New Issue