only:removing scheduleByTimestamp, making API simpler
This commit is contained in:
parent
db0b61cd6c
commit
59bf19ede3
|
@ -96,7 +96,6 @@ struct ExecutorInterface {
|
|||
/**
|
||||
* see also scheduleByAngle
|
||||
*/
|
||||
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 cancel(scheduling_s* scheduling) = 0;
|
||||
};
|
||||
|
|
|
@ -45,20 +45,6 @@ SingleTimerExecutor::SingleTimerExecutor()
|
|||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Schedule an event at specific delay after now
|
||||
*
|
||||
* Invokes event callback after the specified amount of time.
|
||||
* callback would be executed either on ISR thread or current thread if we would need to execute right away
|
||||
*
|
||||
* @param [in, out] scheduling Data structure to keep this event in the collection.
|
||||
* @param [in] delayUs the number of microseconds before the output signal immediate output if delay is zero.
|
||||
* @param [in] dwell the number of ticks of output duration.
|
||||
*/
|
||||
void SingleTimerExecutor::scheduleByTimestamp(const char *msg, scheduling_s *scheduling, efitimeus_t timeUs, action_s action) {
|
||||
scheduleByTimestampNt(msg, scheduling, US2NT(timeUs), action);
|
||||
}
|
||||
|
||||
void SingleTimerExecutor::scheduleByTimestampNt(const char *msg, scheduling_s* scheduling, efitick_t nt, action_s action) {
|
||||
ScopePerf perf(PE::SingleTimerExecutorScheduleByTimestamp);
|
||||
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
class SingleTimerExecutor final : public ExecutorInterface {
|
||||
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 cancel(scheduling_s* scheduling) override;
|
||||
|
||||
|
|
|
@ -38,12 +38,8 @@ struct CallbackContext
|
|||
|
||||
static void doScheduleForLater(scheduling_s *scheduling, int delayUs, action_s action);
|
||||
|
||||
void SleepExecutor::scheduleByTimestamp(const char* /*msg*/, scheduling_s *scheduling, efitimeus_t timeUs, action_s action) {
|
||||
doScheduleForLater(scheduling, timeUs - getTimeNowUs(), action);
|
||||
}
|
||||
|
||||
void SleepExecutor::scheduleByTimestampNt(const char *msg, scheduling_s* scheduling, efitick_t timeNt, action_s action) {
|
||||
scheduleByTimestamp(msg, scheduling, NT2US(timeNt), action);
|
||||
doScheduleForLater(scheduling, NT2US(timeNt) - getTimeNowUs(), action);
|
||||
}
|
||||
|
||||
static void timerCallback(CallbackContext* ctx) {
|
||||
|
|
|
@ -11,7 +11,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 cancel(scheduling_s* s) override;
|
||||
};
|
||||
|
|
|
@ -80,7 +80,6 @@ public:
|
|||
MockExecutor();
|
||||
virtual ~MockExecutor();
|
||||
|
||||
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, cancel, (scheduling_s*), (override));
|
||||
};
|
||||
|
|
|
@ -35,23 +35,6 @@ scheduling_s* TestExecutor::getForUnitTest(int index) {
|
|||
return schedulingQueue.getElementAtIndexForUnitText(index);
|
||||
}
|
||||
|
||||
void TestExecutor::scheduleByTimestamp(const char *msg, scheduling_s *scheduling, efitimeus_t timeUs, action_s action) {
|
||||
if (timeUs < 0) {
|
||||
throw std::runtime_error("Negative timeUs not expected.");
|
||||
}
|
||||
|
||||
if (debugSignalExecutor) {
|
||||
printf("scheduleByTime %d\r\n", timeUs);
|
||||
}
|
||||
|
||||
if (m_mockExecutor) {
|
||||
m_mockExecutor->scheduleByTimestamp(msg, scheduling, timeUs, action);
|
||||
return;
|
||||
}
|
||||
|
||||
schedulingQueue.insertTask(scheduling, US2NT(timeUs), action);
|
||||
}
|
||||
|
||||
void TestExecutor::scheduleByTimestampNt(const char *msg, scheduling_s* scheduling, efitick_t timeNt, action_s action) {
|
||||
if (m_mockExecutor) {
|
||||
m_mockExecutor->scheduleByTimestampNt(msg, scheduling, timeNt, action);
|
||||
|
|
|
@ -15,7 +15,6 @@ class TestExecutor : public ExecutorInterface {
|
|||
public:
|
||||
~TestExecutor();
|
||||
|
||||
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 cancel(scheduling_s* scheduling) override;
|
||||
|
||||
|
|
Loading…
Reference in New Issue