tear down Engine god object #4511

just trying different things
This commit is contained in:
Andrey 2022-09-07 20:25:49 -04:00
parent ae93591755
commit 52869d63bb
4 changed files with 11 additions and 3 deletions

View File

@ -649,3 +649,6 @@ TunerStudioOutputChannels *getTunerStudioOutputChannels() {
return &engine->outputChannels;
}
ExecutorInterface *getExecutorInterface() {
return &engine->executor;
}

View File

@ -382,7 +382,7 @@ void PrimeController::onIgnitionStateChanged(bool ignitionOn) {
auto primeDelayMs = engineConfiguration->primingDelay * 1000;
auto startTime = getTimeNowNt() + MS2NT(primeDelayMs);
engine->executor.scheduleByTimestampNt("prime", &m_start, startTime, { PrimeController::onPrimeStartAdapter, this});
getExecutorInterface()->scheduleByTimestampNt("prime", &m_start, startTime, { PrimeController::onPrimeStartAdapter, this});
} else {
efiPrintf("Skipped priming pulse since ignSwitchCounter = %d", ignSwitchCounter);
}
@ -408,7 +408,7 @@ void PrimeController::onPrimeStart() {
// Open all injectors, schedule closing later
m_isPriming = true;
startSimultaneousInjection();
engine->executor.scheduleByTimestampNt("prime", &m_end, endTime, { onPrimeEndAdapter, this });
getExecutorInterface()->scheduleByTimestampNt("prime", &m_end, endTime, { onPrimeEndAdapter, this });
}
@ -417,7 +417,7 @@ void updatePrimeInjectionPulseState() {
if (counterWasReset)
return;
if (!engine->rpmCalculator.isStopped()) {
if (!getEngineRotationState()->isStopped()) {
#if EFI_PROD_CODE
backupRamSave(BACKUP_IGNITION_SWITCH_COUNTER, 0);
#endif /* EFI_PROD_CODE */

View File

@ -67,3 +67,6 @@ struct ExecutorInterface {
virtual void scheduleForLater(const char *msg, scheduling_s *scheduling, int delayUs, action_s action) = 0;
virtual void cancel(scheduling_s* scheduling) = 0;
};
ExecutorInterface *getExecutorInterface();

View File

@ -16,3 +16,5 @@ public:
void scheduleForLater(const char *msg, scheduling_s *scheduling, int delayUs, action_s action) override;
void cancel(scheduling_s* s) override;
};
ExecutorInterface *getExecutorInterface();