rename Executor -> Scheduler
This commit is contained in:
parent
6d34aff938
commit
b9292dbb33
|
@ -94,7 +94,7 @@ const BigBufferHandle& triggerScopeGetBuffer() {
|
||||||
|
|
||||||
// Start the next sample once we've read out this one
|
// Start the next sample once we've read out this one
|
||||||
if (isRunning) {
|
if (isRunning) {
|
||||||
engine->executor.scheduleByTimestampNt("trigger scope", &restartTimer, getTimeNowNt() + MS2NT(10), startSampling);
|
engine->scheduler.schedule("trigger scope", &restartTimer, getTimeNowNt() + MS2NT(10), startSampling);
|
||||||
}
|
}
|
||||||
|
|
||||||
return buffer;
|
return buffer;
|
||||||
|
|
|
@ -122,7 +122,7 @@ void initAlternatorCtrl() {
|
||||||
|
|
||||||
startSimplePwm(&alternatorControl,
|
startSimplePwm(&alternatorControl,
|
||||||
"Alternator control",
|
"Alternator control",
|
||||||
&engine->executor,
|
&engine->scheduler,
|
||||||
&enginePins.alternatorPin,
|
&enginePins.alternatorPin,
|
||||||
engineConfiguration->alternatorPwmFrequency, 0);
|
engineConfiguration->alternatorPwmFrequency, 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -324,7 +324,7 @@ void startBoostPin() {
|
||||||
startSimplePwm(
|
startSimplePwm(
|
||||||
&boostPwmControl,
|
&boostPwmControl,
|
||||||
"Boost",
|
"Boost",
|
||||||
&engine->executor,
|
&engine->scheduler,
|
||||||
&enginePins.boostPin,
|
&enginePins.boostPin,
|
||||||
engineConfiguration->boostPwmFrequency,
|
engineConfiguration->boostPwmFrequency,
|
||||||
/*dutyCycle*/0
|
/*dutyCycle*/0
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
const char *disPinMsg,
|
const char *disPinMsg,
|
||||||
brain_pin_e pinDisable,
|
brain_pin_e pinDisable,
|
||||||
bool isInverted,
|
bool isInverted,
|
||||||
ExecutorInterface* executor,
|
Scheduler* executor,
|
||||||
int frequency) {
|
int frequency) {
|
||||||
|
|
||||||
if (isStarted) {
|
if (isStarted) {
|
||||||
|
@ -99,7 +99,7 @@ DcMotor* initDcMotor(const char *disPinMsg,const dc_io& io, size_t index, bool u
|
||||||
io.disablePin,
|
io.disablePin,
|
||||||
// todo You would not believe how you invert TLE9201 #4579
|
// todo You would not believe how you invert TLE9201 #4579
|
||||||
engineConfiguration->stepperDcInvertedPins,
|
engineConfiguration->stepperDcInvertedPins,
|
||||||
&engine->executor,
|
&engine->scheduler,
|
||||||
engineConfiguration->etbFreq
|
engineConfiguration->etbFreq
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -117,7 +117,7 @@ DcMotor* initDcMotor(brain_pin_e coil_p, brain_pin_e coil_m, size_t index) {
|
||||||
nullptr,
|
nullptr,
|
||||||
Gpio::Unassigned, /* pinDisable */
|
Gpio::Unassigned, /* pinDisable */
|
||||||
engineConfiguration->stepperDcInvertedPins,
|
engineConfiguration->stepperDcInvertedPins,
|
||||||
&engine->executor,
|
&engine->scheduler,
|
||||||
engineConfiguration->etbFreq /* same in case of stepper? */
|
engineConfiguration->etbFreq /* same in case of stepper? */
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ public:
|
||||||
const char *disPinMsg,
|
const char *disPinMsg,
|
||||||
brain_pin_e pinDisable,
|
brain_pin_e pinDisable,
|
||||||
bool isInverted,
|
bool isInverted,
|
||||||
ExecutorInterface* executor,
|
Scheduler* executor,
|
||||||
int frequency);
|
int frequency);
|
||||||
|
|
||||||
TwoPinDcMotor dcMotor;
|
TwoPinDcMotor dcMotor;
|
||||||
|
|
|
@ -44,7 +44,7 @@ void initGpPwm() {
|
||||||
// Setup pin & pwm
|
// Setup pin & pwm
|
||||||
pins[i].initPin("gp pwm", cfg.pin);
|
pins[i].initPin("gp pwm", cfg.pin);
|
||||||
if (usePwm) {
|
if (usePwm) {
|
||||||
startSimplePwm(&outputs[i], channelNames[i], &engine->executor, &pins[i], freq, 0);
|
startSimplePwm(&outputs[i], channelNames[i], &engine->scheduler, &pins[i], freq, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set up this channel's lookup table
|
// Set up this channel's lookup table
|
||||||
|
|
|
@ -150,7 +150,7 @@ void initIdleHardware() {
|
||||||
*/
|
*/
|
||||||
// todo: even for double-solenoid mode we can probably use same single SimplePWM
|
// todo: even for double-solenoid mode we can probably use same single SimplePWM
|
||||||
startSimplePwm(&idleSolenoidOpen, "Idle Valve Open",
|
startSimplePwm(&idleSolenoidOpen, "Idle Valve Open",
|
||||||
&engine->executor,
|
&engine->scheduler,
|
||||||
&enginePins.idleSolenoidPin,
|
&enginePins.idleSolenoidPin,
|
||||||
engineConfiguration->idle.solenoidFrequency, PERCENT_TO_DUTY(engineConfiguration->manIdlePosition));
|
engineConfiguration->idle.solenoidFrequency, PERCENT_TO_DUTY(engineConfiguration->manIdlePosition));
|
||||||
|
|
||||||
|
@ -161,7 +161,7 @@ void initIdleHardware() {
|
||||||
}
|
}
|
||||||
|
|
||||||
startSimplePwm(&idleSolenoidClose, "Idle Valve Close",
|
startSimplePwm(&idleSolenoidClose, "Idle Valve Close",
|
||||||
&engine->executor,
|
&engine->scheduler,
|
||||||
&enginePins.secondIdleSolenoidPin,
|
&enginePins.secondIdleSolenoidPin,
|
||||||
engineConfiguration->idle.solenoidFrequency, PERCENT_TO_DUTY(engineConfiguration->manIdlePosition));
|
engineConfiguration->idle.solenoidFrequency, PERCENT_TO_DUTY(engineConfiguration->manIdlePosition));
|
||||||
}
|
}
|
||||||
|
|
|
@ -160,7 +160,7 @@ static void turnVvtPidOn(int index) {
|
||||||
}
|
}
|
||||||
|
|
||||||
startSimplePwmExt(&vvtPwms[index], vvtOutputNames[index],
|
startSimplePwmExt(&vvtPwms[index], vvtOutputNames[index],
|
||||||
&engine->executor,
|
&engine->scheduler,
|
||||||
engineConfiguration->vvtPins[index],
|
engineConfiguration->vvtPins[index],
|
||||||
getVvtOutputPin(index),
|
getVvtOutputPin(index),
|
||||||
engineConfiguration->vvtOutputFrequency, 0.1,
|
engineConfiguration->vvtOutputFrequency, 0.1,
|
||||||
|
|
|
@ -601,8 +601,8 @@ TunerStudioOutputChannels *getTunerStudioOutputChannels() {
|
||||||
return &engine->outputChannels;
|
return &engine->outputChannels;
|
||||||
}
|
}
|
||||||
|
|
||||||
ExecutorInterface *getExecutorInterface() {
|
Scheduler *getScheduler() {
|
||||||
return &engine->executor;
|
return &engine->scheduler;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if EFI_SHAFT_POSITION_INPUT
|
#if EFI_SHAFT_POSITION_INPUT
|
||||||
|
|
|
@ -237,14 +237,14 @@ public:
|
||||||
// cost to resolve pointer, we use instances as a micro optimization
|
// cost to resolve pointer, we use instances as a micro optimization
|
||||||
#if EFI_SIGNAL_EXECUTOR_ONE_TIMER
|
#if EFI_SIGNAL_EXECUTOR_ONE_TIMER
|
||||||
// while theoretically PROD could be using EFI_SIGNAL_EXECUTOR_SLEEP, as of 2024 all PROD uses SingleTimerExecutor
|
// while theoretically PROD could be using EFI_SIGNAL_EXECUTOR_SLEEP, as of 2024 all PROD uses SingleTimerExecutor
|
||||||
SingleTimerExecutor executor;
|
SingleTimerExecutor scheduler;
|
||||||
#endif
|
#endif
|
||||||
#if EFI_SIGNAL_EXECUTOR_SLEEP
|
#if EFI_SIGNAL_EXECUTOR_SLEEP
|
||||||
// at the moment this one is used exclusively by x86 simulator it should theoretically be possible to make it available in embedded if needed
|
// at the moment this one is used exclusively by x86 simulator it should theoretically be possible to make it available in embedded if needed
|
||||||
SleepExecutor executor;
|
SleepExecutor scheduler;
|
||||||
#endif
|
#endif
|
||||||
#if EFI_UNIT_TEST
|
#if EFI_UNIT_TEST
|
||||||
TestExecutor executor;
|
TestExecutor scheduler;
|
||||||
|
|
||||||
std::function<void(IgnitionEvent*, bool)> onIgnitionEvent;
|
std::function<void(IgnitionEvent*, bool)> onIgnitionEvent;
|
||||||
std::function<void(const IgnitionEvent&, efitick_t, angle_t, efitick_t)> onScheduleTurnSparkPinHighStartCharging
|
std::function<void(const IgnitionEvent&, efitick_t, angle_t, efitick_t)> onScheduleTurnSparkPinHighStartCharging
|
||||||
|
|
|
@ -112,8 +112,8 @@ static void runBench(OutputPin *output, float onTimeMs, float offTimeMs, int cou
|
||||||
efitick_t endTime = startTime + US2NT(onTimeUs);
|
efitick_t endTime = startTime + US2NT(onTimeUs);
|
||||||
|
|
||||||
// Schedule both events
|
// Schedule both events
|
||||||
engine->executor.scheduleByTimestampNt("bstart", &benchSchedStart, startTime, {(swapOnOff ? benchOff : benchOn), output});
|
engine->scheduler.schedule("bstart", &benchSchedStart, startTime, {(swapOnOff ? benchOff : benchOn), output});
|
||||||
engine->executor.scheduleByTimestampNt("bend", &benchSchedEnd, endTime, {(swapOnOff ? benchOn : benchOff), output});
|
engine->scheduler.schedule("bend", &benchSchedEnd, endTime, {(swapOnOff ? benchOn : benchOff), output});
|
||||||
|
|
||||||
// Wait one full cycle time for the event + delay to happen
|
// Wait one full cycle time for the event + delay to happen
|
||||||
chThdSleepMicroseconds(onTimeUs + offTimeUs);
|
chThdSleepMicroseconds(onTimeUs + offTimeUs);
|
||||||
|
|
|
@ -189,12 +189,12 @@ void InjectionEvent::onTriggerTooth(efitick_t nowNt, float currentPhase, float n
|
||||||
|
|
||||||
// Schedule closing stage 1
|
// Schedule closing stage 1
|
||||||
efitick_t turnOffTimeStage1 = startTime + US2NT((int)durationUsStage1);
|
efitick_t turnOffTimeStage1 = startTime + US2NT((int)durationUsStage1);
|
||||||
getExecutorInterface()->scheduleByTimestampNt("inj", nullptr, turnOffTimeStage1, endActionStage1);
|
getScheduler()->schedule("inj", nullptr, turnOffTimeStage1, endActionStage1);
|
||||||
|
|
||||||
// Schedule closing stage 2 (if applicable)
|
// Schedule closing stage 2 (if applicable)
|
||||||
if (hasStage2Injection && endActionStage2) {
|
if (hasStage2Injection && endActionStage2) {
|
||||||
efitick_t turnOffTimeStage2 = startTime + US2NT((int)durationUsStage2);
|
efitick_t turnOffTimeStage2 = startTime + US2NT((int)durationUsStage2);
|
||||||
getExecutorInterface()->scheduleByTimestampNt("inj stage 2", nullptr, turnOffTimeStage2, endActionStage2);
|
getScheduler()->schedule("inj stage 2", nullptr, turnOffTimeStage2, endActionStage2);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if EFI_DEFAILED_LOGGING
|
#if EFI_DEFAILED_LOGGING
|
||||||
|
|
|
@ -67,7 +67,7 @@ void PrimeController::onIgnitionStateChanged(bool ignitionOn) {
|
||||||
int32_t primeDelayNt = assertFloatFitsInto32BitsAndCast("primingDelay", MSF2NT(engineConfiguration->primingDelay * 1000 + minimumPrimeDelayMs));
|
int32_t primeDelayNt = assertFloatFitsInto32BitsAndCast("primingDelay", MSF2NT(engineConfiguration->primingDelay * 1000 + minimumPrimeDelayMs));
|
||||||
|
|
||||||
auto startTime = getTimeNowNt() + primeDelayNt;
|
auto startTime = getTimeNowNt() + primeDelayNt;
|
||||||
getExecutorInterface()->scheduleByTimestampNt("primingDelay", nullptr, startTime, { PrimeController::onPrimeStartAdapter, this });
|
getScheduler()->schedule("primingDelay", nullptr, startTime, { PrimeController::onPrimeStartAdapter, this });
|
||||||
} else {
|
} else {
|
||||||
efiPrintf("Skipped priming pulse since ignSwitchCounter = %lu", ignSwitchCounter);
|
efiPrintf("Skipped priming pulse since ignSwitchCounter = %lu", ignSwitchCounter);
|
||||||
}
|
}
|
||||||
|
@ -112,7 +112,7 @@ void PrimeController::onPrimeStart() {
|
||||||
// Open all injectors, schedule closing later
|
// Open all injectors, schedule closing later
|
||||||
m_isPriming = true;
|
m_isPriming = true;
|
||||||
startSimultaneousInjection();
|
startSimultaneousInjection();
|
||||||
getExecutorInterface()->scheduleByTimestampNt("onPrimeStart", nullptr, endTime, { onPrimeEndAdapter, this });
|
getScheduler()->schedule("onPrimeStart", nullptr, endTime, { onPrimeEndAdapter, this });
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrimeController::onPrimeEnd() {
|
void PrimeController::onPrimeEnd() {
|
||||||
|
|
|
@ -398,7 +398,7 @@ efitick_t scheduleByAngle(scheduling_s *timer, efitick_t nowNt, angle_t angle,
|
||||||
|
|
||||||
efitick_t actionTimeNt = sumTickAndFloat(nowNt, USF2NT(delayUs));
|
efitick_t actionTimeNt = sumTickAndFloat(nowNt, USF2NT(delayUs));
|
||||||
|
|
||||||
engine->executor.scheduleByTimestampNt("angle", timer, actionTimeNt, action);
|
engine->scheduler.schedule("angle", timer, actionTimeNt, action);
|
||||||
|
|
||||||
return actionTimeNt;
|
return actionTimeNt;
|
||||||
}
|
}
|
||||||
|
|
|
@ -264,8 +264,8 @@ if (engineConfiguration->debugMode == DBG_DWELL_METRIC) {
|
||||||
#endif /* SPARK_EXTREME_LOGGING */
|
#endif /* SPARK_EXTREME_LOGGING */
|
||||||
|
|
||||||
// We can schedule both of these right away, since we're going for "asap" not "particular angle"
|
// We can schedule both of these right away, since we're going for "asap" not "particular angle"
|
||||||
engine->executor.scheduleByTimestampNt("dwell", &event->dwellStartTimer, nextDwellStart, { &turnSparkPinHighStartCharging, event });
|
engine->scheduler.schedule("dwell", &event->dwellStartTimer, nextDwellStart, { &turnSparkPinHighStartCharging, event });
|
||||||
engine->executor.scheduleByTimestampNt("firing", &event->sparkEvent.eventScheduling, nextFiring, { fireSparkAndPrepareNextSchedule, event });
|
engine->scheduler.schedule("firing", &event->sparkEvent.eventScheduling, nextFiring, { fireSparkAndPrepareNextSchedule, event });
|
||||||
} else {
|
} else {
|
||||||
if (engineConfiguration->enableTrailingSparks) {
|
if (engineConfiguration->enableTrailingSparks) {
|
||||||
#if SPARK_EXTREME_LOGGING
|
#if SPARK_EXTREME_LOGGING
|
||||||
|
@ -466,7 +466,7 @@ static void scheduleSparkEvent(bool limitedSpark, IgnitionEvent *event,
|
||||||
* and it looks like current (smart?) re-queuing is effectively cancelling out the overdwell? is that the way this was intended to work?
|
* and it looks like current (smart?) re-queuing is effectively cancelling out the overdwell? is that the way this was intended to work?
|
||||||
* [tag:overdwell]
|
* [tag:overdwell]
|
||||||
*/
|
*/
|
||||||
engine->executor.scheduleByTimestampNt("overdwell", &event->sparkEvent.eventScheduling, fireTime, { overFireSparkAndPrepareNextSchedule, event });
|
engine->scheduler.schedule("overdwell", &event->sparkEvent.eventScheduling, fireTime, { overFireSparkAndPrepareNextSchedule, event });
|
||||||
|
|
||||||
#if EFI_UNIT_TEST
|
#if EFI_UNIT_TEST
|
||||||
engine->onScheduleOverFireSparkAndPrepareNextSchedule(*event, fireTime);
|
engine->onScheduleOverFireSparkAndPrepareNextSchedule(*event, fireTime);
|
||||||
|
|
|
@ -31,7 +31,7 @@ void initSpeedometer() {
|
||||||
|
|
||||||
startSimplePwm(&speedoPwm,
|
startSimplePwm(&speedoPwm,
|
||||||
"Speedometer",
|
"Speedometer",
|
||||||
&engine->executor,
|
&engine->scheduler,
|
||||||
&enginePins.speedoOut,
|
&enginePins.speedoOut,
|
||||||
NAN, 0.5f);
|
NAN, 0.5f);
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@ void initTachometer() {
|
||||||
|
|
||||||
startSimplePwm(&tachControl,
|
startSimplePwm(&tachControl,
|
||||||
"Tachometer",
|
"Tachometer",
|
||||||
&engine->executor,
|
&engine->scheduler,
|
||||||
&enginePins.tachOut,
|
&enginePins.tachOut,
|
||||||
NAN, 0.1f);
|
NAN, 0.1f);
|
||||||
|
|
||||||
|
|
|
@ -277,7 +277,7 @@ void startPwm(int index, float freq, float duty) {
|
||||||
brain_pin_e pwmPin = engineConfiguration->luaOutputPins[index];
|
brain_pin_e pwmPin = engineConfiguration->luaOutputPins[index];
|
||||||
|
|
||||||
startSimplePwmExt(
|
startSimplePwmExt(
|
||||||
&pwms[index], "lua", &engine->executor,
|
&pwms[index], "lua", &engine->scheduler,
|
||||||
pwmPin, &enginePins.luaOutputPins[index],
|
pwmPin, &enginePins.luaOutputPins[index],
|
||||||
freq, duty
|
freq, duty
|
||||||
);
|
);
|
||||||
|
|
|
@ -45,7 +45,7 @@ void initVrThresholdPwm() {
|
||||||
}
|
}
|
||||||
|
|
||||||
startSimplePwmHard(&pwms[i], "VR Threshold",
|
startSimplePwmHard(&pwms[i], "VR Threshold",
|
||||||
&engine->executor,
|
&engine->scheduler,
|
||||||
cfg.pin,
|
cfg.pin,
|
||||||
&pins[i],
|
&pins[i],
|
||||||
10000, // it's guaranteed to be hardware PWM, the faster the PWM, the less noise makes it through
|
10000, // it's guaranteed to be hardware PWM, the faster the PWM, the less noise makes it through
|
||||||
|
|
|
@ -268,7 +268,7 @@ static void timerCallback(PwmConfig *state) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
state->m_executor->scheduleByTimestampNt(state->m_name, &state->scheduling, switchTimeNt, { timerCallback, state });
|
state->m_executor->schedule(state->m_name, &state->scheduling, switchTimeNt, { timerCallback, state });
|
||||||
state->dbgNestingLevel--;
|
state->dbgNestingLevel--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -287,7 +287,7 @@ void copyPwmParameters(PwmConfig *state, MultiChannelStateSequence const * seq)
|
||||||
* this method also starts the timer cycle
|
* this method also starts the timer cycle
|
||||||
* See also startSimplePwm
|
* See also startSimplePwm
|
||||||
*/
|
*/
|
||||||
void PwmConfig::weComplexInit(ExecutorInterface *executor,
|
void PwmConfig::weComplexInit(Scheduler *executor,
|
||||||
MultiChannelStateSequence const * seq,
|
MultiChannelStateSequence const * seq,
|
||||||
pwm_cycle_callback *pwmCycleCallback, pwm_gen_callback *stateChangeCallback) {
|
pwm_cycle_callback *pwmCycleCallback, pwm_gen_callback *stateChangeCallback) {
|
||||||
m_executor = executor;
|
m_executor = executor;
|
||||||
|
@ -313,7 +313,7 @@ void PwmConfig::weComplexInit(ExecutorInterface *executor,
|
||||||
}
|
}
|
||||||
|
|
||||||
void startSimplePwm(SimplePwm *state, const char *msg,
|
void startSimplePwm(SimplePwm *state, const char *msg,
|
||||||
ExecutorInterface *executor,
|
Scheduler *executor,
|
||||||
OutputPin *output, float frequency, float dutyCycle, pwm_gen_callback *callback) {
|
OutputPin *output, float frequency, float dutyCycle, pwm_gen_callback *callback) {
|
||||||
efiAssertVoid(ObdCode::CUSTOM_ERR_PWM_STATE_ASSERT, state != NULL, "state");
|
efiAssertVoid(ObdCode::CUSTOM_ERR_PWM_STATE_ASSERT, state != NULL, "state");
|
||||||
efiAssertVoid(ObdCode::CUSTOM_ERR_PWM_DUTY_ASSERT, dutyCycle >= 0 && dutyCycle <= PWM_MAX_DUTY, "dutyCycle");
|
efiAssertVoid(ObdCode::CUSTOM_ERR_PWM_DUTY_ASSERT, dutyCycle >= 0 && dutyCycle <= PWM_MAX_DUTY, "dutyCycle");
|
||||||
|
@ -325,7 +325,7 @@ void startSimplePwm(SimplePwm *state, const char *msg,
|
||||||
#if EFI_PROD_CODE
|
#if EFI_PROD_CODE
|
||||||
#if (BOARD_EXT_GPIOCHIPS > 0)
|
#if (BOARD_EXT_GPIOCHIPS > 0)
|
||||||
if (!callback) {
|
if (!callback) {
|
||||||
/* No specific executor, we can try enabling HW PWM */
|
/* No specific scheduler, we can try enabling HW PWM */
|
||||||
if (brain_pin_is_ext(output->brainPin)) {
|
if (brain_pin_is_ext(output->brainPin)) {
|
||||||
/* this pin is driven by external gpio chip, let's see if it can PWM */
|
/* this pin is driven by external gpio chip, let's see if it can PWM */
|
||||||
state->hardPwm = gpiochip_tryInitPwm(msg, output->brainPin, frequency, dutyCycle);
|
state->hardPwm = gpiochip_tryInitPwm(msg, output->brainPin, frequency, dutyCycle);
|
||||||
|
@ -359,7 +359,7 @@ void startSimplePwm(SimplePwm *state, const char *msg,
|
||||||
}
|
}
|
||||||
|
|
||||||
void startSimplePwmExt(SimplePwm *state, const char *msg,
|
void startSimplePwmExt(SimplePwm *state, const char *msg,
|
||||||
ExecutorInterface *executor,
|
Scheduler *executor,
|
||||||
brain_pin_e brainPin, OutputPin *output, float frequency,
|
brain_pin_e brainPin, OutputPin *output, float frequency,
|
||||||
float dutyCycle, pwm_gen_callback *callback) {
|
float dutyCycle, pwm_gen_callback *callback) {
|
||||||
|
|
||||||
|
@ -372,7 +372,7 @@ void startSimplePwmExt(SimplePwm *state, const char *msg,
|
||||||
* @param dutyCycle value between 0 and 1
|
* @param dutyCycle value between 0 and 1
|
||||||
*/
|
*/
|
||||||
void startSimplePwmHard(SimplePwm *state, const char *msg,
|
void startSimplePwmHard(SimplePwm *state, const char *msg,
|
||||||
ExecutorInterface *executor,
|
Scheduler *executor,
|
||||||
brain_pin_e brainPin, OutputPin *output, float frequency,
|
brain_pin_e brainPin, OutputPin *output, float frequency,
|
||||||
float dutyCycle) {
|
float dutyCycle) {
|
||||||
#if EFI_PROD_CODE && HAL_USE_PWM
|
#if EFI_PROD_CODE && HAL_USE_PWM
|
||||||
|
|
|
@ -52,12 +52,12 @@ public:
|
||||||
PwmConfig();
|
PwmConfig();
|
||||||
|
|
||||||
void weComplexInit(
|
void weComplexInit(
|
||||||
ExecutorInterface *executor,
|
Scheduler *executor,
|
||||||
MultiChannelStateSequence const * seq,
|
MultiChannelStateSequence const * seq,
|
||||||
pwm_cycle_callback *pwmCycleCallback,
|
pwm_cycle_callback *pwmCycleCallback,
|
||||||
pwm_gen_callback *callback);
|
pwm_gen_callback *callback);
|
||||||
|
|
||||||
ExecutorInterface *m_executor = nullptr;
|
Scheduler *m_executor = nullptr;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* We need to handle zero duty cycle and 100% duty cycle in a special way
|
* We need to handle zero duty cycle and 100% duty cycle in a special way
|
||||||
|
@ -135,7 +135,7 @@ void applyPinState(int stateIndex, PwmConfig* state) /* pwm_gen_callback */;
|
||||||
* This method should be called after scheduling layer is started by initSignalExecutor()
|
* This method should be called after scheduling layer is started by initSignalExecutor()
|
||||||
*/
|
*/
|
||||||
void startSimplePwm(SimplePwm *state, const char *msg,
|
void startSimplePwm(SimplePwm *state, const char *msg,
|
||||||
ExecutorInterface *executor,
|
Scheduler *executor,
|
||||||
OutputPin *output,
|
OutputPin *output,
|
||||||
float frequency, float dutyCycle, pwm_gen_callback *callback = NULL);
|
float frequency, float dutyCycle, pwm_gen_callback *callback = NULL);
|
||||||
|
|
||||||
|
@ -146,12 +146,12 @@ void startSimplePwm(SimplePwm *state, const char *msg,
|
||||||
*/
|
*/
|
||||||
void startSimplePwmExt(SimplePwm *state,
|
void startSimplePwmExt(SimplePwm *state,
|
||||||
const char *msg,
|
const char *msg,
|
||||||
ExecutorInterface *executor,
|
Scheduler *executor,
|
||||||
brain_pin_e brainPin, OutputPin *output,
|
brain_pin_e brainPin, OutputPin *output,
|
||||||
float frequency, float dutyCycle, pwm_gen_callback *callback = NULL);
|
float frequency, float dutyCycle, pwm_gen_callback *callback = NULL);
|
||||||
|
|
||||||
void startSimplePwmHard(SimplePwm *state, const char *msg,
|
void startSimplePwmHard(SimplePwm *state, const char *msg,
|
||||||
ExecutorInterface *executor,
|
Scheduler *executor,
|
||||||
brain_pin_e brainPin, OutputPin *output, float frequency,
|
brain_pin_e brainPin, OutputPin *output, float frequency,
|
||||||
float dutyCycle);
|
float dutyCycle);
|
||||||
|
|
||||||
|
|
|
@ -90,7 +90,7 @@ private:
|
||||||
};
|
};
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
||||||
struct ExecutorInterface {
|
struct Scheduler {
|
||||||
/**
|
/**
|
||||||
* @brief Schedule an action to be executed in the future.
|
* @brief Schedule an action to be executed in the future.
|
||||||
*
|
*
|
||||||
|
@ -102,7 +102,7 @@ struct ExecutorInterface {
|
||||||
* very near future, it may execute immediately.
|
* very near future, it may execute immediately.
|
||||||
* @param action An action to execute at the specified time.
|
* @param action An action to execute at the specified time.
|
||||||
*/
|
*/
|
||||||
virtual void scheduleByTimestampNt(const char *msg, scheduling_s *scheduling, efitick_t targetTime, action_s action) = 0;
|
virtual void schedule(const char *msg, scheduling_s *scheduling, efitick_t targetTime, action_s action) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Cancel the specified scheduling_s so that, if currently scheduled, it does not execute.
|
* @brief Cancel the specified scheduling_s so that, if currently scheduled, it does not execute.
|
||||||
|
@ -112,5 +112,5 @@ struct ExecutorInterface {
|
||||||
virtual void cancel(scheduling_s* scheduling) = 0;
|
virtual void cancel(scheduling_s* scheduling) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
ExecutorInterface *getExecutorInterface();
|
Scheduler *getScheduler();
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ uint32_t hwSetTimerDuration;
|
||||||
void globalTimerCallback() {
|
void globalTimerCallback() {
|
||||||
efiAssertVoid(ObdCode::CUSTOM_ERR_6624, hasLotsOfRemainingStack(), "lowstck#2y");
|
efiAssertVoid(ObdCode::CUSTOM_ERR_6624, hasLotsOfRemainingStack(), "lowstck#2y");
|
||||||
|
|
||||||
___engine.executor.onTimerCallback();
|
___engine.scheduler.onTimerCallback();
|
||||||
}
|
}
|
||||||
|
|
||||||
SingleTimerExecutor::SingleTimerExecutor()
|
SingleTimerExecutor::SingleTimerExecutor()
|
||||||
|
@ -45,7 +45,7 @@ SingleTimerExecutor::SingleTimerExecutor()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void SingleTimerExecutor::scheduleByTimestampNt(const char *msg, scheduling_s* scheduling, efitick_t nt, action_s action) {
|
void SingleTimerExecutor::schedule(const char *msg, scheduling_s* scheduling, efitick_t nt, action_s action) {
|
||||||
ScopePerf perf(PE::SingleTimerExecutorScheduleByTimestamp);
|
ScopePerf perf(PE::SingleTimerExecutorScheduleByTimestamp);
|
||||||
|
|
||||||
#if EFI_ENABLE_ASSERTS
|
#if EFI_ENABLE_ASSERTS
|
||||||
|
@ -54,7 +54,7 @@ void SingleTimerExecutor::scheduleByTimestampNt(const char *msg, scheduling_s* s
|
||||||
if (deltaTimeNt >= TOO_FAR_INTO_FUTURE_NT) {
|
if (deltaTimeNt >= TOO_FAR_INTO_FUTURE_NT) {
|
||||||
// we are trying to set callback for too far into the future. This does not look right at all
|
// we are trying to set callback for too far into the future. This does not look right at all
|
||||||
int32_t intDeltaTimeNt = (int32_t)deltaTimeNt;
|
int32_t intDeltaTimeNt = (int32_t)deltaTimeNt;
|
||||||
firmwareError(ObdCode::CUSTOM_ERR_TASK_TIMER_OVERFLOW, "scheduleByTimestampNt() too far: %ld %s", intDeltaTimeNt, msg);
|
firmwareError(ObdCode::CUSTOM_ERR_TASK_TIMER_OVERFLOW, "schedule() too far: %ld %s", intDeltaTimeNt, msg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -161,11 +161,11 @@ void initSingleTimerExecutorHardware() {
|
||||||
void executorStatistics() {
|
void executorStatistics() {
|
||||||
if (engineConfiguration->debugMode == DBG_EXECUTOR) {
|
if (engineConfiguration->debugMode == DBG_EXECUTOR) {
|
||||||
#if EFI_TUNER_STUDIO
|
#if EFI_TUNER_STUDIO
|
||||||
engine->outputChannels.debugIntField1 = ___engine.executor.timerCallbackCounter;
|
engine->outputChannels.debugIntField1 = ___engine.scheduler.timerCallbackCounter;
|
||||||
engine->outputChannels.debugIntField2 = ___engine.executor.executeAllPendingActionsInvocationCounter;
|
engine->outputChannels.debugIntField2 = ___engine.scheduler.executeAllPendingActionsInvocationCounter;
|
||||||
engine->outputChannels.debugIntField3 = ___engine.executor.scheduleCounter;
|
engine->outputChannels.debugIntField3 = ___engine.scheduler.scheduleCounter;
|
||||||
engine->outputChannels.debugIntField4 = ___engine.executor.executeCounter;
|
engine->outputChannels.debugIntField4 = ___engine.scheduler.executeCounter;
|
||||||
engine->outputChannels.debugIntField5 = ___engine.executor.maxExecuteCounter;
|
engine->outputChannels.debugIntField5 = ___engine.scheduler.maxExecuteCounter;
|
||||||
#endif /* EFI_TUNER_STUDIO */
|
#endif /* EFI_TUNER_STUDIO */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,10 +10,10 @@
|
||||||
#include "scheduler.h"
|
#include "scheduler.h"
|
||||||
#include "event_queue.h"
|
#include "event_queue.h"
|
||||||
|
|
||||||
class SingleTimerExecutor final : public ExecutorInterface {
|
class SingleTimerExecutor final : public Scheduler {
|
||||||
public:
|
public:
|
||||||
SingleTimerExecutor();
|
SingleTimerExecutor();
|
||||||
void scheduleByTimestampNt(const char *msg, scheduling_s *scheduling, efitick_t timeNt, action_s action) override;
|
void schedule(const char *msg, scheduling_s *scheduling, efitick_t timeNt, action_s action) override;
|
||||||
void cancel(scheduling_s* scheduling) override;
|
void cancel(scheduling_s* scheduling) override;
|
||||||
|
|
||||||
void onTimerCallback();
|
void onTimerCallback();
|
||||||
|
|
|
@ -16,7 +16,7 @@ bool TriggerScheduler::assertNotInList(AngleBasedEvent *head, AngleBasedEvent *e
|
||||||
/**
|
/**
|
||||||
* for example, this might happen in case of sudden RPM change if event
|
* for example, this might happen in case of sudden RPM change if event
|
||||||
* was not scheduled by angle but was scheduled by time. In case of scheduling
|
* was not scheduled by angle but was scheduled by time. In case of scheduling
|
||||||
* by time with slow RPM the whole next fast revolution might be within the wait
|
* by time with slow RPM the whole next fast revolution might be within the wait
|
||||||
*/
|
*/
|
||||||
warning(ObdCode::CUSTOM_RE_ADDING_INTO_EXECUTION_QUEUE, "re-adding element into event_queue");
|
warning(ObdCode::CUSTOM_RE_ADDING_INTO_EXECUTION_QUEUE, "re-adding element into event_queue");
|
||||||
return true;
|
return true;
|
||||||
|
@ -129,7 +129,7 @@ void TriggerScheduler::scheduleEventsUntilNextTriggerTooth(int rpm,
|
||||||
// In case this event was scheduled by overdwell protection, cancel it so
|
// In case this event was scheduled by overdwell protection, cancel it so
|
||||||
// we can re-schedule at the correct time
|
// we can re-schedule at the correct time
|
||||||
// [tag:overdwell]
|
// [tag:overdwell]
|
||||||
engine->executor.cancel(sDown);
|
engine->scheduler.cancel(sDown);
|
||||||
|
|
||||||
scheduleByAngle(
|
scheduleByAngle(
|
||||||
sDown,
|
sDown,
|
||||||
|
|
|
@ -14,7 +14,7 @@ void Generic4TransmissionController::init() {
|
||||||
enginePins.tcuPcSolenoid.initPin("Pressure Control Solenoid", engineConfiguration->tcu_pc_solenoid_pin, engineConfiguration->tcu_pc_solenoid_pin_mode);
|
enginePins.tcuPcSolenoid.initPin("Pressure Control Solenoid", engineConfiguration->tcu_pc_solenoid_pin, engineConfiguration->tcu_pc_solenoid_pin_mode);
|
||||||
startSimplePwm(&pcPwm,
|
startSimplePwm(&pcPwm,
|
||||||
"Line Pressure",
|
"Line Pressure",
|
||||||
&engine->executor,
|
&engine->scheduler,
|
||||||
&enginePins.tcuPcSolenoid,
|
&enginePins.tcuPcSolenoid,
|
||||||
engineConfiguration->tcu_pc_solenoid_freq,
|
engineConfiguration->tcu_pc_solenoid_freq,
|
||||||
0);
|
0);
|
||||||
|
|
|
@ -9,11 +9,11 @@ static SimplePwm shift32Pwm("3-2 Shift Control");
|
||||||
|
|
||||||
void Gm4l6xTransmissionController::init() {
|
void Gm4l6xTransmissionController::init() {
|
||||||
Generic4TransmissionController::init();
|
Generic4TransmissionController::init();
|
||||||
|
|
||||||
enginePins.tcuTccPwmSolenoid.initPin("TCC PWM Solenoid", engineConfiguration->tcu_tcc_pwm_solenoid, engineConfiguration->tcu_tcc_pwm_solenoid_mode);
|
enginePins.tcuTccPwmSolenoid.initPin("TCC PWM Solenoid", engineConfiguration->tcu_tcc_pwm_solenoid, engineConfiguration->tcu_tcc_pwm_solenoid_mode);
|
||||||
startSimplePwm(&tccPwm,
|
startSimplePwm(&tccPwm,
|
||||||
"TCC",
|
"TCC",
|
||||||
&engine->executor,
|
&engine->scheduler,
|
||||||
&enginePins.tcuTccPwmSolenoid,
|
&enginePins.tcuTccPwmSolenoid,
|
||||||
engineConfiguration->tcu_tcc_pwm_solenoid_freq,
|
engineConfiguration->tcu_tcc_pwm_solenoid_freq,
|
||||||
0);
|
0);
|
||||||
|
@ -21,7 +21,7 @@ void Gm4l6xTransmissionController::init() {
|
||||||
enginePins.tcu32Solenoid.initPin("3-2 Shift Solenoid", engineConfiguration->tcu_32_solenoid_pin, engineConfiguration->tcu_32_solenoid_pin_mode);
|
enginePins.tcu32Solenoid.initPin("3-2 Shift Solenoid", engineConfiguration->tcu_32_solenoid_pin, engineConfiguration->tcu_32_solenoid_pin_mode);
|
||||||
startSimplePwm(&shift32Pwm,
|
startSimplePwm(&shift32Pwm,
|
||||||
"3-2 Solenoid",
|
"3-2 Solenoid",
|
||||||
&engine->executor,
|
&engine->scheduler,
|
||||||
&enginePins.tcu32Solenoid,
|
&enginePins.tcu32Solenoid,
|
||||||
engineConfiguration->tcu_32_solenoid_freq,
|
engineConfiguration->tcu_32_solenoid_freq,
|
||||||
0);
|
0);
|
||||||
|
|
|
@ -234,7 +234,7 @@ static void logVvtFront(bool useOnlyRise, bool isImportantFront, TriggerValue fr
|
||||||
#if EFI_PROD_CODE
|
#if EFI_PROD_CODE
|
||||||
writePad("cam debug", engineConfiguration->camInputsDebug[index], 1);
|
writePad("cam debug", engineConfiguration->camInputsDebug[index], 1);
|
||||||
#endif /* EFI_PROD_CODE */
|
#endif /* EFI_PROD_CODE */
|
||||||
getExecutorInterface()->scheduleByTimestampNt("dbg_on", &debugToggleScheduling, nowNt + DEBUG_PIN_DELAY, &turnOffAllDebugFields);
|
getScheduler()->schedule("dbg_on", &debugToggleScheduling, nowNt + DEBUG_PIN_DELAY, &turnOffAllDebugFields);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!useOnlyRise || engineConfiguration->displayLogicLevelsInEngineSniffer) {
|
if (!useOnlyRise || engineConfiguration->displayLogicLevelsInEngineSniffer) {
|
||||||
|
@ -536,7 +536,7 @@ void handleShaftSignal(int signalIndex, bool isRising, efitick_t timestamp) {
|
||||||
#if EFI_PROD_CODE
|
#if EFI_PROD_CODE
|
||||||
writePad("trigger debug", engineConfiguration->triggerInputDebugPins[signalIndex], 1);
|
writePad("trigger debug", engineConfiguration->triggerInputDebugPins[signalIndex], 1);
|
||||||
#endif /* EFI_PROD_CODE */
|
#endif /* EFI_PROD_CODE */
|
||||||
getExecutorInterface()->scheduleByTimestampNt("dbg_off", &debugToggleScheduling, timestamp + DEBUG_PIN_DELAY, &turnOffAllDebugFields);
|
getScheduler()->schedule("dbg_off", &debugToggleScheduling, timestamp + DEBUG_PIN_DELAY, &turnOffAllDebugFields);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if EFI_TOOTH_LOGGER
|
#if EFI_TOOTH_LOGGER
|
||||||
|
|
|
@ -182,7 +182,7 @@ static void startSimulatedTriggerSignal() {
|
||||||
if (s->getSize() == 0)
|
if (s->getSize() == 0)
|
||||||
continue;
|
continue;
|
||||||
triggerEmulatorSignals[channel].weComplexInit(
|
triggerEmulatorSignals[channel].weComplexInit(
|
||||||
&engine->executor,
|
&engine->scheduler,
|
||||||
&s->wave,
|
&s->wave,
|
||||||
updateTriggerWaveformIfNeeded, emulatorApplyPinState);
|
updateTriggerWaveformIfNeeded, emulatorApplyPinState);
|
||||||
}
|
}
|
||||||
|
|
|
@ -129,7 +129,7 @@ static void watchDogBuddyCallback(void*) {
|
||||||
* watchdog happy by ensuring that we have scheduler activity even in case of very broken configuration
|
* watchdog happy by ensuring that we have scheduler activity even in case of very broken configuration
|
||||||
* without any PWM or input pins
|
* without any PWM or input pins
|
||||||
*/
|
*/
|
||||||
engine->executor.scheduleByTimestampNt("watch", &watchDogBuddy, getTimeNowNt() + MS2NT(1000), watchDogBuddyCallback);
|
engine->scheduler.schedule("watch", &watchDogBuddy, getTimeNowNt() + MS2NT(1000), watchDogBuddyCallback);
|
||||||
}
|
}
|
||||||
|
|
||||||
static volatile bool testSchedulingHappened = false;
|
static volatile bool testSchedulingHappened = false;
|
||||||
|
@ -155,7 +155,7 @@ static void validateHardwareTimer() {
|
||||||
testScheduling.reset();
|
testScheduling.reset();
|
||||||
|
|
||||||
// to save RAM let's use 'watchDogBuddy' here once before we enable watchdog
|
// to save RAM let's use 'watchDogBuddy' here once before we enable watchdog
|
||||||
engine->executor.scheduleByTimestampNt(
|
engine->scheduler.schedule(
|
||||||
"hw-validate",
|
"hw-validate",
|
||||||
&watchDogBuddy,
|
&watchDogBuddy,
|
||||||
getTimeNowNt() + MS2NT(TEST_CALLBACK_DELAY_MS),
|
getTimeNowNt() + MS2NT(TEST_CALLBACK_DELAY_MS),
|
||||||
|
|
|
@ -38,7 +38,7 @@ struct CallbackContext
|
||||||
|
|
||||||
static void doScheduleForLater(scheduling_s *scheduling, int delayUs, action_s action);
|
static void doScheduleForLater(scheduling_s *scheduling, int delayUs, action_s action);
|
||||||
|
|
||||||
void SleepExecutor::scheduleByTimestampNt(const char *msg, scheduling_s* scheduling, efitick_t timeNt, action_s action) {
|
void SleepExecutor::schedule(const char *msg, scheduling_s* scheduling, efitick_t timeNt, action_s action) {
|
||||||
doScheduleForLater(scheduling, NT2US(timeNt) - getTimeNowUs(), action);
|
doScheduleForLater(scheduling, NT2US(timeNt) - getTimeNowUs(), action);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,8 +9,8 @@
|
||||||
|
|
||||||
#include "scheduler.h"
|
#include "scheduler.h"
|
||||||
|
|
||||||
class SleepExecutor : public ExecutorInterface {
|
class SleepExecutor : public Scheduler {
|
||||||
public:
|
public:
|
||||||
void scheduleByTimestampNt(const char *msg, scheduling_s *scheduling, efitick_t timeNt, action_s action) override;
|
void schedule(const char *msg, scheduling_s *scheduling, efitick_t timeNt, action_s action) override;
|
||||||
void cancel(scheduling_s* s) override;
|
void cancel(scheduling_s* s) override;
|
||||||
};
|
};
|
||||||
|
|
|
@ -80,7 +80,7 @@ public:
|
||||||
MockExecutor();
|
MockExecutor();
|
||||||
virtual ~MockExecutor();
|
virtual ~MockExecutor();
|
||||||
|
|
||||||
MOCK_METHOD(void, scheduleByTimestampNt, (const char *msg, scheduling_s *scheduling, efitick_t timeNt, action_s action), (override));
|
MOCK_METHOD(void, schedule, (const char *msg, scheduling_s *scheduling, efitick_t timeNt, action_s action), (override));
|
||||||
MOCK_METHOD(void, cancel, (scheduling_s*), (override));
|
MOCK_METHOD(void, cancel, (scheduling_s*), (override));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -227,12 +227,12 @@ void EngineTestHelper::smartFireTriggerEvents2(int count, float durationMs) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void EngineTestHelper::clearQueue() {
|
void EngineTestHelper::clearQueue() {
|
||||||
engine.executor.executeAll(99999999); // this is needed to clear 'isScheduled' flag
|
engine.scheduler.executeAll(99999999); // this is needed to clear 'isScheduled' flag
|
||||||
ASSERT_EQ( 0, engine.executor.size()) << "Failed to clearQueue";
|
ASSERT_EQ( 0, engine.scheduler.size()) << "Failed to clearQueue";
|
||||||
}
|
}
|
||||||
|
|
||||||
int EngineTestHelper::executeActions() {
|
int EngineTestHelper::executeActions() {
|
||||||
return engine.executor.executeAll(getTimeNowUs());
|
return engine.scheduler.executeAll(getTimeNowUs());
|
||||||
}
|
}
|
||||||
|
|
||||||
void EngineTestHelper::moveTimeForwardMs(float deltaTimeMs) {
|
void EngineTestHelper::moveTimeForwardMs(float deltaTimeMs) {
|
||||||
|
@ -268,7 +268,7 @@ void EngineTestHelper::setTimeAndInvokeEventsUs(int targetTimeUs) {
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
while (true) {
|
while (true) {
|
||||||
criticalAssertVoid(counter++ < 100'000, "EngineTestHelper: failing to setTimeAndInvokeEventsUs");
|
criticalAssertVoid(counter++ < 100'000, "EngineTestHelper: failing to setTimeAndInvokeEventsUs");
|
||||||
scheduling_s* nextScheduledEvent = engine.executor.getHead();
|
scheduling_s* nextScheduledEvent = engine.scheduler.getHead();
|
||||||
if (nextScheduledEvent == nullptr) {
|
if (nextScheduledEvent == nullptr) {
|
||||||
// nothing pending - we are done here
|
// nothing pending - we are done here
|
||||||
break;
|
break;
|
||||||
|
@ -279,7 +279,7 @@ void EngineTestHelper::setTimeAndInvokeEventsUs(int targetTimeUs) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
setTimeNowUs(nextEventTime);
|
setTimeNowUs(nextEventTime);
|
||||||
engine.executor.executeAll(getTimeNowUs());
|
engine.scheduler.executeAll(getTimeNowUs());
|
||||||
}
|
}
|
||||||
|
|
||||||
setTimeNowUs(targetTimeUs);
|
setTimeNowUs(targetTimeUs);
|
||||||
|
@ -300,7 +300,7 @@ void EngineTestHelper::assertInjectorDownEvent(const char *msg, int eventIndex,
|
||||||
}
|
}
|
||||||
|
|
||||||
scheduling_s * EngineTestHelper::assertEvent5(const char *msg, int index, void *callback, efitimeus_t expectedTimestamp) {
|
scheduling_s * EngineTestHelper::assertEvent5(const char *msg, int index, void *callback, efitimeus_t expectedTimestamp) {
|
||||||
TestExecutor *executor = &engine.executor;
|
TestExecutor *executor = &engine.scheduler;
|
||||||
EXPECT_TRUE(executor->size() > index) << msg << " valid index";
|
EXPECT_TRUE(executor->size() > index) << msg << " valid index";
|
||||||
scheduling_s *event = executor->getForUnitTest(index);
|
scheduling_s *event = executor->getForUnitTest(index);
|
||||||
assertEqualsM4(msg, " callback up/down", (void*)event->action.getCallback() == (void*) callback, 1);
|
assertEqualsM4(msg, " callback up/down", (void*)event->action.getCallback() == (void*) callback, 1);
|
||||||
|
|
|
@ -35,9 +35,9 @@ scheduling_s* TestExecutor::getForUnitTest(int index) {
|
||||||
return schedulingQueue.getElementAtIndexForUnitText(index);
|
return schedulingQueue.getElementAtIndexForUnitText(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestExecutor::scheduleByTimestampNt(const char *msg, scheduling_s* scheduling, efitick_t timeNt, action_s action) {
|
void TestExecutor::schedule(const char *msg, scheduling_s* scheduling, efitick_t timeNt, action_s action) {
|
||||||
if (m_mockExecutor) {
|
if (m_mockExecutor) {
|
||||||
m_mockExecutor->scheduleByTimestampNt(msg, scheduling, timeNt, action);
|
m_mockExecutor->schedule(msg, scheduling, timeNt, action);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// by the way we have loss of precision while converting NT to integer US
|
// by the way we have loss of precision while converting NT to integer US
|
||||||
|
@ -55,6 +55,6 @@ void TestExecutor::cancel(scheduling_s* s) {
|
||||||
schedulingQueue.remove(s);
|
schedulingQueue.remove(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestExecutor::setMockExecutor(ExecutorInterface* exec) {
|
void TestExecutor::setMockExecutor(Scheduler* exec) {
|
||||||
m_mockExecutor = exec;
|
m_mockExecutor = exec;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,11 +11,11 @@
|
||||||
#include "scheduler.h"
|
#include "scheduler.h"
|
||||||
#include "event_queue.h"
|
#include "event_queue.h"
|
||||||
|
|
||||||
class TestExecutor : public ExecutorInterface {
|
class TestExecutor : public Scheduler {
|
||||||
public:
|
public:
|
||||||
~TestExecutor();
|
~TestExecutor();
|
||||||
|
|
||||||
void scheduleByTimestampNt(const char *msg, scheduling_s *scheduling, efitick_t timeNt, action_s action) override;
|
void schedule(const char *msg, scheduling_s *scheduling, efitick_t timeNt, action_s action) override;
|
||||||
void cancel(scheduling_s* scheduling) override;
|
void cancel(scheduling_s* scheduling) override;
|
||||||
|
|
||||||
void clear();
|
void clear();
|
||||||
|
@ -24,8 +24,8 @@ public:
|
||||||
scheduling_s * getHead();
|
scheduling_s * getHead();
|
||||||
scheduling_s * getForUnitTest(int index);
|
scheduling_s * getForUnitTest(int index);
|
||||||
|
|
||||||
void setMockExecutor(ExecutorInterface* exec);
|
void setMockExecutor(Scheduler* exec);
|
||||||
private:
|
private:
|
||||||
EventQueue schedulingQueue;
|
EventQueue schedulingQueue;
|
||||||
ExecutorInterface* m_mockExecutor = nullptr;
|
Scheduler* m_mockExecutor = nullptr;
|
||||||
};
|
};
|
||||||
|
|
|
@ -65,14 +65,14 @@ TEST(fuelControl, transitionIssue1592) {
|
||||||
// Injector 2 should be scheduled to open then close
|
// Injector 2 should be scheduled to open then close
|
||||||
void* inj2 = reinterpret_cast<void*>(&engine->injectionEvents.elements[1]);
|
void* inj2 = reinterpret_cast<void*>(&engine->injectionEvents.elements[1]);
|
||||||
|
|
||||||
ASSERT_EQ(engine->executor.size(), 2);
|
ASSERT_EQ(engine->scheduler.size(), 2);
|
||||||
|
|
||||||
// Check that the action is correct - we don't care about the timing necessarily
|
// Check that the action is correct - we don't care about the timing necessarily
|
||||||
auto sched_open = engine->executor.getForUnitTest(0);
|
auto sched_open = engine->scheduler.getForUnitTest(0);
|
||||||
ASSERT_EQ(sched_open->action.getArgument(), inj2);
|
ASSERT_EQ(sched_open->action.getArgument(), inj2);
|
||||||
ASSERT_EQ(sched_open->action.getCallback(), (void(*)(void*))turnInjectionPinHigh);
|
ASSERT_EQ(sched_open->action.getCallback(), (void(*)(void*))turnInjectionPinHigh);
|
||||||
|
|
||||||
auto sched_close = engine->executor.getForUnitTest(1);
|
auto sched_close = engine->scheduler.getForUnitTest(1);
|
||||||
// Next action should be closing the same injector
|
// Next action should be closing the same injector
|
||||||
ASSERT_EQ(sched_close->action.getArgument(), inj2);
|
ASSERT_EQ(sched_close->action.getArgument(), inj2);
|
||||||
ASSERT_EQ(sched_close->action.getCallback(), (void(*)(void*))turnInjectionPinLow);
|
ASSERT_EQ(sched_close->action.getCallback(), (void(*)(void*))turnInjectionPinLow);
|
||||||
|
|
|
@ -89,7 +89,7 @@ TEST(ignition, trailingSpark) {
|
||||||
EXPECT_EQ(enginePins.trailingCoils[0].getLogicValue(), false);
|
EXPECT_EQ(enginePins.trailingCoils[0].getLogicValue(), false);
|
||||||
|
|
||||||
// Should be a TDC callback + spark firing
|
// Should be a TDC callback + spark firing
|
||||||
EXPECT_EQ(engine->executor.size(), 2);
|
EXPECT_EQ(engine->scheduler.size(), 2);
|
||||||
|
|
||||||
// execute all actions
|
// execute all actions
|
||||||
eth.executeActions();
|
eth.executeActions();
|
||||||
|
@ -198,7 +198,7 @@ TEST(ignition, oddCylinderWastedSpark) {
|
||||||
StrictMock<MockExecutor> mockExec;
|
StrictMock<MockExecutor> mockExec;
|
||||||
|
|
||||||
EngineTestHelper eth(engine_type_e::TEST_ENGINE);
|
EngineTestHelper eth(engine_type_e::TEST_ENGINE);
|
||||||
engine->executor.setMockExecutor(&mockExec);
|
engine->scheduler.setMockExecutor(&mockExec);
|
||||||
engineConfiguration->cylindersCount = 1;
|
engineConfiguration->cylindersCount = 1;
|
||||||
engineConfiguration->firingOrder = FO_1;
|
engineConfiguration->firingOrder = FO_1;
|
||||||
engineConfiguration->ignitionMode = IM_WASTED_SPARK;
|
engineConfiguration->ignitionMode = IM_WASTED_SPARK;
|
||||||
|
@ -216,19 +216,19 @@ TEST(ignition, oddCylinderWastedSpark) {
|
||||||
// Dwell 5 deg from now
|
// Dwell 5 deg from now
|
||||||
float nt1deg = USF2NT(engine->rpmCalculator.oneDegreeUs);
|
float nt1deg = USF2NT(engine->rpmCalculator.oneDegreeUs);
|
||||||
efitick_t startTime = nowNt1 + nt1deg * 5;
|
efitick_t startTime = nowNt1 + nt1deg * 5;
|
||||||
EXPECT_CALL(mockExec, scheduleByTimestampNt(testing::NotNull(), _, startTime, _));
|
EXPECT_CALL(mockExec, schedule(testing::NotNull(), _, startTime, _));
|
||||||
// Spark 15 deg from now
|
// Spark 15 deg from now
|
||||||
efitick_t endTime = startTime + nt1deg * 10;
|
efitick_t endTime = startTime + nt1deg * 10;
|
||||||
EXPECT_CALL(mockExec, scheduleByTimestampNt(testing::NotNull(), _, endTime, _));
|
EXPECT_CALL(mockExec, schedule(testing::NotNull(), _, endTime, _));
|
||||||
|
|
||||||
|
|
||||||
// Should schedule second dwell+fire pair, the out of phase copy
|
// Should schedule second dwell+fire pair, the out of phase copy
|
||||||
// Dwell 5 deg from now
|
// Dwell 5 deg from now
|
||||||
startTime = nowNt2 + nt1deg * 5;
|
startTime = nowNt2 + nt1deg * 5;
|
||||||
EXPECT_CALL(mockExec, scheduleByTimestampNt(testing::NotNull(), _, startTime, _));
|
EXPECT_CALL(mockExec, schedule(testing::NotNull(), _, startTime, _));
|
||||||
// Spark 15 deg from now
|
// Spark 15 deg from now
|
||||||
endTime = startTime + nt1deg * 10;
|
endTime = startTime + nt1deg * 10;
|
||||||
EXPECT_CALL(mockExec, scheduleByTimestampNt(testing::NotNull(), _, endTime, _));
|
EXPECT_CALL(mockExec, schedule(testing::NotNull(), _, endTime, _));
|
||||||
}
|
}
|
||||||
|
|
||||||
engine->ignitionState.sparkDwell = 1;
|
engine->ignitionState.sparkDwell = 1;
|
||||||
|
|
|
@ -53,7 +53,7 @@ TEST(OddFireRunningMode, hd) {
|
||||||
|
|
||||||
angle_t expectedAngle3 = -180 + cylinderTwo - timing;
|
angle_t expectedAngle3 = -180 + cylinderTwo - timing;
|
||||||
|
|
||||||
ASSERT_EQ( 8, engine->executor.size());
|
ASSERT_EQ( 8, engine->scheduler.size());
|
||||||
eth.assertEvent5("spark down#3", 3, (void*)fireSparkAndPrepareNextSchedule, eth.angleToTimeUs(expectedAngle3));
|
eth.assertEvent5("spark down#3", 3, (void*)fireSparkAndPrepareNextSchedule, eth.angleToTimeUs(expectedAngle3));
|
||||||
|
|
||||||
angle_t expectedAngle7 = 180 + cylinderOne - timing;
|
angle_t expectedAngle7 = 180 + cylinderOne - timing;
|
||||||
|
@ -61,13 +61,13 @@ TEST(OddFireRunningMode, hd) {
|
||||||
|
|
||||||
eth.assertRpm( 500, "spinning-RPM#1");
|
eth.assertRpm( 500, "spinning-RPM#1");
|
||||||
|
|
||||||
engine->executor.executeAll(getTimeNowUs() + MS2US(1000000));
|
engine->scheduler.executeAll(getTimeNowUs() + MS2US(1000000));
|
||||||
|
|
||||||
eth.fireTriggerEvents2(2 /* count */ , 60 /* ms */);
|
eth.fireTriggerEvents2(2 /* count */ , 60 /* ms */);
|
||||||
ASSERT_EQ(IM_SEQUENTIAL, getCurrentInjectionMode());
|
ASSERT_EQ(IM_SEQUENTIAL, getCurrentInjectionMode());
|
||||||
ASSERT_NEAR(0.0069257142022, getInjectionMass(200), EPS3D);
|
ASSERT_NEAR(0.0069257142022, getInjectionMass(200), EPS3D);
|
||||||
|
|
||||||
ASSERT_EQ( 8, engine->executor.size());
|
ASSERT_EQ( 8, engine->scheduler.size());
|
||||||
eth.assertEvent5("fuel down2#1", 1, (void*)turnInjectionPinLow, eth.angleToTimeUs(180 + PORT_INJECTION_OFFSET + cylinderOne));
|
eth.assertEvent5("fuel down2#1", 1, (void*)turnInjectionPinLow, eth.angleToTimeUs(180 + PORT_INJECTION_OFFSET + cylinderOne));
|
||||||
eth.assertEvent5("spark down2#3", 3, (void*)fireSparkAndPrepareNextSchedule, eth.angleToTimeUs(-180 + cylinderTwo - timing));
|
eth.assertEvent5("spark down2#3", 3, (void*)fireSparkAndPrepareNextSchedule, eth.angleToTimeUs(-180 + cylinderTwo - timing));
|
||||||
eth.assertEvent5("fuel down2#6", 6, (void*)turnInjectionPinLow, eth.angleToTimeUs(540 + PORT_INJECTION_OFFSET + cylinderTwo));
|
eth.assertEvent5("fuel down2#6", 6, (void*)turnInjectionPinLow, eth.angleToTimeUs(540 + PORT_INJECTION_OFFSET + cylinderTwo));
|
||||||
|
|
|
@ -22,11 +22,11 @@ TEST(issues, issueOneCylinderSpecialCase968) {
|
||||||
|
|
||||||
eth.setTriggerType(trigger_type_e::TT_HALF_MOON);
|
eth.setTriggerType(trigger_type_e::TT_HALF_MOON);
|
||||||
|
|
||||||
ASSERT_EQ( 0, engine->executor.size()) << "start";
|
ASSERT_EQ( 0, engine->scheduler.size()) << "start";
|
||||||
|
|
||||||
eth.fireTriggerEvents2(/* count */ 2, 50 /* ms */);
|
eth.fireTriggerEvents2(/* count */ 2, 50 /* ms */);
|
||||||
eth.assertRpm(0);
|
eth.assertRpm(0);
|
||||||
ASSERT_EQ( 0, engine->executor.size()) << "first revolution(s)";
|
ASSERT_EQ( 0, engine->scheduler.size()) << "first revolution(s)";
|
||||||
|
|
||||||
eth.fireTriggerEvents2(/* count */ 1, 50 /* ms */);
|
eth.fireTriggerEvents2(/* count */ 1, 50 /* ms */);
|
||||||
eth.assertRpm(600, "RPM");
|
eth.assertRpm(600, "RPM");
|
||||||
|
@ -36,11 +36,11 @@ TEST(issues, issueOneCylinderSpecialCase968) {
|
||||||
angle_t expectedAngle = 180 - Gy6139_globalTriggerAngleOffset + timing;
|
angle_t expectedAngle = 180 - Gy6139_globalTriggerAngleOffset + timing;
|
||||||
int expectedDeltaTimeUs = eth.angleToTimeUs(expectedAngle);
|
int expectedDeltaTimeUs = eth.angleToTimeUs(expectedAngle);
|
||||||
|
|
||||||
ASSERT_EQ( 2, engine->executor.size()) << "first revolution(s)";
|
ASSERT_EQ( 2, engine->scheduler.size()) << "first revolution(s)";
|
||||||
eth.assertEvent5("spark up#0", 0, (void*)turnSparkPinHighStartCharging, -expectedDeltaTimeUs - MS2US(DEFAULT_CRANKING_DWELL_MS));
|
eth.assertEvent5("spark up#0", 0, (void*)turnSparkPinHighStartCharging, -expectedDeltaTimeUs - MS2US(DEFAULT_CRANKING_DWELL_MS));
|
||||||
eth.assertEvent5("spark down#0", 1, (void*)fireSparkAndPrepareNextSchedule, -expectedDeltaTimeUs);
|
eth.assertEvent5("spark down#0", 1, (void*)fireSparkAndPrepareNextSchedule, -expectedDeltaTimeUs);
|
||||||
|
|
||||||
|
|
||||||
eth.fireTriggerEvents2(/* count */ 1, 50 /* ms */);
|
eth.fireTriggerEvents2(/* count */ 1, 50 /* ms */);
|
||||||
ASSERT_EQ( 4, engine->executor.size()) << "first revolution(s)";
|
ASSERT_EQ( 4, engine->scheduler.size()) << "first revolution(s)";
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ TEST(engine, testPlainCrankingWithoutAdvancedFeatures) {
|
||||||
eth.fireRise(/* delayMs */ 200);
|
eth.fireRise(/* delayMs */ 200);
|
||||||
eth.assertRpm(300, "RPM#2");
|
eth.assertRpm(300, "RPM#2");
|
||||||
// two simultaneous injections
|
// two simultaneous injections
|
||||||
ASSERT_EQ( 4, engine->executor.size()) << "plain#2";
|
ASSERT_EQ( 4, engine->scheduler.size()) << "plain#2";
|
||||||
|
|
||||||
eth.assertEvent5("sim start", 0, (void*)startSimultaneousInjection, 100000 - 1625);
|
eth.assertEvent5("sim start", 0, (void*)startSimultaneousInjection, 100000 - 1625);
|
||||||
// -1 because ugh floating point math
|
// -1 because ugh floating point math
|
||||||
|
@ -41,7 +41,7 @@ TEST(priming, startScheduling) {
|
||||||
// Turn on the ignition switch!
|
// Turn on the ignition switch!
|
||||||
engine->module<PrimeController>()->onIgnitionStateChanged(true);
|
engine->module<PrimeController>()->onIgnitionStateChanged(true);
|
||||||
|
|
||||||
ASSERT_EQ(1, engine->executor.size()) << "prime fuel";
|
ASSERT_EQ(1, engine->scheduler.size()) << "prime fuel";
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(priming, duration) {
|
TEST(priming, duration) {
|
||||||
|
|
|
@ -244,7 +244,7 @@ TEST(HPFP, Schedule) {
|
||||||
auto & hpfp = *engine->module<HpfpController>();
|
auto & hpfp = *engine->module<HpfpController>();
|
||||||
|
|
||||||
StrictMock<MockExecutor> mockExec;
|
StrictMock<MockExecutor> mockExec;
|
||||||
engine->executor.setMockExecutor(&mockExec);
|
engine->scheduler.setMockExecutor(&mockExec);
|
||||||
engineConfiguration->hpfpActivationAngle = 30;
|
engineConfiguration->hpfpActivationAngle = 30;
|
||||||
|
|
||||||
constexpr angle_t angle0 = 90;
|
constexpr angle_t angle0 = 90;
|
||||||
|
@ -262,13 +262,13 @@ TEST(HPFP, Schedule) {
|
||||||
|
|
||||||
// First call to setRpmValue will cause a dummy call to fast periodic timer.
|
// First call to setRpmValue will cause a dummy call to fast periodic timer.
|
||||||
// Injection Mass will be 0 so expect a no-op.
|
// Injection Mass will be 0 so expect a no-op.
|
||||||
EXPECT_CALL(mockExec, scheduleByTimestampNt(testing::NotNull(), &hpfp.m_event.eventScheduling, nt0, action_s(HpfpController::pinTurnOff, &hpfp)));
|
EXPECT_CALL(mockExec, schedule(testing::NotNull(), &hpfp.m_event.eventScheduling, nt0, action_s(HpfpController::pinTurnOff, &hpfp)));
|
||||||
|
|
||||||
// Second call will be the start of a real pump event.
|
// Second call will be the start of a real pump event.
|
||||||
EXPECT_CALL(mockExec, scheduleByTimestampNt(testing::NotNull(), &hpfp.m_event.eventScheduling, nt1, action_s(HpfpController::pinTurnOn, &hpfp)));
|
EXPECT_CALL(mockExec, schedule(testing::NotNull(), &hpfp.m_event.eventScheduling, nt1, action_s(HpfpController::pinTurnOn, &hpfp)));
|
||||||
|
|
||||||
// Third call will be off event
|
// Third call will be off event
|
||||||
EXPECT_CALL(mockExec, scheduleByTimestampNt(testing::NotNull(), &hpfp.m_event.eventScheduling, nt2, action_s(HpfpController::pinTurnOff, &hpfp)));
|
EXPECT_CALL(mockExec, schedule(testing::NotNull(), &hpfp.m_event.eventScheduling, nt2, action_s(HpfpController::pinTurnOff, &hpfp)));
|
||||||
}
|
}
|
||||||
EXPECT_CALL(mockExec, cancel(_)).Times(2);
|
EXPECT_CALL(mockExec, cancel(_)).Times(2);
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ TEST(cranking, testFasterEngineSpinningUp) {
|
||||||
// check RPM
|
// check RPM
|
||||||
eth.assertRpm( 0, "RPM=0");
|
eth.assertRpm( 0, "RPM=0");
|
||||||
// the queue should be empty, no trigger events yet
|
// the queue should be empty, no trigger events yet
|
||||||
ASSERT_EQ(0, engine->executor.size()) << "plain#1";
|
ASSERT_EQ(0, engine->scheduler.size()) << "plain#1";
|
||||||
|
|
||||||
// check all events starting from now
|
// check all events starting from now
|
||||||
// advance 1 revolution
|
// advance 1 revolution
|
||||||
|
@ -52,7 +52,7 @@ TEST(cranking, testFasterEngineSpinningUp) {
|
||||||
// due to isFasterEngineSpinUp=true, we should have already detected RPM!
|
// due to isFasterEngineSpinUp=true, we should have already detected RPM!
|
||||||
eth.assertRpm( 300, "spinning-RPM#1");
|
eth.assertRpm( 300, "spinning-RPM#1");
|
||||||
// two simultaneous injections
|
// two simultaneous injections
|
||||||
ASSERT_EQ(4, engine->executor.size()) << "plain#2";
|
ASSERT_EQ(4, engine->scheduler.size()) << "plain#2";
|
||||||
// test if they are simultaneous
|
// test if they are simultaneous
|
||||||
ASSERT_EQ(IM_SIMULTANEOUS, getCurrentInjectionMode());
|
ASSERT_EQ(IM_SIMULTANEOUS, getCurrentInjectionMode());
|
||||||
// test if ignition mode is temporary changed to wasted spark, if set to individual coils
|
// test if ignition mode is temporary changed to wasted spark, if set to individual coils
|
||||||
|
@ -81,7 +81,7 @@ TEST(cranking, testFasterEngineSpinningUp) {
|
||||||
// Should still be in wasted spark since we don't have cam sync yet
|
// Should still be in wasted spark since we don't have cam sync yet
|
||||||
ASSERT_EQ(IM_WASTED_SPARK, getCurrentIgnitionMode());
|
ASSERT_EQ(IM_WASTED_SPARK, getCurrentIgnitionMode());
|
||||||
// two simultaneous injections
|
// two simultaneous injections
|
||||||
ASSERT_EQ( 4, engine->executor.size()) << "plain#2";
|
ASSERT_EQ( 4, engine->scheduler.size()) << "plain#2";
|
||||||
// check real events
|
// check real events
|
||||||
expectedSimultaneousTimestamp = eth.angleToTimeUs(360 - phase);
|
expectedSimultaneousTimestamp = eth.angleToTimeUs(360 - phase);
|
||||||
|
|
||||||
|
@ -108,7 +108,7 @@ TEST(cranking, testFasterEngineSpinningUp) {
|
||||||
ASSERT_EQ(IM_SEQUENTIAL, getCurrentInjectionMode());
|
ASSERT_EQ(IM_SEQUENTIAL, getCurrentInjectionMode());
|
||||||
ASSERT_NEAR(0.0, getInjectionMass(200), EPS3D); // in this test fuel calculation is not active in running mode
|
ASSERT_NEAR(0.0, getInjectionMass(200), EPS3D); // in this test fuel calculation is not active in running mode
|
||||||
// 4 sequential injections for the full cycle
|
// 4 sequential injections for the full cycle
|
||||||
ASSERT_EQ( 8, engine->executor.size()) << "plain#3";
|
ASSERT_EQ( 8, engine->scheduler.size()) << "plain#3";
|
||||||
|
|
||||||
// check real events for sequential injection
|
// check real events for sequential injection
|
||||||
// Note: See addFuelEvents() fix inside setRpmValue()!
|
// Note: See addFuelEvents() fix inside setRpmValue()!
|
||||||
|
|
|
@ -19,7 +19,7 @@ TEST(injectionScheduling, InjectionIsScheduled) {
|
||||||
StrictMock<MockExecutor> mockExec;
|
StrictMock<MockExecutor> mockExec;
|
||||||
|
|
||||||
EngineTestHelper eth(engine_type_e::TEST_ENGINE);
|
EngineTestHelper eth(engine_type_e::TEST_ENGINE);
|
||||||
engine->executor.setMockExecutor(&mockExec);
|
engine->scheduler.setMockExecutor(&mockExec);
|
||||||
|
|
||||||
efitick_t nowNt = 1000000;
|
efitick_t nowNt = 1000000;
|
||||||
|
|
||||||
|
@ -42,9 +42,9 @@ TEST(injectionScheduling, InjectionIsScheduled) {
|
||||||
// rising edge 5 degrees from now
|
// rising edge 5 degrees from now
|
||||||
float nt5deg = USF2NT(engine->rpmCalculator.oneDegreeUs * 5);
|
float nt5deg = USF2NT(engine->rpmCalculator.oneDegreeUs * 5);
|
||||||
efitick_t startTime = nowNt + nt5deg;
|
efitick_t startTime = nowNt + nt5deg;
|
||||||
EXPECT_CALL(mockExec, scheduleByTimestampNt(testing::NotNull(), _, startTime, Not(Truly(ActionArgumentHasLowBitSet))));
|
EXPECT_CALL(mockExec, schedule(testing::NotNull(), _, startTime, Not(Truly(ActionArgumentHasLowBitSet))));
|
||||||
// falling edge 20ms later
|
// falling edge 20ms later
|
||||||
EXPECT_CALL(mockExec, scheduleByTimestampNt(testing::NotNull(), _, startTime + MS2NT(20), Property(&action_s::getArgument, Eq(&event))));
|
EXPECT_CALL(mockExec, schedule(testing::NotNull(), _, startTime + MS2NT(20), Property(&action_s::getArgument, Eq(&event))));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Event scheduled at 125 degrees
|
// Event scheduled at 125 degrees
|
||||||
|
@ -59,7 +59,7 @@ TEST(injectionScheduling, InjectionIsScheduledDualStage) {
|
||||||
StrictMock<MockInjectorModel2> im;
|
StrictMock<MockInjectorModel2> im;
|
||||||
|
|
||||||
EngineTestHelper eth(engine_type_e::TEST_ENGINE);
|
EngineTestHelper eth(engine_type_e::TEST_ENGINE);
|
||||||
engine->executor.setMockExecutor(&mockExec);
|
engine->scheduler.setMockExecutor(&mockExec);
|
||||||
engine->module<InjectorModelPrimary>().set(&im);
|
engine->module<InjectorModelPrimary>().set(&im);
|
||||||
engine->module<InjectorModelSecondary>().set(&im);
|
engine->module<InjectorModelSecondary>().set(&im);
|
||||||
|
|
||||||
|
@ -91,11 +91,11 @@ TEST(injectionScheduling, InjectionIsScheduledDualStage) {
|
||||||
// rising edge 5 degrees from now
|
// rising edge 5 degrees from now
|
||||||
float nt5deg = USF2NT(engine->rpmCalculator.oneDegreeUs * 5);
|
float nt5deg = USF2NT(engine->rpmCalculator.oneDegreeUs * 5);
|
||||||
efitick_t startTime = nowNt + nt5deg;
|
efitick_t startTime = nowNt + nt5deg;
|
||||||
EXPECT_CALL(mockExec, scheduleByTimestampNt(testing::NotNull(), _, startTime, Truly(ActionArgumentHasLowBitSet)));
|
EXPECT_CALL(mockExec, schedule(testing::NotNull(), _, startTime, Truly(ActionArgumentHasLowBitSet)));
|
||||||
// falling edge (primary) 20ms later
|
// falling edge (primary) 20ms later
|
||||||
EXPECT_CALL(mockExec, scheduleByTimestampNt(testing::NotNull(), _, startTime + MS2NT(20), Property(&action_s::getArgument, Eq(&event))));
|
EXPECT_CALL(mockExec, schedule(testing::NotNull(), _, startTime + MS2NT(20), Property(&action_s::getArgument, Eq(&event))));
|
||||||
// falling edge (secondary) 10ms later
|
// falling edge (secondary) 10ms later
|
||||||
EXPECT_CALL(mockExec, scheduleByTimestampNt(testing::NotNull(), _, startTime + MS2NT(10), Property(&action_s::getArgument, Eq(&event))));
|
EXPECT_CALL(mockExec, schedule(testing::NotNull(), _, startTime + MS2NT(10), Property(&action_s::getArgument, Eq(&event))));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Event scheduled at 125 degrees
|
// Event scheduled at 125 degrees
|
||||||
|
@ -109,7 +109,7 @@ TEST(injectionScheduling, InjectionIsScheduledBeforeWraparound) {
|
||||||
StrictMock<MockExecutor> mockExec;
|
StrictMock<MockExecutor> mockExec;
|
||||||
|
|
||||||
EngineTestHelper eth(engine_type_e::TEST_ENGINE);
|
EngineTestHelper eth(engine_type_e::TEST_ENGINE);
|
||||||
engine->executor.setMockExecutor(&mockExec);
|
engine->scheduler.setMockExecutor(&mockExec);
|
||||||
|
|
||||||
efitick_t nowNt = 1000000;
|
efitick_t nowNt = 1000000;
|
||||||
|
|
||||||
|
@ -132,9 +132,9 @@ TEST(injectionScheduling, InjectionIsScheduledBeforeWraparound) {
|
||||||
// rising edge 5 degrees from now
|
// rising edge 5 degrees from now
|
||||||
float nt5deg = USF2NT(engine->rpmCalculator.oneDegreeUs * 5);
|
float nt5deg = USF2NT(engine->rpmCalculator.oneDegreeUs * 5);
|
||||||
efitick_t startTime = nowNt + nt5deg;
|
efitick_t startTime = nowNt + nt5deg;
|
||||||
EXPECT_CALL(mockExec, scheduleByTimestampNt(testing::NotNull(), _, startTime, Not(Truly(ActionArgumentHasLowBitSet))));
|
EXPECT_CALL(mockExec, schedule(testing::NotNull(), _, startTime, Not(Truly(ActionArgumentHasLowBitSet))));
|
||||||
// falling edge 20ms later
|
// falling edge 20ms later
|
||||||
EXPECT_CALL(mockExec, scheduleByTimestampNt(testing::NotNull(), _, startTime + MS2NT(20), Property(&action_s::getArgument, Eq(&event))));
|
EXPECT_CALL(mockExec, schedule(testing::NotNull(), _, startTime + MS2NT(20), Property(&action_s::getArgument, Eq(&event))));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Event scheduled at 715 degrees
|
// Event scheduled at 715 degrees
|
||||||
|
@ -148,7 +148,7 @@ TEST(injectionScheduling, InjectionIsScheduledAfterWraparound) {
|
||||||
StrictMock<MockExecutor> mockExec;
|
StrictMock<MockExecutor> mockExec;
|
||||||
|
|
||||||
EngineTestHelper eth(engine_type_e::TEST_ENGINE);
|
EngineTestHelper eth(engine_type_e::TEST_ENGINE);
|
||||||
engine->executor.setMockExecutor(&mockExec);
|
engine->scheduler.setMockExecutor(&mockExec);
|
||||||
|
|
||||||
efitick_t nowNt = 1000000;
|
efitick_t nowNt = 1000000;
|
||||||
|
|
||||||
|
@ -171,9 +171,9 @@ TEST(injectionScheduling, InjectionIsScheduledAfterWraparound) {
|
||||||
// rising edge 15 degrees from now
|
// rising edge 15 degrees from now
|
||||||
float nt5deg = USF2NT(engine->rpmCalculator.oneDegreeUs * 15);
|
float nt5deg = USF2NT(engine->rpmCalculator.oneDegreeUs * 15);
|
||||||
efitick_t startTime = nowNt + nt5deg;
|
efitick_t startTime = nowNt + nt5deg;
|
||||||
EXPECT_CALL(mockExec, scheduleByTimestampNt(testing::NotNull(), _, startTime, Not(Truly(ActionArgumentHasLowBitSet))));
|
EXPECT_CALL(mockExec, schedule(testing::NotNull(), _, startTime, Not(Truly(ActionArgumentHasLowBitSet))));
|
||||||
// falling edge 20ms later
|
// falling edge 20ms later
|
||||||
EXPECT_CALL(mockExec, scheduleByTimestampNt(testing::NotNull(), _, startTime + MS2NT(20), Property(&action_s::getArgument, Eq(&event))));
|
EXPECT_CALL(mockExec, schedule(testing::NotNull(), _, startTime + MS2NT(20), Property(&action_s::getArgument, Eq(&event))));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Event scheduled at 5 degrees
|
// Event scheduled at 5 degrees
|
||||||
|
@ -188,7 +188,7 @@ TEST(injectionScheduling, InjectionNotScheduled) {
|
||||||
StrictMock<MockExecutor> mockExec;
|
StrictMock<MockExecutor> mockExec;
|
||||||
|
|
||||||
EngineTestHelper eth(engine_type_e::TEST_ENGINE);
|
EngineTestHelper eth(engine_type_e::TEST_ENGINE);
|
||||||
engine->executor.setMockExecutor(&mockExec);
|
engine->scheduler.setMockExecutor(&mockExec);
|
||||||
|
|
||||||
efitick_t nowNt = 1000000;
|
efitick_t nowNt = 1000000;
|
||||||
|
|
||||||
|
|
|
@ -28,8 +28,8 @@ TEST(trigger, map_cam_by_magic_point) {
|
||||||
ASSERT_EQ(0, engine->triggerCentral.triggerState.camResyncCounter);
|
ASSERT_EQ(0, engine->triggerCentral.triggerState.camResyncCounter);
|
||||||
|
|
||||||
// Nothing should have been scheduled yet
|
// Nothing should have been scheduled yet
|
||||||
ASSERT_EQ(1, engine->executor.size());
|
ASSERT_EQ(1, engine->scheduler.size());
|
||||||
scheduling_s* next = engine->executor.getForUnitTest(0);
|
scheduling_s* next = engine->scheduler.getForUnitTest(0);
|
||||||
eth.assertEvent5("spark down#0", 0, (void*)fireSparkAndPrepareNextSchedule, 188333);
|
eth.assertEvent5("spark down#0", 0, (void*)fireSparkAndPrepareNextSchedule, 188333);
|
||||||
|
|
||||||
engine->outputChannels.instantMAPValue = 120;
|
engine->outputChannels.instantMAPValue = 120;
|
||||||
|
@ -43,7 +43,7 @@ TEST(trigger, map_cam_by_magic_point) {
|
||||||
ASSERT_EQ(ClearReason::None, getLimpManager()->allowInjection().reason);
|
ASSERT_EQ(ClearReason::None, getLimpManager()->allowInjection().reason);
|
||||||
|
|
||||||
// We have "VVT" sync, things should be scheduled!
|
// We have "VVT" sync, things should be scheduled!
|
||||||
ASSERT_EQ(2, engine->executor.size());
|
ASSERT_EQ(2, engine->scheduler.size());
|
||||||
eth.assertEvent5("spark down#0", 0, (void*)turnSparkPinHighStartCharging, 185333);
|
eth.assertEvent5("spark down#0", 0, (void*)turnSparkPinHighStartCharging, 185333);
|
||||||
eth.assertEvent5("spark down#1", 1, (void*)fireSparkAndPrepareNextSchedule, 188333);
|
eth.assertEvent5("spark down#1", 1, (void*)fireSparkAndPrepareNextSchedule, 188333);
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,7 @@ static void scheduleTriggerEvents(TriggerWaveform *shape,
|
||||||
|
|
||||||
efitick_t timeNt = efitick_t{US2NT(timeScale * 1000 * angle)};
|
efitick_t timeNt = efitick_t{US2NT(timeScale * 1000 * angle)};
|
||||||
|
|
||||||
engine->executor.scheduleByTimestampNt("test", ¶m->sched, timeNt, { func, param.get() });
|
engine->scheduler.schedule("test", ¶m->sched, timeNt, { func, param.get() });
|
||||||
totalIndex++;
|
totalIndex++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -129,7 +129,7 @@ TEST(nissan, vq_vvt) {
|
||||||
scheduling_s *head;
|
scheduling_s *head;
|
||||||
|
|
||||||
int queueIndex = 0;
|
int queueIndex = 0;
|
||||||
while ((head = engine->executor.getHead()) != nullptr) {
|
while ((head = engine->scheduler.getHead()) != nullptr) {
|
||||||
// todo: what shall we change here once we migrate unit_tests to NT?
|
// todo: what shall we change here once we migrate unit_tests to NT?
|
||||||
eth.setTimeAndInvokeEventsUs(head->getMomentUs());
|
eth.setTimeAndInvokeEventsUs(head->getMomentUs());
|
||||||
|
|
||||||
|
|
|
@ -244,48 +244,48 @@ TEST(misc, testRpmCalculator) {
|
||||||
EXPECT_NEAR(ilist->elements[0].sparkAngle, 13.0f, 1e-3);
|
EXPECT_NEAR(ilist->elements[0].sparkAngle, 13.0f, 1e-3);
|
||||||
|
|
||||||
ASSERT_EQ( 0, engine->triggerCentral.triggerState.getCurrentIndex()) << "index #2";
|
ASSERT_EQ( 0, engine->triggerCentral.triggerState.getCurrentIndex()) << "index #2";
|
||||||
ASSERT_EQ( 4, engine->executor.size()) << "queue size/2";
|
ASSERT_EQ( 4, engine->scheduler.size()) << "queue size/2";
|
||||||
{
|
{
|
||||||
scheduling_s *ev0 = engine->executor.getForUnitTest(0);
|
scheduling_s *ev0 = engine->scheduler.getForUnitTest(0);
|
||||||
|
|
||||||
assertREqualsM("Call@0", (void*)ev0->action.getCallback(), (void*)turnSparkPinHighStartCharging);
|
assertREqualsM("Call@0", (void*)ev0->action.getCallback(), (void*)turnSparkPinHighStartCharging);
|
||||||
ASSERT_EQ(start + 944, ev0->getMomentUs()) << "ev 0";
|
ASSERT_EQ(start + 944, ev0->getMomentUs()) << "ev 0";
|
||||||
assertEqualsLM("coil 0", (uintptr_t)&enginePins.coils[0], (uintptr_t)((IgnitionEvent*)ev0->action.getArgument())->outputs[0]);
|
assertEqualsLM("coil 0", (uintptr_t)&enginePins.coils[0], (uintptr_t)((IgnitionEvent*)ev0->action.getArgument())->outputs[0]);
|
||||||
|
|
||||||
scheduling_s *ev1 = engine->executor.getForUnitTest(1);
|
scheduling_s *ev1 = engine->scheduler.getForUnitTest(1);
|
||||||
assertREqualsM("Call@1", (void*)ev1->action.getCallback(), (void*)fireSparkAndPrepareNextSchedule);
|
assertREqualsM("Call@1", (void*)ev1->action.getCallback(), (void*)fireSparkAndPrepareNextSchedule);
|
||||||
ASSERT_EQ(start + 944 + 1000 * FORD_INLINE_DWELL, ev1->getMomentUs()) << "ev 1";
|
ASSERT_EQ(start + 944 + 1000 * FORD_INLINE_DWELL, ev1->getMomentUs()) << "ev 1";
|
||||||
assertEqualsLM("coil 1", (uintptr_t)&enginePins.coils[0], (uintptr_t)((IgnitionEvent*)ev1->action.getArgument())->outputs[0]);
|
assertEqualsLM("coil 1", (uintptr_t)&enginePins.coils[0], (uintptr_t)((IgnitionEvent*)ev1->action.getArgument())->outputs[0]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
engine->executor.clear();
|
engine->scheduler.clear();
|
||||||
|
|
||||||
eth.fireFall(5);
|
eth.fireFall(5);
|
||||||
eth.fireRise(5);
|
eth.fireRise(5);
|
||||||
eth.fireFall(5);
|
eth.fireFall(5);
|
||||||
ASSERT_EQ( 2, engine->triggerCentral.triggerState.getCurrentIndex()) << "index #3";
|
ASSERT_EQ( 2, engine->triggerCentral.triggerState.getCurrentIndex()) << "index #3";
|
||||||
ASSERT_EQ( 4, engine->executor.size()) << "queue size 3";
|
ASSERT_EQ( 4, engine->scheduler.size()) << "queue size 3";
|
||||||
|
|
||||||
ASSERT_EQ(start + 13333 - 1515 + 2459, engine->executor.getForUnitTest(0)->getMomentUs()) << "ev 3";
|
ASSERT_EQ(start + 13333 - 1515 + 2459, engine->scheduler.getForUnitTest(0)->getMomentUs()) << "ev 3";
|
||||||
ASSERT_EQ(start + 14277 + 500, engine->executor.getForUnitTest(1)->getMomentUs()) << "ev 5";
|
ASSERT_EQ(start + 14277 + 500, engine->scheduler.getForUnitTest(1)->getMomentUs()) << "ev 5";
|
||||||
ASSERT_EQ(start + 14777 + 677, engine->executor.getForUnitTest(2)->getMomentUs()) << "3/3";
|
ASSERT_EQ(start + 14777 + 677, engine->scheduler.getForUnitTest(2)->getMomentUs()) << "3/3";
|
||||||
engine->executor.clear();
|
engine->scheduler.clear();
|
||||||
|
|
||||||
ASSERT_EQ(4, engine->triggerCentral.triggerShape.findAngleIndex(&engine->triggerCentral.triggerFormDetails, 240));
|
ASSERT_EQ(4, engine->triggerCentral.triggerShape.findAngleIndex(&engine->triggerCentral.triggerFormDetails, 240));
|
||||||
ASSERT_EQ(4, engine->triggerCentral.triggerShape.findAngleIndex(&engine->triggerCentral.triggerFormDetails, 241));
|
ASSERT_EQ(4, engine->triggerCentral.triggerShape.findAngleIndex(&engine->triggerCentral.triggerFormDetails, 241));
|
||||||
|
|
||||||
|
|
||||||
eth.fireFall(5);
|
eth.fireFall(5);
|
||||||
ASSERT_EQ( 0, engine->executor.size()) << "queue size 4.1";
|
ASSERT_EQ( 0, engine->scheduler.size()) << "queue size 4.1";
|
||||||
|
|
||||||
|
|
||||||
eth.fireRise(5);
|
eth.fireRise(5);
|
||||||
ASSERT_EQ( 4, engine->executor.size()) << "queue size 4.2";
|
ASSERT_EQ( 4, engine->scheduler.size()) << "queue size 4.2";
|
||||||
|
|
||||||
|
|
||||||
eth.fireRise(5);
|
eth.fireRise(5);
|
||||||
ASSERT_EQ( 4, engine->executor.size()) << "queue size 4.3";
|
ASSERT_EQ( 4, engine->scheduler.size()) << "queue size 4.3";
|
||||||
|
|
||||||
assertEqualsM("dwell", eth.timeToAngle(FORD_INLINE_DWELL), engine->ignitionState.dwellDurationAngle);
|
assertEqualsM("dwell", eth.timeToAngle(FORD_INLINE_DWELL), engine->ignitionState.dwellDurationAngle);
|
||||||
assertEqualsM("fuel #3", 4.5450, engine->engineState.injectionDuration);
|
assertEqualsM("fuel #3", 4.5450, engine->engineState.injectionDuration);
|
||||||
|
@ -293,32 +293,32 @@ TEST(misc, testRpmCalculator) {
|
||||||
|
|
||||||
|
|
||||||
ASSERT_EQ( 6, engine->triggerCentral.triggerState.getCurrentIndex()) << "index #4";
|
ASSERT_EQ( 6, engine->triggerCentral.triggerState.getCurrentIndex()) << "index #4";
|
||||||
ASSERT_EQ( 4, engine->executor.size()) << "queue size 4";
|
ASSERT_EQ( 4, engine->scheduler.size()) << "queue size 4";
|
||||||
engine->executor.clear();
|
engine->scheduler.clear();
|
||||||
|
|
||||||
eth.fireFall(5);
|
eth.fireFall(5);
|
||||||
ASSERT_EQ( 0, engine->executor.size()) << "queue size 5";
|
ASSERT_EQ( 0, engine->scheduler.size()) << "queue size 5";
|
||||||
// todo: assert queue elements
|
// todo: assert queue elements
|
||||||
engine->executor.clear();
|
engine->scheduler.clear();
|
||||||
|
|
||||||
|
|
||||||
eth.fireRise(5);
|
eth.fireRise(5);
|
||||||
ASSERT_EQ( 4, engine->executor.size()) << "queue size 6";
|
ASSERT_EQ( 4, engine->scheduler.size()) << "queue size 6";
|
||||||
ASSERT_EQ(start + 40944, engine->executor.getForUnitTest(0)->getMomentUs()) << "6/0";
|
ASSERT_EQ(start + 40944, engine->scheduler.getForUnitTest(0)->getMomentUs()) << "6/0";
|
||||||
ASSERT_EQ(start + 41444, engine->executor.getForUnitTest(1)->getMomentUs()) << "6/1";
|
ASSERT_EQ(start + 41444, engine->scheduler.getForUnitTest(1)->getMomentUs()) << "6/1";
|
||||||
engine->executor.clear();
|
engine->scheduler.clear();
|
||||||
|
|
||||||
eth.fireFall(5);
|
eth.fireFall(5);
|
||||||
ASSERT_EQ( 0, engine->executor.size()) << "queue size 7";
|
ASSERT_EQ( 0, engine->scheduler.size()) << "queue size 7";
|
||||||
engine->executor.clear();
|
engine->scheduler.clear();
|
||||||
|
|
||||||
eth.fireRise(5 /*ms*/);
|
eth.fireRise(5 /*ms*/);
|
||||||
eth.fireFall(5);
|
eth.fireFall(5);
|
||||||
|
|
||||||
ASSERT_EQ( 4, engine->executor.size()) << "queue size 8";
|
ASSERT_EQ( 4, engine->scheduler.size()) << "queue size 8";
|
||||||
ASSERT_EQ(start + 53333 - 1515 + 2459, engine->executor.getForUnitTest(0)->getMomentUs()) << "8/0";
|
ASSERT_EQ(start + 53333 - 1515 + 2459, engine->scheduler.getForUnitTest(0)->getMomentUs()) << "8/0";
|
||||||
ASSERT_EQ(start + 54277 + 2459 - 1959, engine->executor.getForUnitTest(1)->getMomentUs()) << "8/1";
|
ASSERT_EQ(start + 54277 + 2459 - 1959, engine->scheduler.getForUnitTest(1)->getMomentUs()) << "8/1";
|
||||||
engine->executor.clear();
|
engine->scheduler.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(trigger, testAnotherTriggerDecoder) {
|
TEST(trigger, testAnotherTriggerDecoder) {
|
||||||
|
@ -427,7 +427,7 @@ static void setTestBug299(EngineTestHelper *eth) {
|
||||||
// time...|0.......|10......|20......|30......|40
|
// time...|0.......|10......|20......|30......|40
|
||||||
// inj #0 |.......#|........|.......#|........|
|
// inj #0 |.......#|........|.......#|........|
|
||||||
// inj #1 |........|.......#|........|.......#|
|
// inj #1 |........|.......#|........|.......#|
|
||||||
ASSERT_EQ( 4, engine->executor.size()) << "qs#00";
|
ASSERT_EQ( 4, engine->scheduler.size()) << "qs#00";
|
||||||
ASSERT_EQ( 3, getRevolutionCounter()) << "rev cnt#3";
|
ASSERT_EQ( 3, getRevolutionCounter()) << "rev cnt#3";
|
||||||
eth->assertInjectorUpEvent("setTestBug299: 1@0", 0, MS2US(8.5), 2);
|
eth->assertInjectorUpEvent("setTestBug299: 1@0", 0, MS2US(8.5), 2);
|
||||||
eth->assertInjectorDownEvent("@1", 1, MS2US(10), 2);
|
eth->assertInjectorDownEvent("@1", 1, MS2US(10), 2);
|
||||||
|
@ -450,7 +450,7 @@ static void setTestBug299(EngineTestHelper *eth) {
|
||||||
// time...|-20.....|-10.....|0.......|10......|20
|
// time...|-20.....|-10.....|0.......|10......|20
|
||||||
// inj #0 |.......#|........|.......#|........|
|
// inj #0 |.......#|........|.......#|........|
|
||||||
// inj #1 |........|.......#|........|.......#|
|
// inj #1 |........|.......#|........|.......#|
|
||||||
ASSERT_EQ( 8, engine->executor.size()) << "qs#0";
|
ASSERT_EQ( 8, engine->scheduler.size()) << "qs#0";
|
||||||
ASSERT_EQ( 3, getRevolutionCounter()) << "rev cnt#3";
|
ASSERT_EQ( 3, getRevolutionCounter()) << "rev cnt#3";
|
||||||
eth->assertInjectorUpEvent("02@0", 0, MS2US(-11.5), 2);
|
eth->assertInjectorUpEvent("02@0", 0, MS2US(-11.5), 2);
|
||||||
eth->assertInjectorDownEvent("@1", 1, MS2US(-10), 2);
|
eth->assertInjectorDownEvent("@1", 1, MS2US(-10), 2);
|
||||||
|
@ -474,7 +474,7 @@ static void setTestBug299(EngineTestHelper *eth) {
|
||||||
ASSERT_EQ( 4, eth->executeActions()) << "exec#20";
|
ASSERT_EQ( 4, eth->executeActions()) << "exec#20";
|
||||||
|
|
||||||
eth->firePrimaryTriggerRise();
|
eth->firePrimaryTriggerRise();
|
||||||
ASSERT_EQ( 4, engine->executor.size()) << "qs#0-2";
|
ASSERT_EQ( 4, engine->scheduler.size()) << "qs#0-2";
|
||||||
// fuel schedule - short pulses. and more realistic schedule this time
|
// fuel schedule - short pulses. and more realistic schedule this time
|
||||||
// time...|-20.....|-10.....|0.......|10......|20
|
// time...|-20.....|-10.....|0.......|10......|20
|
||||||
// inj #0 |.......#|........|.......#|........|
|
// inj #0 |.......#|........|.......#|........|
|
||||||
|
@ -493,7 +493,7 @@ static void setTestBug299(EngineTestHelper *eth) {
|
||||||
// time...|-20.....|-10.....|0.......|10......|20
|
// time...|-20.....|-10.....|0.......|10......|20
|
||||||
// inj #0 |.......#|........|........|........|
|
// inj #0 |.......#|........|........|........|
|
||||||
// inj #1 |........|.......#|........|........|
|
// inj #1 |........|.......#|........|........|
|
||||||
ASSERT_EQ( 4, engine->executor.size()) << "qs#0-2";
|
ASSERT_EQ( 4, engine->scheduler.size()) << "qs#0-2";
|
||||||
ASSERT_EQ( 4, getRevolutionCounter()) << "rev cnt#4";
|
ASSERT_EQ( 4, getRevolutionCounter()) << "rev cnt#4";
|
||||||
eth->assertInjectorUpEvent("0@0", 0, MS2US(8.5), 0);
|
eth->assertInjectorUpEvent("0@0", 0, MS2US(8.5), 0);
|
||||||
eth->assertInjectorDownEvent("0@1", 1, MS2US(10), 0);
|
eth->assertInjectorDownEvent("0@1", 1, MS2US(10), 0);
|
||||||
|
@ -550,10 +550,10 @@ void doTestFuelSchedulerBug299smallAndMedium(int startUpDelayMs) {
|
||||||
|
|
||||||
assertEqualsM("duty for maf=3", 62.5, getInjectorDutyCycle(round(Sensor::getOrZero(SensorType::Rpm))));
|
assertEqualsM("duty for maf=3", 62.5, getInjectorDutyCycle(round(Sensor::getOrZero(SensorType::Rpm))));
|
||||||
|
|
||||||
ASSERT_EQ( 4, engine->executor.size()) << "qs#1";
|
ASSERT_EQ( 4, engine->scheduler.size()) << "qs#1";
|
||||||
eth.moveTimeForwardUs(MS2US(20));
|
eth.moveTimeForwardUs(MS2US(20));
|
||||||
ASSERT_EQ( 4, eth.executeActions()) << "exec#2#0";
|
ASSERT_EQ( 4, eth.executeActions()) << "exec#2#0";
|
||||||
ASSERT_EQ( 0, engine->executor.size()) << "qs#1#2";
|
ASSERT_EQ( 0, engine->scheduler.size()) << "qs#1#2";
|
||||||
|
|
||||||
|
|
||||||
ASSERT_EQ( 4, getRevolutionCounter()) << "rev cnt#4#0";
|
ASSERT_EQ( 4, getRevolutionCounter()) << "rev cnt#4#0";
|
||||||
|
@ -562,7 +562,7 @@ void doTestFuelSchedulerBug299smallAndMedium(int startUpDelayMs) {
|
||||||
// time...|0.......|10......|20......|30......|40......|50......|60......|
|
// time...|0.......|10......|20......|30......|40......|50......|60......|
|
||||||
// inj #0 |########|##...###|########|.....###|########|........|........|
|
// inj #0 |########|##...###|########|.....###|########|........|........|
|
||||||
// inj #1 |.....###|########|....####|########|........|........|........|
|
// inj #1 |.....###|########|....####|########|........|........|........|
|
||||||
ASSERT_EQ( 6, engine->executor.size()) << "qs#4";
|
ASSERT_EQ( 6, engine->scheduler.size()) << "qs#4";
|
||||||
//todo assertInjectorUpEvent("04@0", 0, MS2US(0), 0);
|
//todo assertInjectorUpEvent("04@0", 0, MS2US(0), 0);
|
||||||
// assertInjectorUpEvent("04@1", 1, MS2US(7.5), 1);
|
// assertInjectorUpEvent("04@1", 1, MS2US(7.5), 1);
|
||||||
// assertInjectorDownEvent("04@2", 2, MS2US(12.5), 0);
|
// assertInjectorDownEvent("04@2", 2, MS2US(12.5), 0);
|
||||||
|
@ -575,7 +575,7 @@ void doTestFuelSchedulerBug299smallAndMedium(int startUpDelayMs) {
|
||||||
// assertInjectorDownEvent("04@9", 9, MS2US(50.0), 0);
|
// assertInjectorDownEvent("04@9", 9, MS2US(50.0), 0);
|
||||||
|
|
||||||
// {
|
// {
|
||||||
// scheduling_s *ev = engine->executor.getForUnitTest(9);
|
// scheduling_s *ev = engine->scheduler.getForUnitTest(9);
|
||||||
// ASSERT_EQ( 5, getRevolutionCounter()) << "rev cnt#4#2";
|
// ASSERT_EQ( 5, getRevolutionCounter()) << "rev cnt#4#2";
|
||||||
// ASSERT_TRUE(ev == &engineConfiguration->fuelActuators[2].signalPair[1].signalTimerDown) << "down 50";
|
// ASSERT_TRUE(ev == &engineConfiguration->fuelActuators[2].signalPair[1].signalTimerDown) << "down 50";
|
||||||
// }
|
// }
|
||||||
|
@ -585,7 +585,7 @@ void doTestFuelSchedulerBug299smallAndMedium(int startUpDelayMs) {
|
||||||
|
|
||||||
|
|
||||||
eth.fireFall(20);
|
eth.fireFall(20);
|
||||||
ASSERT_EQ( 8, engine->executor.size()) << "qs#2#1";
|
ASSERT_EQ( 8, engine->scheduler.size()) << "qs#2#1";
|
||||||
ASSERT_EQ( 5, getRevolutionCounter()) << "rev cnt#5";
|
ASSERT_EQ( 5, getRevolutionCounter()) << "rev cnt#5";
|
||||||
// using old fuel schedule - but already wider pulses
|
// using old fuel schedule - but already wider pulses
|
||||||
// time...|-20.....|-10.....|0.......|10......|20......|30......|40......|
|
// time...|-20.....|-10.....|0.......|10......|20......|30......|40......|
|
||||||
|
@ -615,7 +615,7 @@ void doTestFuelSchedulerBug299smallAndMedium(int startUpDelayMs) {
|
||||||
assertInjectionEventBatch("inj#3", &t->elements[3], 1, 2, 0, 333);
|
assertInjectionEventBatch("inj#3", &t->elements[3], 1, 2, 0, 333);
|
||||||
|
|
||||||
eth.moveTimeForwardUs(MS2US(20));
|
eth.moveTimeForwardUs(MS2US(20));
|
||||||
ASSERT_EQ( 5, engine->executor.size()) << "qs#02";
|
ASSERT_EQ( 5, engine->scheduler.size()) << "qs#02";
|
||||||
// assertInjectorUpEvent("6@0", 0, MS2US(-12.5), 1);
|
// assertInjectorUpEvent("6@0", 0, MS2US(-12.5), 1);
|
||||||
// assertInjectorDownEvent("6@1", 1, MS2US(-10.0), 0);
|
// assertInjectorDownEvent("6@1", 1, MS2US(-10.0), 0);
|
||||||
// assertInjectorUpEvent("6@2", 2, MS2US(-2.5), 0);
|
// assertInjectorUpEvent("6@2", 2, MS2US(-2.5), 0);
|
||||||
|
@ -624,11 +624,11 @@ void doTestFuelSchedulerBug299smallAndMedium(int startUpDelayMs) {
|
||||||
|
|
||||||
// so placing this 'executeAll' changes much?
|
// so placing this 'executeAll' changes much?
|
||||||
ASSERT_EQ( 5, eth.executeActions()) << "exec#07";
|
ASSERT_EQ( 5, eth.executeActions()) << "exec#07";
|
||||||
ASSERT_EQ( 0, engine->executor.size()) << "qs#07";
|
ASSERT_EQ( 0, engine->scheduler.size()) << "qs#07";
|
||||||
// assertInjectorDownEvent("26@0", 0, MS2US(10.0), 0);
|
// assertInjectorDownEvent("26@0", 0, MS2US(10.0), 0);
|
||||||
|
|
||||||
eth.firePrimaryTriggerRise();
|
eth.firePrimaryTriggerRise();
|
||||||
ASSERT_EQ( 4, engine->executor.size()) << "qs#2#2";
|
ASSERT_EQ( 4, engine->scheduler.size()) << "qs#2#2";
|
||||||
ASSERT_EQ( 6, getRevolutionCounter()) << "rev cnt6";
|
ASSERT_EQ( 6, getRevolutionCounter()) << "rev cnt6";
|
||||||
// time...|-20.....|-10.....|0.......|10......|20......|30......|40......|
|
// time...|-20.....|-10.....|0.......|10......|20......|30......|40......|
|
||||||
// inj #0 |########|.....###|########|....####|........|........|........|
|
// inj #0 |########|.....###|########|....####|........|........|........|
|
||||||
|
@ -646,7 +646,7 @@ void doTestFuelSchedulerBug299smallAndMedium(int startUpDelayMs) {
|
||||||
// time...|-20.....|-10.....|0.......|10......|20......|30......|40......|
|
// time...|-20.....|-10.....|0.......|10......|20......|30......|40......|
|
||||||
// inj #0 |########|.......#|........|........|........|........|........|
|
// inj #0 |########|.......#|........|........|........|........|........|
|
||||||
// inj #1 |....####|########|........|........|........|........|........|
|
// inj #1 |....####|########|........|........|........|........|........|
|
||||||
ASSERT_EQ( 4, engine->executor.size()) << "qs#022";
|
ASSERT_EQ( 4, engine->scheduler.size()) << "qs#022";
|
||||||
// assertInjectorUpEvent("7@0", 0, MS2US(-12.5), 1);
|
// assertInjectorUpEvent("7@0", 0, MS2US(-12.5), 1);
|
||||||
// assertInjectorDownEvent("7@1", 1, MS2US(-10.0), 0);
|
// assertInjectorDownEvent("7@1", 1, MS2US(-10.0), 0);
|
||||||
// assertInjectorUpEvent("7@2", 2, MS2US(-2.5), 0);
|
// assertInjectorUpEvent("7@2", 2, MS2US(-2.5), 0);
|
||||||
|
@ -659,7 +659,7 @@ void doTestFuelSchedulerBug299smallAndMedium(int startUpDelayMs) {
|
||||||
|
|
||||||
ASSERT_EQ( 3, eth.executeActions()) << "executed #06";
|
ASSERT_EQ( 3, eth.executeActions()) << "executed #06";
|
||||||
assertInjectors("#4", 1, 0);
|
assertInjectors("#4", 1, 0);
|
||||||
ASSERT_EQ( 1, engine->executor.size()) << "qs#06";
|
ASSERT_EQ( 1, engine->scheduler.size()) << "qs#06";
|
||||||
eth.assertInjectorDownEvent("17@0", 0, MS2US(10), 0);
|
eth.assertInjectorDownEvent("17@0", 0, MS2US(10), 0);
|
||||||
// assertInjectorDownEvent("17@1", 1, MS2US(10.0), 0);
|
// assertInjectorDownEvent("17@1", 1, MS2US(10.0), 0);
|
||||||
// assertInjectorUpEvent("17@2", 2, MS2US(17.5), 0);
|
// assertInjectorUpEvent("17@2", 2, MS2US(17.5), 0);
|
||||||
|
@ -668,18 +668,18 @@ void doTestFuelSchedulerBug299smallAndMedium(int startUpDelayMs) {
|
||||||
|
|
||||||
eth.firePrimaryTriggerFall();
|
eth.firePrimaryTriggerFall();
|
||||||
|
|
||||||
ASSERT_EQ( 5, engine->executor.size()) << "qs#3";
|
ASSERT_EQ( 5, engine->scheduler.size()) << "qs#3";
|
||||||
ASSERT_EQ( 6, getRevolutionCounter()) << "rev cnt6";
|
ASSERT_EQ( 6, getRevolutionCounter()) << "rev cnt6";
|
||||||
ASSERT_EQ( 0, eth.executeActions()) << "executed #6";
|
ASSERT_EQ( 0, eth.executeActions()) << "executed #6";
|
||||||
|
|
||||||
|
|
||||||
eth.moveTimeForwardUs(MS2US(20));
|
eth.moveTimeForwardUs(MS2US(20));
|
||||||
ASSERT_EQ( 4, eth.executeActions()) << "executed #06";
|
ASSERT_EQ( 4, eth.executeActions()) << "executed #06";
|
||||||
ASSERT_EQ( 1, engine->executor.size()) << "qs#06";
|
ASSERT_EQ( 1, engine->scheduler.size()) << "qs#06";
|
||||||
assertInjectors("inj#2", 1, 0);
|
assertInjectors("inj#2", 1, 0);
|
||||||
|
|
||||||
eth.firePrimaryTriggerRise();
|
eth.firePrimaryTriggerRise();
|
||||||
ASSERT_EQ( 5, engine->executor.size()) << "Queue.size#03";
|
ASSERT_EQ( 5, engine->scheduler.size()) << "Queue.size#03";
|
||||||
|
|
||||||
eth.assertInjectorUpEvent("07@0", 0, MS2US(7.5), 3);
|
eth.assertInjectorUpEvent("07@0", 0, MS2US(7.5), 3);
|
||||||
eth.assertInjectorDownEvent("07@1", 1, MS2US(10), 2);
|
eth.assertInjectorDownEvent("07@1", 1, MS2US(10), 2);
|
||||||
|
@ -717,7 +717,7 @@ void doTestFuelSchedulerBug299smallAndMedium(int startUpDelayMs) {
|
||||||
|
|
||||||
ASSERT_EQ( 1, enginePins.injectors[0].currentLogicValue) << "inj#0";
|
ASSERT_EQ( 1, enginePins.injectors[0].currentLogicValue) << "inj#0";
|
||||||
|
|
||||||
ASSERT_EQ( 1, engine->executor.size()) << "Queue.size#04";
|
ASSERT_EQ( 1, engine->scheduler.size()) << "Queue.size#04";
|
||||||
eth.assertInjectorDownEvent("08@0", 0, MS2US(10), 0);
|
eth.assertInjectorDownEvent("08@0", 0, MS2US(10), 0);
|
||||||
// assertInjectorDownEvent("08@1", 1, MS2US(10), 0);
|
// assertInjectorDownEvent("08@1", 1, MS2US(10), 0);
|
||||||
// assertInjectorUpEvent("08@2", 2, MS2US(17.5), 0);
|
// assertInjectorUpEvent("08@2", 2, MS2US(17.5), 0);
|
||||||
|
@ -729,7 +729,7 @@ void doTestFuelSchedulerBug299smallAndMedium(int startUpDelayMs) {
|
||||||
|
|
||||||
eth.executeActions();
|
eth.executeActions();
|
||||||
eth.fireRise(20);
|
eth.fireRise(20);
|
||||||
ASSERT_EQ(9, engine->executor.size()) << "Queue.size#05";
|
ASSERT_EQ(9, engine->scheduler.size()) << "Queue.size#05";
|
||||||
eth.executeActions();
|
eth.executeActions();
|
||||||
|
|
||||||
|
|
||||||
|
@ -748,7 +748,7 @@ void doTestFuelSchedulerBug299smallAndMedium(int startUpDelayMs) {
|
||||||
assertInjectionEventBatch("#30", &t->elements[3], 1, 2, 0, 45);
|
assertInjectionEventBatch("#30", &t->elements[3], 1, 2, 0, 45);
|
||||||
|
|
||||||
// todo: what's what? a mix of new something and old something?
|
// todo: what's what? a mix of new something and old something?
|
||||||
ASSERT_EQ(6, engine->executor.size()) << "qs#5";
|
ASSERT_EQ(6, engine->scheduler.size()) << "qs#5";
|
||||||
// assertInjectorDownEvent("8@0", 0, MS2US(5.0), 1);
|
// assertInjectorDownEvent("8@0", 0, MS2US(5.0), 1);
|
||||||
// assertInjectorUpEvent("8@1", 1, MS2US(7.5), 1);
|
// assertInjectorUpEvent("8@1", 1, MS2US(7.5), 1);
|
||||||
// assertInjectorDownEvent("8@2", 2, MS2US(15.0), 0);
|
// assertInjectorDownEvent("8@2", 2, MS2US(15.0), 0);
|
||||||
|
@ -894,7 +894,7 @@ TEST(big, testFuelSchedulerBug299smallAndLarge) {
|
||||||
engineConfiguration->isFasterEngineSpinUpEnabled = false;
|
engineConfiguration->isFasterEngineSpinUpEnabled = false;
|
||||||
engine->tdcMarkEnabled = false;
|
engine->tdcMarkEnabled = false;
|
||||||
setTestBug299(ð);
|
setTestBug299(ð);
|
||||||
ASSERT_EQ( 4, engine->executor.size()) << "Lqs#0";
|
ASSERT_EQ( 4, engine->scheduler.size()) << "Lqs#0";
|
||||||
|
|
||||||
engine->periodicFastCallback();
|
engine->periodicFastCallback();
|
||||||
|
|
||||||
|
@ -907,7 +907,7 @@ TEST(big, testFuelSchedulerBug299smallAndLarge) {
|
||||||
assertEqualsM("Lduty for maf=3", 87.5, getInjectorDutyCycle(round(Sensor::getOrZero(SensorType::Rpm))));
|
assertEqualsM("Lduty for maf=3", 87.5, getInjectorDutyCycle(round(Sensor::getOrZero(SensorType::Rpm))));
|
||||||
|
|
||||||
|
|
||||||
ASSERT_EQ( 4, engine->executor.size()) << "Lqs#1";
|
ASSERT_EQ( 4, engine->scheduler.size()) << "Lqs#1";
|
||||||
eth.moveTimeForwardUs(MS2US(20));
|
eth.moveTimeForwardUs(MS2US(20));
|
||||||
eth.executeActions();
|
eth.executeActions();
|
||||||
|
|
||||||
|
@ -919,7 +919,7 @@ TEST(big, testFuelSchedulerBug299smallAndLarge) {
|
||||||
// time...|0.......|10......|20......|30......|40......|50......|60......|
|
// time...|0.......|10......|20......|30......|40......|50......|60......|
|
||||||
// inj #0 |########|########|########|.....###|########|........|........|
|
// inj #0 |########|########|########|.....###|########|........|........|
|
||||||
// inj #1 |..######|########|....####|########|........|........|........|
|
// inj #1 |..######|########|....####|########|........|........|........|
|
||||||
ASSERT_EQ( 6, engine->executor.size()) << "Lqs#4";
|
ASSERT_EQ( 6, engine->scheduler.size()) << "Lqs#4";
|
||||||
eth.assertInjectorUpEvent("L04@0", 0, MS2US(8.5), 2);
|
eth.assertInjectorUpEvent("L04@0", 0, MS2US(8.5), 2);
|
||||||
eth.assertInjectorUpEvent("L04@1", 1, MS2US(12.5), 0);
|
eth.assertInjectorUpEvent("L04@1", 1, MS2US(12.5), 0);
|
||||||
// special overlapping injection is merged with one of the scheduled injections
|
// special overlapping injection is merged with one of the scheduled injections
|
||||||
|
@ -934,18 +934,18 @@ TEST(big, testFuelSchedulerBug299smallAndLarge) {
|
||||||
// assertInjectorDownEvent("L04@8", 8, MS2US(50.0), 0);
|
// assertInjectorDownEvent("L04@8", 8, MS2US(50.0), 0);
|
||||||
|
|
||||||
|
|
||||||
engine->executor.executeAll(getTimeNowUs() + 1);
|
engine->scheduler.executeAll(getTimeNowUs() + 1);
|
||||||
// injector goes high...
|
// injector goes high...
|
||||||
ASSERT_FALSE(enginePins.injectors[0].currentLogicValue) << "injector@1";
|
ASSERT_FALSE(enginePins.injectors[0].currentLogicValue) << "injector@1";
|
||||||
|
|
||||||
engine->executor.executeAll(getTimeNowUs() + MS2US(17.5) + 1);
|
engine->scheduler.executeAll(getTimeNowUs() + MS2US(17.5) + 1);
|
||||||
// injector does not go low too soon, that's a feature :)
|
// injector does not go low too soon, that's a feature :)
|
||||||
ASSERT_TRUE(enginePins.injectors[0].currentLogicValue) << "injector@2";
|
ASSERT_TRUE(enginePins.injectors[0].currentLogicValue) << "injector@2";
|
||||||
|
|
||||||
|
|
||||||
eth.fireFall(20);
|
eth.fireFall(20);
|
||||||
|
|
||||||
ASSERT_EQ( 6, engine->executor.size()) << "Lqs#04";
|
ASSERT_EQ( 6, engine->scheduler.size()) << "Lqs#04";
|
||||||
eth.assertInjectorUpEvent("L015@0", 0, MS2US(-1.5), 3);
|
eth.assertInjectorUpEvent("L015@0", 0, MS2US(-1.5), 3);
|
||||||
eth.assertInjectorUpEvent("L015@1", 1, MS2US(2.5), 1);
|
eth.assertInjectorUpEvent("L015@1", 1, MS2US(2.5), 1);
|
||||||
eth.assertInjectorDownEvent("L015@2", 2, MS2US(6), 2);
|
eth.assertInjectorDownEvent("L015@2", 2, MS2US(6), 2);
|
||||||
|
@ -954,14 +954,14 @@ TEST(big, testFuelSchedulerBug299smallAndLarge) {
|
||||||
//todo assertInjectorDownEvent("L015@5", 5, MS2US(30), 0);
|
//todo assertInjectorDownEvent("L015@5", 5, MS2US(30), 0);
|
||||||
|
|
||||||
|
|
||||||
engine->executor.executeAll(getTimeNowUs() + MS2US(10) + 1);
|
engine->scheduler.executeAll(getTimeNowUs() + MS2US(10) + 1);
|
||||||
// end of combined injection
|
// end of combined injection
|
||||||
ASSERT_FALSE(enginePins.injectors[0].currentLogicValue) << "injector@3";
|
ASSERT_FALSE(enginePins.injectors[0].currentLogicValue) << "injector@3";
|
||||||
|
|
||||||
|
|
||||||
eth.moveTimeForwardUs(MS2US(20));
|
eth.moveTimeForwardUs(MS2US(20));
|
||||||
eth.executeActions();
|
eth.executeActions();
|
||||||
ASSERT_EQ( 0, engine->executor.size()) << "Lqs#04";
|
ASSERT_EQ( 0, engine->scheduler.size()) << "Lqs#04";
|
||||||
|
|
||||||
engine->periodicFastCallback();
|
engine->periodicFastCallback();
|
||||||
|
|
||||||
|
@ -976,7 +976,7 @@ TEST(big, testFuelSchedulerBug299smallAndLarge) {
|
||||||
|
|
||||||
eth.firePrimaryTriggerRise();
|
eth.firePrimaryTriggerRise();
|
||||||
|
|
||||||
//todoASSERT_EQ( 5, engine->executor.size()) << "Lqs#05";
|
//todoASSERT_EQ( 5, engine->scheduler.size()) << "Lqs#05";
|
||||||
//todo assertInjectorUpEvent("L016@0", 0, MS2US(8), 0);
|
//todo assertInjectorUpEvent("L016@0", 0, MS2US(8), 0);
|
||||||
//todo assertInjectorDownEvent("L016@1", 1, MS2US(10), 0);
|
//todo assertInjectorDownEvent("L016@1", 1, MS2US(10), 0);
|
||||||
//todo assertInjectorDownEvent("L016@2", 2, MS2US(10), 0);
|
//todo assertInjectorDownEvent("L016@2", 2, MS2US(10), 0);
|
||||||
|
@ -991,7 +991,7 @@ TEST(big, testFuelSchedulerBug299smallAndLarge) {
|
||||||
eth.executeActions();
|
eth.executeActions();
|
||||||
eth.firePrimaryTriggerRise();
|
eth.firePrimaryTriggerRise();
|
||||||
|
|
||||||
ASSERT_EQ( 4, engine->executor.size()) << "Lqs#5";
|
ASSERT_EQ( 4, engine->scheduler.size()) << "Lqs#5";
|
||||||
eth.assertInjectorUpEvent("L05@0", 0, MS2US(8), 2);
|
eth.assertInjectorUpEvent("L05@0", 0, MS2US(8), 2);
|
||||||
eth.assertInjectorDownEvent("L05@1", 1, MS2US(10), 2);
|
eth.assertInjectorDownEvent("L05@1", 1, MS2US(10), 2);
|
||||||
eth.assertInjectorUpEvent("L05@2", 2, MS2US(18), 3);
|
eth.assertInjectorUpEvent("L05@2", 2, MS2US(18), 3);
|
||||||
|
@ -1038,7 +1038,7 @@ TEST(big, testSparkReverseOrderBug319) {
|
||||||
ASSERT_EQ( 3000, round(Sensor::getOrZero(SensorType::Rpm))) << "testSparkReverseOrderBug319: RPM";
|
ASSERT_EQ( 3000, round(Sensor::getOrZero(SensorType::Rpm))) << "testSparkReverseOrderBug319: RPM";
|
||||||
|
|
||||||
|
|
||||||
ASSERT_EQ( 8, engine->executor.size()) << "testSparkReverseOrderBug319: queue size";
|
ASSERT_EQ( 8, engine->scheduler.size()) << "testSparkReverseOrderBug319: queue size";
|
||||||
eth.executeActions();
|
eth.executeActions();
|
||||||
printf("***************************************************\r\n");
|
printf("***************************************************\r\n");
|
||||||
ASSERT_EQ( 0, engine->engineState.sparkOutOfOrderCounter) << "out-of-order #1";
|
ASSERT_EQ( 0, engine->engineState.sparkOutOfOrderCounter) << "out-of-order #1";
|
||||||
|
|
Loading…
Reference in New Issue