deep rabbit holes are the best ones!
refactoring: encapsulation
This commit is contained in:
parent
1d0f13fc41
commit
d9accf1772
|
@ -314,10 +314,6 @@ void Engine::updateSwitchInputs() {
|
||||||
#endif // EFI_GPIO_HARDWARE
|
#endif // EFI_GPIO_HARDWARE
|
||||||
}
|
}
|
||||||
|
|
||||||
void Engine::onTriggerSignalEvent() {
|
|
||||||
isSpinning = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
Engine::Engine() {
|
Engine::Engine() {
|
||||||
reset();
|
reset();
|
||||||
}
|
}
|
||||||
|
@ -446,7 +442,7 @@ void Engine::efiWatchdog() {
|
||||||
}
|
}
|
||||||
mostRecentMs = msNow;
|
mostRecentMs = msNow;
|
||||||
|
|
||||||
if (!isSpinning) {
|
if (!getTriggerCentral()->isSpinningJustForWatchdog) {
|
||||||
if (!isRunningBenchTest() && enginePins.stopPins()) {
|
if (!isRunningBenchTest() && enginePins.stopPins()) {
|
||||||
// todo: make this a firmwareError assuming functional tests would run
|
// todo: make this a firmwareError assuming functional tests would run
|
||||||
warning(CUSTOM_ERR_2ND_WATCHDOG, "Some pins were turned off by 2nd pass watchdog");
|
warning(CUSTOM_ERR_2ND_WATCHDOG, "Some pins were turned off by 2nd pass watchdog");
|
||||||
|
@ -462,7 +458,7 @@ void Engine::efiWatchdog() {
|
||||||
// Engine moved recently, no need to safe pins.
|
// Engine moved recently, no need to safe pins.
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
isSpinning = false;
|
getTriggerCentral()->isSpinningJustForWatchdog = false;
|
||||||
ignitionEvents.isReady = false;
|
ignitionEvents.isReady = false;
|
||||||
#if EFI_PROD_CODE || EFI_SIMULATOR
|
#if EFI_PROD_CODE || EFI_SIMULATOR
|
||||||
efiPrintf("engine has STOPPED");
|
efiPrintf("engine has STOPPED");
|
||||||
|
|
|
@ -284,10 +284,6 @@ public:
|
||||||
*/
|
*/
|
||||||
int ignitionPin[MAX_CYLINDER_COUNT];
|
int ignitionPin[MAX_CYLINDER_COUNT];
|
||||||
|
|
||||||
/**
|
|
||||||
* this is invoked each time we register a trigger tooth signal
|
|
||||||
*/
|
|
||||||
void onTriggerSignalEvent();
|
|
||||||
EngineState engineState;
|
EngineState engineState;
|
||||||
/**
|
/**
|
||||||
* idle blip is a development tool: alternator PID research for instance have benefited from a repetitive change of RPM
|
* idle blip is a development tool: alternator PID research for instance have benefited from a repetitive change of RPM
|
||||||
|
@ -340,13 +336,6 @@ public:
|
||||||
LimpManager limpManager;
|
LimpManager limpManager;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
|
||||||
* By the way:
|
|
||||||
* 'cranking' means engine is not stopped and the rpm are below crankingRpm
|
|
||||||
* 'running' means RPM are above crankingRpm
|
|
||||||
* 'spinning' means the engine is not stopped
|
|
||||||
*/
|
|
||||||
bool isSpinning = false;
|
|
||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
void injectEngineReferences();
|
void injectEngineReferences();
|
||||||
|
|
|
@ -666,7 +666,7 @@ void TriggerCentral::handleShaftSignal(trigger_event_e signal, efitick_t timesta
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
engine->onTriggerSignalEvent();
|
isSpinningJustForWatchdog = true;
|
||||||
|
|
||||||
m_lastEventTimer.reset(timestamp);
|
m_lastEventTimer.reset(timestamp);
|
||||||
|
|
||||||
|
@ -886,7 +886,7 @@ void triggerInfo(void) {
|
||||||
|
|
||||||
static void resetRunningTriggerCounters() {
|
static void resetRunningTriggerCounters() {
|
||||||
#if !EFI_UNIT_TEST
|
#if !EFI_UNIT_TEST
|
||||||
engine->triggerCentral.resetCounters();
|
getTriggerCentral()->resetCounters();
|
||||||
triggerInfo();
|
triggerInfo();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,6 +70,18 @@ public:
|
||||||
|
|
||||||
LocalVersionHolder triggerVersion;
|
LocalVersionHolder triggerVersion;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* By the way:
|
||||||
|
* 'cranking' means engine is not stopped and the rpm are below crankingRpm
|
||||||
|
* 'running' means RPM are above crankingRpm
|
||||||
|
* 'spinning' means the engine is not stopped
|
||||||
|
*/
|
||||||
|
// todo: combine with other RpmCalculator fields?
|
||||||
|
/**
|
||||||
|
* this is set to true each time we register a trigger tooth signal
|
||||||
|
*/
|
||||||
|
bool isSpinningJustForWatchdog = false;
|
||||||
|
|
||||||
angle_t mapCamPrevToothAngle = -1;
|
angle_t mapCamPrevToothAngle = -1;
|
||||||
float mapCamPrevCycleValue = 0;
|
float mapCamPrevCycleValue = 0;
|
||||||
int prevChangeAtCycle = 0;
|
int prevChangeAtCycle = 0;
|
||||||
|
|
Loading…
Reference in New Issue