7 decltype(head) current;
9 LL_FOREACH2(head, current, nextToothEvent) {
10 if (++counter > QUEUE_LENGTH_LIMIT) {
15 if (current == element) {
30 event->setAngle(angle);
42 efitick_t edgeTimestamp,
45 float currentPhase,
float nextPhase) {
46 event->setAngle(angle);
71 criticalError(
"Negative angle %s %f", msg, event->
getAngle());
74 event->action = action;
77 chibios_rt::CriticalSectionLocker csl;
91 efitick_t edgeTimestamp,
float currentPhase,
float nextPhase) {
102 chibios_rt::CriticalSectionLocker csl;
108 LL_FOREACH_SAFE2(keephead, current, tmp, nextToothEvent)
120 LL_DELETE2(keephead, current, nextToothEvent);
124#if SPARK_EXTREME_LOGGING
125 efiPrintf(
"time to invoke [%.1f, %.1f) %d %d",
146 chibios_rt::CriticalSectionLocker csl;
159 float angleOffset = this->
enginePhase - currentPhase;
160 if (angleOffset < 0) {
178 criticalError(
"getElementAtIndexForUnitText: null");
SingleTimerExecutor scheduler
void cancel(scheduling_s *scheduling) override
Cancel the specified scheduling_s so that, if currently scheduled, it does not execute.
AngleBasedEvent * m_angleBasedEventsHead
bool assertNotInList(AngleBasedEvent *head, AngleBasedEvent *element)
AngleBasedEvent * getElementAtIndexForUnitTest(int index)
void scheduleEventsUntilNextTriggerTooth(float rpm, efitick_t edgeTimestamp, float currentPhase, float nextPhase)
bool scheduleOrQueue(const char *msg, AngleBasedEvent *event, efitick_t edgeTimestamp, angle_t angle, action_s action, float currentPhase, float nextPhase)
void schedule(const char *msg, AngleBasedEvent *event, angle_t angle, action_s const &action)
bool isPhaseInRange(float test, float current, float next)
efitimeus_t getTimeNowUs()
int time2print(int64_t time)
static EngineAccessor engine
bool warning(ObdCode code, const char *fmt,...)
void firmwareError(ObdCode code, const char *fmt,...)
@ CUSTOM_RE_ADDING_INTO_EXECUTION_QUEUE
@ CUSTOM_ERR_LOOPED_QUEUE
efitick_t scheduleByAngle(scheduling_s *timer, efitick_t nowNt, angle_t angle, action_s const &action)
bool shouldSchedule(float currentPhase, float nextPhase) const
float getAngleFromNow(float currentPhase) const
AngleBasedEvent * nextToothEvent
scheduling_s eventScheduling