comments & improve logic
This commit is contained in:
parent
b3261f25f3
commit
b7336e953e
|
@ -165,8 +165,14 @@ void RpmCalculator::setRpmValue(float value DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||||
#if EFI_ENGINE_CONTROL
|
#if EFI_ENGINE_CONTROL
|
||||||
// This presumably fixes injection mode change for cranking-to-running transition.
|
// This presumably fixes injection mode change for cranking-to-running transition.
|
||||||
// 'isSimultanious' flag should be updated for events if injection modes differ for cranking and running.
|
// 'isSimultanious' flag should be updated for events if injection modes differ for cranking and running.
|
||||||
if (state != oldState) {
|
if (state != oldState && CONFIG(crankingInjectionMode) != CONFIG(injectionMode)) {
|
||||||
|
// Reset the state of all injectors: when we change fueling modes, we could
|
||||||
|
// immediately reschedule an injection that's currently underway. That will cause
|
||||||
|
// the injector's overlappingCounter to get out of sync with reality. As the fix,
|
||||||
|
// every injector's state is forcibly reset just before we could cause that to happen.
|
||||||
engine->injectionEvents.resetOverlapping();
|
engine->injectionEvents.resetOverlapping();
|
||||||
|
|
||||||
|
// reschedule all injection events now that we've reset them
|
||||||
engine->injectionEvents.addFuelEvents(PASS_ENGINE_PARAMETER_SIGNATURE);
|
engine->injectionEvents.addFuelEvents(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -277,7 +277,12 @@ bool NamedOutputPin::stop() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void InjectorOutputPin::reset() {
|
void InjectorOutputPin::reset() {
|
||||||
overlappingCounter = 0;
|
// If this injector was open, close it and reset state
|
||||||
|
if (overlappingCounter != 0) {
|
||||||
|
overlappingCounter = 0;
|
||||||
|
setValue(0);
|
||||||
|
}
|
||||||
|
|
||||||
// todo: this could be refactored by calling some super-reset method
|
// todo: this could be refactored by calling some super-reset method
|
||||||
currentLogicValue = INITIAL_PIN_STATE;
|
currentLogicValue = INITIAL_PIN_STATE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue