mirror of https://github.com/rusefi/rusefi-1.git
Merge remote-tracking branch 'upstream/master' into export-all-logicdata
This commit is contained in:
commit
a6139c5c70
|
@ -1,2 +1,2 @@
|
|||
#pragma once
|
||||
#define VCS_DATE 20200720
|
||||
#define VCS_DATE 20200721
|
||||
|
|
|
@ -71,14 +71,22 @@ static Logging *logger;
|
|||
//#endif
|
||||
|
||||
void startSimultaniousInjection(Engine *engine) {
|
||||
#if EFI_UNIT_TEST
|
||||
EXPAND_Engine;
|
||||
#endif // EFI_UNIT_TEST
|
||||
efitick_t nowNt = getTimeNowNt();
|
||||
for (int i = 0; i < engine->engineConfigurationPtr->specs.cylindersCount; i++) {
|
||||
enginePins.injectors[i].open();
|
||||
enginePins.injectors[i].open(nowNt PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
}
|
||||
}
|
||||
|
||||
static void endSimultaniousInjectionOnlyTogglePins(Engine *engine) {
|
||||
#if EFI_UNIT_TEST
|
||||
EXPAND_Engine;
|
||||
#endif
|
||||
efitick_t nowNt = getTimeNowNt();
|
||||
for (int i = 0; i < engine->engineConfigurationPtr->specs.cylindersCount; i++) {
|
||||
enginePins.injectors[i].close();
|
||||
enginePins.injectors[i].close(nowNt PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -88,17 +96,16 @@ void endSimultaniousInjection(InjectionEvent *event) {
|
|||
EXPAND_Engine;
|
||||
#endif
|
||||
event->isScheduled = false;
|
||||
|
||||
endSimultaniousInjectionOnlyTogglePins(engine);
|
||||
engine->injectionEvents.addFuelEventsForCylinder(event->ownIndex PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
}
|
||||
|
||||
void InjectorOutputPin::open() {
|
||||
void InjectorOutputPin::open(efitick_t nowNt DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||
overlappingCounter++;
|
||||
|
||||
#if FUEL_MATH_EXTREME_LOGGING
|
||||
if (printFuelDebug) {
|
||||
printf("turnInjectionPinHigh %s %d %d\r\n", name, overlappingCounter, (int)getTimeNowUs());
|
||||
printf("InjectorOutputPin::open %s %d now=%0.1fms\r\n", name, overlappingCounter, (int)getTimeNowUs() / 1000.0);
|
||||
}
|
||||
#endif /* FUEL_MATH_EXTREME_LOGGING */
|
||||
|
||||
|
@ -113,31 +120,29 @@ void InjectorOutputPin::open() {
|
|||
}
|
||||
#endif /* FUEL_MATH_EXTREME_LOGGING */
|
||||
} else {
|
||||
#if EFI_TOOTH_LOGGER
|
||||
LogTriggerInjectorState(nowNt, true PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
#endif // EFI_TOOTH_LOGGER
|
||||
setHigh();
|
||||
}
|
||||
}
|
||||
|
||||
void turnInjectionPinHigh(InjectionEvent *event) {
|
||||
efitick_t nowNt = getTimeNowNt();
|
||||
|
||||
#if EFI_TOOTH_LOGGER
|
||||
#if EFI_UNIT_TEST
|
||||
Engine *engine = event->engine;
|
||||
EXPAND_Engine;
|
||||
#endif // EFI_UNIT_TEST
|
||||
LogTriggerInjectorState(nowNt, true PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
#endif // EFI_TOOTH_LOGGER
|
||||
|
||||
efitick_t nowNt = getTimeNowNt();
|
||||
for (int i = 0;i < MAX_WIRES_COUNT;i++) {
|
||||
InjectorOutputPin *output = event->outputs[i];
|
||||
|
||||
if (output) {
|
||||
output->open();
|
||||
output->open(nowNt PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void InjectorOutputPin::close() {
|
||||
void InjectorOutputPin::close(efitick_t nowNt DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||
#if FUEL_MATH_EXTREME_LOGGING
|
||||
if (printFuelDebug) {
|
||||
printf("InjectorOutputPin::close %s %d %d\r\n", name, overlappingCounter, (int)getTimeNowUs());
|
||||
|
@ -152,6 +157,9 @@ void InjectorOutputPin::close() {
|
|||
}
|
||||
#endif /* FUEL_MATH_EXTREME_LOGGING */
|
||||
} else {
|
||||
#if EFI_TOOTH_LOGGER
|
||||
LogTriggerInjectorState(nowNt, false PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
#endif // EFI_TOOTH_LOGGER
|
||||
setLow();
|
||||
}
|
||||
}
|
||||
|
@ -164,15 +172,11 @@ void turnInjectionPinLow(InjectionEvent *event) {
|
|||
EXPAND_Engine;
|
||||
#endif
|
||||
|
||||
#if EFI_TOOTH_LOGGER
|
||||
LogTriggerInjectorState(nowNt, false PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
#endif // EFI_TOOTH_LOGGER
|
||||
|
||||
event->isScheduled = false;
|
||||
for (int i = 0;i<MAX_WIRES_COUNT;i++) {
|
||||
InjectorOutputPin *output = event->outputs[i];
|
||||
if (output) {
|
||||
output->close();
|
||||
output->close(nowNt PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
}
|
||||
}
|
||||
ENGINE(injectionEvents.addFuelEventsForCylinder(event->ownIndex PASS_ENGINE_PARAMETER_SUFFIX));
|
||||
|
|
|
@ -108,8 +108,8 @@ public:
|
|||
InjectorOutputPin();
|
||||
void reset();
|
||||
|
||||
void open();
|
||||
void close();
|
||||
void open(efitick_t nowNt DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
void close(efitick_t nowNt DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
|
||||
int8_t getOverlappingCounter() const { return overlappingCounter; }
|
||||
|
||||
|
|
|
@ -10,19 +10,19 @@
|
|||
static void doRevolution(EngineTestHelper& eth, int periodMs) {
|
||||
float halfToothTime = (periodMs / 6.0f) / 2;
|
||||
|
||||
eth.fireRise(halfToothTime);
|
||||
eth.smartFireRise(halfToothTime);
|
||||
eth.fireFall(halfToothTime);
|
||||
eth.fireRise(halfToothTime);
|
||||
eth.smartFireRise(halfToothTime);
|
||||
eth.fireFall(halfToothTime);
|
||||
eth.fireRise(halfToothTime);
|
||||
eth.smartFireRise(halfToothTime);
|
||||
eth.fireFall(halfToothTime);
|
||||
|
||||
// now missing tooth
|
||||
eth.fireRise(halfToothTime);
|
||||
eth.smartFireRise(halfToothTime);
|
||||
eth.fireFall(3 * halfToothTime);
|
||||
|
||||
// This tooth is the sync point!
|
||||
eth.fireRise(halfToothTime);
|
||||
eth.smartFireRise(halfToothTime);
|
||||
eth.fireFall(halfToothTime);
|
||||
}
|
||||
|
||||
|
@ -44,6 +44,8 @@ TEST(fuelControl, transitionIssue1592) {
|
|||
fuelMap.setAll(13);
|
||||
extern fuel_Map3D_t fuelPhaseMap;
|
||||
fuelPhaseMap.setAll(0);
|
||||
setArrayValues(config->crankingFuelCoef, 1.0f);
|
||||
setArrayValues(config->crankingCycleCoef, 1.0f);
|
||||
|
||||
engineConfiguration->globalTriggerAngleOffset = 20;
|
||||
|
||||
|
@ -76,32 +78,19 @@ TEST(fuelControl, transitionIssue1592) {
|
|||
ASSERT_EQ(sched_close->action.getCallback(), &turnInjectionPinLow);
|
||||
}
|
||||
|
||||
// Execute the first of those two events - the injector opens, but doesn't yet close.
|
||||
engine->executor.executeAll(getTimeNowUs() + MS2US(35));
|
||||
|
||||
// Check that queue got shorter, and overlap counters were incremented on injectors 2/3 (batch mode, remember?)
|
||||
{
|
||||
// Check that it was exec'd
|
||||
ASSERT_EQ(engine->executor.size(), 1);
|
||||
|
||||
// Injectors 2/3 should currently be open
|
||||
EXPECT_EQ(enginePins.injectors[0].getOverlappingCounter(), 0);
|
||||
EXPECT_EQ(enginePins.injectors[1].getOverlappingCounter(), 1);
|
||||
EXPECT_EQ(enginePins.injectors[2].getOverlappingCounter(), 1);
|
||||
EXPECT_EQ(enginePins.injectors[3].getOverlappingCounter(), 0);
|
||||
}
|
||||
|
||||
// Second sync point will transition to running
|
||||
// This needs to reset overlapping state as it may reschedule injector openings
|
||||
// Run the engine for some revs
|
||||
for (size_t i = 0; i < 10; i++) {
|
||||
doRevolution(eth, 150);
|
||||
}
|
||||
|
||||
// Injectors should all be closed immediately after mode change
|
||||
EXPECT_EQ(enginePins.injectors[0].getOverlappingCounter(), 0);
|
||||
// Check that no injectors are stuck open
|
||||
// Only injector 1 should currently be open
|
||||
EXPECT_EQ(enginePins.injectors[0].getOverlappingCounter(), 1);
|
||||
EXPECT_EQ(enginePins.injectors[1].getOverlappingCounter(), 0);
|
||||
|
||||
// !!!!!!!!! BUG !!!!!!!!!!!!!!!
|
||||
// These next two should be equal to 0, not 1
|
||||
EXPECT_EQ(enginePins.injectors[1].getOverlappingCounter(), 1);
|
||||
EXPECT_EQ(enginePins.injectors[2].getOverlappingCounter(), 1);
|
||||
// Injector #3 gets stuck open!
|
||||
EXPECT_EQ(enginePins.injectors[2].getOverlappingCounter(), 2);
|
||||
// !!!!!!!!! BUG !!!!!!!!!!!!!!!
|
||||
|
||||
EXPECT_EQ(enginePins.injectors[3].getOverlappingCounter(), 0);
|
||||
|
|
Loading…
Reference in New Issue