From 648f115704d605a50eff6d47ed6ae192583d433d Mon Sep 17 00:00:00 2001 From: rusEfi Date: Sat, 13 Sep 2014 07:02:58 -0500 Subject: [PATCH] auto-sync --- firmware/config/engines/mazda_miata.cpp | 1 + .../system/SingleTimerExecutor.cpp | 22 +++++++++---------- .../controllers/system/SingleTimerExecutor.h | 2 +- firmware/controllers/system/event_queue.cpp | 6 ++--- firmware/controllers/system/event_queue.h | 3 +-- firmware/rusefi.cpp | 2 +- 6 files changed, 18 insertions(+), 18 deletions(-) diff --git a/firmware/config/engines/mazda_miata.cpp b/firmware/config/engines/mazda_miata.cpp index 561c426650..72028d58c8 100644 --- a/firmware/config/engines/mazda_miata.cpp +++ b/firmware/config/engines/mazda_miata.cpp @@ -333,6 +333,7 @@ void setMiata1996(engine_configuration_s *engineConfiguration, board_configurati boardConfiguration->ignitionPinMode = OM_DEFAULT; // harness is sequential but we have a limited board + engineConfiguration->crankingInjectionMode = IM_BATCH; engineConfiguration->injectionMode = IM_BATCH; boardConfiguration->injectionPins[0] = GPIOB_9; // Frankenstein: low side - inj #12 diff --git a/firmware/controllers/system/SingleTimerExecutor.cpp b/firmware/controllers/system/SingleTimerExecutor.cpp index 860cd72504..6ebfa886dd 100644 --- a/firmware/controllers/system/SingleTimerExecutor.cpp +++ b/firmware/controllers/system/SingleTimerExecutor.cpp @@ -43,12 +43,20 @@ void Executor::unlock(void) { unlockAnyContext(); } -void Executor::schedule(scheduling_s *scheduling, uint64_t nowUs, int delayUs, schfunc_t callback, void *param) { +void Executor::schedule(const char *prefix, scheduling_s *scheduling, uint64_t nowUs, int delayUs, schfunc_t callback, void *param) { + if (delayUs < 0) { + firmwareError("Negative delayUs %s: %d", prefix, delayUs); + return; + } + if (delayUs == 0) { + callback(param); + return; + } if (!reentrantLock) { // this would guard the queue and disable interrupts lock(); } - queue.insertTask(scheduling, nowUs, delayUs, callback, param); + queue.insertTask(scheduling, nowUs + delayUs, callback, param); if (!reentrantLock) { doExecute(nowUs); unlock(); @@ -97,15 +105,7 @@ void Executor::doExecute(uint64_t nowUs) { * @param [in] dwell the number of ticks of output duration. */ void scheduleTask(const char *prefix, scheduling_s *scheduling, int delayUs, schfunc_t callback, void *param) { - if (delayUs < 0) { - firmwareError("Negative delayUs %s: %d", prefix, delayUs); - return; - } - if (delayUs == 0) { - callback(param); - return; - } - instance.schedule(scheduling, getTimeNowUs(), delayUs, callback, param); + instance.schedule(prefix, scheduling, getTimeNowUs(), delayUs, callback, param); } void initSignalExecutorImpl(void) { diff --git a/firmware/controllers/system/SingleTimerExecutor.h b/firmware/controllers/system/SingleTimerExecutor.h index 6c537580d4..c2aea04ec7 100644 --- a/firmware/controllers/system/SingleTimerExecutor.h +++ b/firmware/controllers/system/SingleTimerExecutor.h @@ -14,7 +14,7 @@ class Executor { public: Executor(); - void schedule(scheduling_s *scheduling, uint64_t nowUs, int delayUs, schfunc_t callback, void *param); + void schedule(const char *prefix, scheduling_s *scheduling, uint64_t nowUs, int delayUs, schfunc_t callback, void *param); void execute(uint64_t nowUs); private: EventQueue queue; diff --git a/firmware/controllers/system/event_queue.cpp b/firmware/controllers/system/event_queue.cpp index aa88621c5f..0540c2e810 100644 --- a/firmware/controllers/system/event_queue.cpp +++ b/firmware/controllers/system/event_queue.cpp @@ -22,16 +22,16 @@ bool EventQueue::checkIfPending(scheduling_s *scheduling) { return assertNotInList(head, scheduling); } -void EventQueue::insertTask(scheduling_s *scheduling, uint64_t nowUs, int delayUs, schfunc_t callback, void *param) { +void EventQueue::insertTask(scheduling_s *scheduling, uint64_t timeUs, schfunc_t callback, void *param) { if (callback == NULL) firmwareError("NULL callback"); - uint64_t time = nowUs + delayUs; + int alreadyPending = checkIfPending(scheduling); if (alreadyPending || hasFirmwareError()) return; - scheduling->momentUs = time; + scheduling->momentUs = timeUs; scheduling->callback = callback; scheduling->param = param; diff --git a/firmware/controllers/system/event_queue.h b/firmware/controllers/system/event_queue.h index e46fa16326..951493cbab 100644 --- a/firmware/controllers/system/event_queue.h +++ b/firmware/controllers/system/event_queue.h @@ -38,8 +38,7 @@ class EventQueue { public: EventQueue(); -// void insertTask(scheduling_s *scheduling, int delayUs, schfunc_t callback, void *param); - void insertTask(scheduling_s *scheduling, uint64_t nowUs, int delayUs, schfunc_t callback, void *param); + void insertTask(scheduling_s *scheduling, uint64_t timeUs, schfunc_t callback, void *param); void executeAll(uint64_t now); diff --git a/firmware/rusefi.cpp b/firmware/rusefi.cpp index 5b730c0d1b..2e2288c13a 100644 --- a/firmware/rusefi.cpp +++ b/firmware/rusefi.cpp @@ -235,5 +235,5 @@ void firmwareError(const char *fmt, ...) { } int getRusEfiVersion(void) { - return 20140912; + return 20140913; }