diff --git a/firmware/controllers/system/SingleTimerExecutor.cpp b/firmware/controllers/system/SingleTimerExecutor.cpp index 22d7d0c7cc..306673a730 100644 --- a/firmware/controllers/system/SingleTimerExecutor.cpp +++ b/firmware/controllers/system/SingleTimerExecutor.cpp @@ -150,13 +150,11 @@ void Executor::scheduleTimerCallback() { * @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 scheduleTask(const bool monitorReuse, const char *prefix, scheduling_s *scheduling, int delayUs, schfunc_t callback, void *param) { -// scheduling->name = prefix; +void scheduleTask(scheduling_s *scheduling, int delayUs, schfunc_t callback, void *param) { instance.scheduleByTime(scheduling, getTimeNowUs() + delayUs, callback, param); } -void scheduleByTime(const bool monitorReuse, const char *prefix, scheduling_s *scheduling, efitimeus_t time, schfunc_t callback, void *param) { -// scheduling->name = prefix; +void scheduleByTime(scheduling_s *scheduling, efitimeus_t time, schfunc_t callback, void *param) { instance.scheduleByTime(scheduling, time, callback, param); } diff --git a/firmware/controllers/system/pwm_generator_logic.cpp b/firmware/controllers/system/pwm_generator_logic.cpp index 9c8079e13c..9b1a9e3c09 100644 --- a/firmware/controllers/system/pwm_generator_logic.cpp +++ b/firmware/controllers/system/pwm_generator_logic.cpp @@ -155,7 +155,7 @@ static void timerCallback(PwmConfig *state) { efiAssertVoid(state->dbgNestingLevel < 25, "PWM nesting issue"); efitimeus_t switchTimeUs = togglePwmState(state); - scheduleByTime(false, "pwm", &state->scheduling, switchTimeUs, (schfunc_t) timerCallback, state); + scheduleByTime(&state->scheduling, switchTimeUs, (schfunc_t) timerCallback, state); state->dbgNestingLevel--; } diff --git a/firmware/controllers/system/scheduler.h b/firmware/controllers/system/scheduler.h index c6cadb8e50..91bd7a6222 100644 --- a/firmware/controllers/system/scheduler.h +++ b/firmware/controllers/system/scheduler.h @@ -26,7 +26,7 @@ public: bool isScheduled; }; -void scheduleTask(const bool monitorReuse, const char *prefix, scheduling_s *scheduling, int delayUs, schfunc_t callback, void *param); -void scheduleByTime(const bool monitorReuse, const char *prefix, scheduling_s *scheduling, efitimeus_t time, schfunc_t callback, void *param); +void scheduleTask(scheduling_s *scheduling, int delayUs, schfunc_t callback, void *param); +void scheduleByTime(scheduling_s *scheduling, efitimeus_t time, schfunc_t callback, void *param); #endif /* SCHEDULER_H_ */ diff --git a/firmware/controllers/system/signal_executor_sleep.cpp b/firmware/controllers/system/signal_executor_sleep.cpp index b9dca43ff5..8fc4beb7ac 100644 --- a/firmware/controllers/system/signal_executor_sleep.cpp +++ b/firmware/controllers/system/signal_executor_sleep.cpp @@ -34,8 +34,8 @@ #if EFI_SIGNAL_EXECUTOR_SLEEP || defined(__DOXYGEN__) -void scheduleByTime(const bool monitorReuse, const char *prefix, scheduling_s *scheduling, efitimeus_t time, schfunc_t callback, void *param) { - scheduleTask(monitorReuse, prefix, scheduling, time - getTimeNowUs(), callback, param); +void scheduleByTime(const char *prefix, scheduling_s *scheduling, efitimeus_t time, schfunc_t callback, void *param) { + scheduleTask(scheduling, time - getTimeNowUs(), callback, param); } static void timerCallback(scheduling_s *scheduling) { @@ -52,7 +52,7 @@ static void timerCallback(scheduling_s *scheduling) { } -void scheduleTask(const bool monitorReuse, const char *prefix, scheduling_s *scheduling, int delayUs, schfunc_t callback, void *param) { +void scheduleTask(scheduling_s *scheduling, int delayUs, schfunc_t callback, void *param) { int delaySt = MY_US2ST(delayUs); if (delaySt <= 0) { /** diff --git a/firmware/controllers/tachometer.cpp b/firmware/controllers/tachometer.cpp index 6e5335bc23..ace049d227 100644 --- a/firmware/controllers/tachometer.cpp +++ b/firmware/controllers/tachometer.cpp @@ -27,7 +27,7 @@ static void tachSignalCallback(trigger_event_e ckpSignalType, return; } enginePins.tachOut.setHigh(); - scheduleTask(false, "tach off", &tachTurnSignalOff, (int)MS2US(engineConfiguration->tachPulseDuractionMs), (schfunc_t) &turnTachPinLow, NULL); + scheduleTask(&tachTurnSignalOff, (int)MS2US(engineConfiguration->tachPulseDuractionMs), (schfunc_t) &turnTachPinLow, NULL); } void initTachometer(void) { diff --git a/firmware/controllers/trigger/main_trigger_callback.cpp b/firmware/controllers/trigger/main_trigger_callback.cpp index dcf94364ec..e0f86f7da1 100644 --- a/firmware/controllers/trigger/main_trigger_callback.cpp +++ b/firmware/controllers/trigger/main_trigger_callback.cpp @@ -209,7 +209,7 @@ static void seScheduleByTime(const char *prefix, scheduling_s *scheduling, efiti printf("seScheduleByTime %s %s %d sch=%d\r\n", direction, param->name, (int)time, (int)scheduling); #endif /* FUEL_MATH_EXTREME_LOGGING || EFI_UNIT_TEST */ - scheduleByTime(true, prefix, scheduling, time, callback, pair); + scheduleByTime(scheduling, time, callback, pair); } static void scheduleFuelInjection(int rpm, OutputSignalPair *pair, efitimeus_t nowUs, floatus_t delayUs, floatus_t durationUs, InjectionEvent *event DECLARE_ENGINE_PARAMETER_S) { @@ -318,8 +318,8 @@ static ALWAYS_INLINE void handleFuelInjectionEvent(int injEventIndex, InjectionE // todo: sequential need this logic as well, just do not forget to clear flag pair->isScheduled = true; scheduling_s * sDown = &pair->signalTimerDown; - scheduleTask(true, "out up s", sUp, (int) injectionStartDelayUs, (schfunc_t) &startSimultaniousInjection, event); - scheduleTask(true, "out down", sDown, (int) injectionStartDelayUs + MS2US(injectionDuration), + scheduleTask(sUp, (int) injectionStartDelayUs, (schfunc_t) &startSimultaniousInjection, event); + scheduleTask(sDown, (int) injectionStartDelayUs + MS2US(injectionDuration), (schfunc_t) &endSimultaniousInjection, event); } else { diff --git a/firmware/controllers/trigger/rpm_calculator.cpp b/firmware/controllers/trigger/rpm_calculator.cpp index 86235638bc..b5d2bb8fd0 100644 --- a/firmware/controllers/trigger/rpm_calculator.cpp +++ b/firmware/controllers/trigger/rpm_calculator.cpp @@ -316,7 +316,7 @@ void scheduleByAngle(int rpm, scheduling_s *timer, angle_t angle, efiAssertVoid(isValidRpm(rpm), "RPM check expected"); float delayUs = calc->oneDegreeUs * angle; efiAssertVoid(!cisnan(delayUs), "NaN delay?"); - scheduleTask(false, "by angle", timer, (int) delayUs, callback, param); + scheduleTask(timer, (int) delayUs, callback, param); } #endif diff --git a/firmware/controllers/trigger/spark_logic.cpp b/firmware/controllers/trigger/spark_logic.cpp index d21542ba49..a18679e060 100644 --- a/firmware/controllers/trigger/spark_logic.cpp +++ b/firmware/controllers/trigger/spark_logic.cpp @@ -166,7 +166,7 @@ static ALWAYS_INLINE void handleSparkEvent(bool limitedSpark, uint32_t trgEventI * This way we make sure that coil dwell started while spark was enabled would fire and not burn * the coil. */ - scheduleTask(false, "spark up", sUp, chargeDelayUs, (schfunc_t) &turnSparkPinHigh, iEvent); + scheduleTask(sUp, chargeDelayUs, (schfunc_t) &turnSparkPinHigh, iEvent); } /** * Spark event is often happening during a later trigger event timeframe @@ -190,7 +190,7 @@ static ALWAYS_INLINE void handleSparkEvent(bool limitedSpark, uint32_t trgEventI scheduleMsg(logger, "scheduling sparkDown ind=%d %d %s now=%d %d later id=%d", trgEventIndex, getRevolutionCounter(), iEvent->getOutputForLoggins()->name, (int)getTimeNowUs(), (int)timeTillIgnitionUs, iEvent->sparkId); #endif /* FUEL_MATH_EXTREME_LOGGING */ - scheduleTask(false, "spark1 down", sDown, (int) timeTillIgnitionUs, (schfunc_t) &turnSparkPinLow, iEvent); + scheduleTask(sDown, (int) timeTillIgnitionUs, (schfunc_t) &turnSparkPinLow, iEvent); } else { #if SPARK_EXTREME_LOGGING || defined(__DOXYGEN__) scheduleMsg(logger, "to queue sparkDown ind=%d %d %s %d for %d", trgEventIndex, getRevolutionCounter(), iEvent->getOutputForLoggins()->name, (int)getTimeNowUs(), iEvent->sparkPosition.eventIndex); @@ -334,7 +334,7 @@ void handleSpark(bool limitedSpark, uint32_t trgEventIndex, int rpm float timeTillIgnitionUs = ENGINE(rpmCalculator.oneDegreeUs) * current->sparkPosition.angleOffset; - scheduleTask(false, "spark 2down", sDown, (int) timeTillIgnitionUs, (schfunc_t) &turnSparkPinLow, current); + scheduleTask(sDown, (int) timeTillIgnitionUs, (schfunc_t) &turnSparkPinLow, current); } } diff --git a/unit_tests/test_signal_executor.cpp b/unit_tests/test_signal_executor.cpp index 75525f73e8..7a10a436ed 100644 --- a/unit_tests/test_signal_executor.cpp +++ b/unit_tests/test_signal_executor.cpp @@ -18,15 +18,15 @@ EventQueue schedulingQueue; bool_t debugSignalExecutor = false; -void scheduleTask(const bool monitorReuse, const char *msg, scheduling_s *scheduling, int delayUs, +void scheduleTask(scheduling_s *scheduling, int delayUs, schfunc_t callback, void *param) { if (debugSignalExecutor) { printf("scheduleTask %d\r\n", delayUs); } - scheduleByTime(monitorReuse, msg, scheduling, getTimeNowUs() + delayUs, callback, param); + scheduleByTime(scheduling, getTimeNowUs() + delayUs, callback, param); } -void scheduleByTime(const bool monitorReuse, const char *prefix, scheduling_s *scheduling, +void scheduleByTime(scheduling_s *scheduling, efitimeus_t time, schfunc_t callback, void *param) { if (debugSignalExecutor) { printf("scheduleByTime %d\r\n", time);