mirror of https://github.com/rusefi/rusefi-1.git
Merge pull request #1606 from mck1117/reset-overlap
reset overlap counter on fuel reschedule
This commit is contained in:
commit
c6d2a856dd
|
@ -60,6 +60,8 @@ public:
|
||||||
void addFuelEvents(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
void addFuelEvents(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||||
bool addFuelEventsForCylinder(int cylinderIndex DECLARE_ENGINE_PARAMETER_SUFFIX);
|
bool addFuelEventsForCylinder(int cylinderIndex DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||||
|
|
||||||
|
void resetOverlapping();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* injection events, per cylinder
|
* injection events, per cylinder
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -162,6 +162,11 @@ void InjectorOutputPin::close(efitick_t nowNt DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||||
#endif // EFI_TOOTH_LOGGER
|
#endif // EFI_TOOTH_LOGGER
|
||||||
setLow();
|
setLow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Don't allow negative overlap count
|
||||||
|
if (overlappingCounter < 0) {
|
||||||
|
overlappingCounter = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void turnInjectionPinLow(InjectionEvent *event) {
|
void turnInjectionPinLow(InjectionEvent *event) {
|
||||||
|
|
|
@ -165,7 +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();
|
||||||
|
|
||||||
|
// 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
|
||||||
|
|
|
@ -117,6 +117,12 @@ void FuelSchedule::clear() {
|
||||||
isReady = false;
|
isReady = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FuelSchedule::resetOverlapping() {
|
||||||
|
for (size_t i = 0; i < efi::size(enginePins.injectors); i++) {
|
||||||
|
enginePins.injectors[i].reset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns false in case of error, true if success
|
* @returns false in case of error, true if success
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -277,7 +277,12 @@ bool NamedOutputPin::stop() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void InjectorOutputPin::reset() {
|
void InjectorOutputPin::reset() {
|
||||||
|
// If this injector was open, close it and reset state
|
||||||
|
if (overlappingCounter != 0) {
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,7 +103,7 @@ public:
|
||||||
const char *shortName = NULL;
|
const char *shortName = NULL;
|
||||||
};
|
};
|
||||||
|
|
||||||
class InjectorOutputPin : public NamedOutputPin {
|
class InjectorOutputPin final : public NamedOutputPin {
|
||||||
public:
|
public:
|
||||||
InjectorOutputPin();
|
InjectorOutputPin();
|
||||||
void reset();
|
void reset();
|
||||||
|
|
|
@ -84,14 +84,9 @@ TEST(fuelControl, transitionIssue1592) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check that no injectors are stuck open
|
// Check that no injectors are stuck open
|
||||||
// Only injector 1 should currently be open
|
// Injectors 1/3 should be open
|
||||||
EXPECT_EQ(enginePins.injectors[0].getOverlappingCounter(), 1);
|
EXPECT_EQ(enginePins.injectors[0].getOverlappingCounter(), 1);
|
||||||
EXPECT_EQ(enginePins.injectors[1].getOverlappingCounter(), 0);
|
EXPECT_EQ(enginePins.injectors[1].getOverlappingCounter(), 0);
|
||||||
|
EXPECT_EQ(enginePins.injectors[2].getOverlappingCounter(), 1);
|
||||||
// !!!!!!!!! BUG !!!!!!!!!!!!!!!
|
|
||||||
// Injector #3 gets stuck open!
|
|
||||||
EXPECT_EQ(enginePins.injectors[2].getOverlappingCounter(), 2);
|
|
||||||
// !!!!!!!!! BUG !!!!!!!!!!!!!!!
|
|
||||||
|
|
||||||
EXPECT_EQ(enginePins.injectors[3].getOverlappingCounter(), 0);
|
EXPECT_EQ(enginePins.injectors[3].getOverlappingCounter(), 0);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue