auto-sync
This commit is contained in:
parent
af54ba522e
commit
fab476d688
|
@ -155,7 +155,7 @@ void Executor::scheduleTimerCallback() {
|
||||||
* @param [in] delayUs the number of microseconds before the output signal immediate output if delay is zero.
|
* @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.
|
* @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) {
|
void scheduleTask(const bool monitorReuse, const char *prefix, scheduling_s *scheduling, int delayUs, schfunc_t callback, void *param) {
|
||||||
// scheduling->name = prefix;
|
// scheduling->name = prefix;
|
||||||
instance.scheduleByTime(scheduling, getTimeNowUs() + delayUs, callback, param);
|
instance.scheduleByTime(scheduling, getTimeNowUs() + delayUs, callback, param);
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ public:
|
||||||
bool isScheduled;
|
bool isScheduled;
|
||||||
};
|
};
|
||||||
|
|
||||||
void scheduleTask(const char *prefix, scheduling_s *scheduling, int delayUs, schfunc_t callback, void *param);
|
void scheduleTask(const bool monitorReuse, const char *prefix, scheduling_s *scheduling, int delayUs, schfunc_t callback, void *param);
|
||||||
void scheduleByTime(const char *prefix, scheduling_s *scheduling, efitimeus_t time, schfunc_t callback, void *param);
|
void scheduleByTime(const char *prefix, scheduling_s *scheduling, efitimeus_t time, schfunc_t callback, void *param);
|
||||||
|
|
||||||
#endif /* SCHEDULER_H_ */
|
#endif /* SCHEDULER_H_ */
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
#if EFI_SIGNAL_EXECUTOR_SLEEP || defined(__DOXYGEN__)
|
#if EFI_SIGNAL_EXECUTOR_SLEEP || defined(__DOXYGEN__)
|
||||||
|
|
||||||
void scheduleByTime(const char *prefix, scheduling_s *scheduling, efitimeus_t time, schfunc_t callback, void *param) {
|
void scheduleByTime(const char *prefix, scheduling_s *scheduling, efitimeus_t time, schfunc_t callback, void *param) {
|
||||||
scheduleTask(prefix, scheduling, time - getTimeNowUs(), callback, param);
|
scheduleTask(true, prefix, scheduling, time - getTimeNowUs(), callback, param);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void timerCallback(scheduling_s *scheduling) {
|
static void timerCallback(scheduling_s *scheduling) {
|
||||||
|
@ -52,7 +52,7 @@ static void timerCallback(scheduling_s *scheduling) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void scheduleTask(const char *prefix, scheduling_s *scheduling, int delayUs, schfunc_t callback, void *param) {
|
void scheduleTask(const bool monitorReuse, const char *prefix, scheduling_s *scheduling, int delayUs, schfunc_t callback, void *param) {
|
||||||
int delaySt = MY_US2ST(delayUs);
|
int delaySt = MY_US2ST(delayUs);
|
||||||
if (delaySt <= 0) {
|
if (delaySt <= 0) {
|
||||||
/**
|
/**
|
||||||
|
@ -66,9 +66,10 @@ void scheduleTask(const char *prefix, scheduling_s *scheduling, int delayUs, sch
|
||||||
scheduling->callback = callback;
|
scheduling->callback = callback;
|
||||||
scheduling->param = param;
|
scheduling->param = param;
|
||||||
int isArmed = chVTIsArmedI(&scheduling->timer);
|
int isArmed = chVTIsArmedI(&scheduling->timer);
|
||||||
if (isArmed) {
|
if (isArmed && monitorReuse) {
|
||||||
#if EFI_SIMULATOR || defined(__DOXYGEN__)
|
#if EFI_SIMULATOR || defined(__DOXYGEN__)
|
||||||
printf("isArmed? why? sch=%d cb=%d p=%d\r\n", (int) scheduling, (int)callback, (int)param);
|
printf("%s: isArmed? why? sch=%d cb=%d p=%d\r\n", prefix, (int) scheduling, (int)callback, (int)param);
|
||||||
|
// firmwareError("armored");
|
||||||
#endif /* EFI_SIMULATOR */
|
#endif /* EFI_SIMULATOR */
|
||||||
chVTResetI(&scheduling->timer);
|
chVTResetI(&scheduling->timer);
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ static void tachSignalCallback(trigger_event_e ckpSignalType,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
turnPinHigh(&enginePins.tachOut);
|
turnPinHigh(&enginePins.tachOut);
|
||||||
scheduleTask("tach off", &tachTurnSignalOff, (int)MS2US(engineConfiguration->tachPulseDuractionMs), (schfunc_t) &turnTachPinLow, NULL);
|
scheduleTask(false, "tach off", &tachTurnSignalOff, (int)MS2US(engineConfiguration->tachPulseDuractionMs), (schfunc_t) &turnTachPinLow, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void initTachometer(void) {
|
void initTachometer(void) {
|
||||||
|
|
|
@ -289,8 +289,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;
|
// todo: sequential need this logic as well, just do not forget to clear flag pair->isScheduled = true;
|
||||||
scheduling_s * sDown = &pair->signalTimerDown;
|
scheduling_s * sDown = &pair->signalTimerDown;
|
||||||
|
|
||||||
scheduleTask("out up", sUp, (int) injectionStartDelayUs, (schfunc_t) &startSimultaniousInjection, engine);
|
scheduleTask(true, "out up", sUp, (int) injectionStartDelayUs, (schfunc_t) &startSimultaniousInjection, engine);
|
||||||
scheduleTask("out down", sDown, (int) injectionStartDelayUs + MS2US(injectionDuration),
|
scheduleTask(true, "out down", sDown, (int) injectionStartDelayUs + MS2US(injectionDuration),
|
||||||
(schfunc_t) &endSimultaniousInjection, engine);
|
(schfunc_t) &endSimultaniousInjection, engine);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -319,7 +319,7 @@ void scheduleByAngle(int rpm, scheduling_s *timer, angle_t angle,
|
||||||
efiAssertVoid(isValidRpm(rpm), "RPM check expected");
|
efiAssertVoid(isValidRpm(rpm), "RPM check expected");
|
||||||
float delayUs = calc->oneDegreeUs * angle;
|
float delayUs = calc->oneDegreeUs * angle;
|
||||||
efiAssertVoid(!cisnan(delayUs), "NaN delay?");
|
efiAssertVoid(!cisnan(delayUs), "NaN delay?");
|
||||||
scheduleTask("by angle", timer, (int) delayUs, callback, param);
|
scheduleTask(false, "by angle", timer, (int) delayUs, callback, param);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,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
|
* This way we make sure that coil dwell started while spark was enabled would fire and not burn
|
||||||
* the coil.
|
* the coil.
|
||||||
*/
|
*/
|
||||||
scheduleTask("spark up", sUp, chargeDelayUs, (schfunc_t) &turnSparkPinHigh, iEvent->output);
|
scheduleTask(true, "spark up", sUp, chargeDelayUs, (schfunc_t) &turnSparkPinHigh, iEvent->output);
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Spark event is often happening during a later trigger event timeframe
|
* Spark event is often happening during a later trigger event timeframe
|
||||||
|
@ -104,7 +104,7 @@ static ALWAYS_INLINE void handleSparkEvent(bool limitedSpark, uint32_t trgEventI
|
||||||
printf("spark delay=%f angle=%f\r\n", timeTillIgnitionUs, iEvent->sparkPosition.angleOffset);
|
printf("spark delay=%f angle=%f\r\n", timeTillIgnitionUs, iEvent->sparkPosition.angleOffset);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
scheduleTask("spark1 down", sDown, (int) timeTillIgnitionUs, (schfunc_t) &turnSparkPinLow, iEvent->output);
|
scheduleTask(true, "spark1 down", sDown, (int) timeTillIgnitionUs, (schfunc_t) &turnSparkPinLow, iEvent->output);
|
||||||
} else {
|
} else {
|
||||||
/**
|
/**
|
||||||
* Spark should be scheduled in relation to some future trigger event, this way we get better firing precision
|
* Spark should be scheduled in relation to some future trigger event, this way we get better firing precision
|
||||||
|
@ -179,7 +179,7 @@ void handleSpark(int revolutionIndex, bool limitedSpark, uint32_t trgEventIndex,
|
||||||
scheduling_s * sDown = ¤t->signalTimerDown;
|
scheduling_s * sDown = ¤t->signalTimerDown;
|
||||||
|
|
||||||
float timeTillIgnitionUs = ENGINE(rpmCalculator.oneDegreeUs) * current->sparkPosition.angleOffset;
|
float timeTillIgnitionUs = ENGINE(rpmCalculator.oneDegreeUs) * current->sparkPosition.angleOffset;
|
||||||
scheduleTask("spark 2down", sDown, (int) timeTillIgnitionUs, (schfunc_t) &turnSparkPinLow, current->output);
|
scheduleTask(true, "spark 2down", sDown, (int) timeTillIgnitionUs, (schfunc_t) &turnSparkPinLow, current->output);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ EventQueue schedulingQueue;
|
||||||
|
|
||||||
bool_t debugSignalExecutor = false;
|
bool_t debugSignalExecutor = false;
|
||||||
|
|
||||||
void scheduleTask(const char *msg, scheduling_s *scheduling, int delayUs,
|
void scheduleTask(const bool monitorReuse, const char *msg, scheduling_s *scheduling, int delayUs,
|
||||||
schfunc_t callback, void *param) {
|
schfunc_t callback, void *param) {
|
||||||
if (debugSignalExecutor) {
|
if (debugSignalExecutor) {
|
||||||
printf("scheduleTask %d\r\n", delayUs);
|
printf("scheduleTask %d\r\n", delayUs);
|
||||||
|
|
Loading…
Reference in New Issue