mirror of https://github.com/rusefi/rusefi-1.git
auto-sync
This commit is contained in:
parent
d8defe3310
commit
3550caab27
|
@ -26,7 +26,6 @@
|
|||
|
||||
InjectionEvent::InjectionEvent() {
|
||||
isSimultanious = false;
|
||||
isOverlapping = false;
|
||||
memset(outputs, 0, sizeof(outputs));
|
||||
}
|
||||
|
||||
|
|
|
@ -166,7 +166,6 @@ void FuelSchedule::addFuelEventsForCylinder(int i DECLARE_ENGINE_PARAMETER_S) {
|
|||
ev->engine = engine;
|
||||
#endif
|
||||
fixAngle(angle);
|
||||
ev->isOverlapping = angle < 720 && (angle + injectionDuration) > 720;
|
||||
|
||||
ev->outputs[0] = output;
|
||||
ev->outputs[1] = secondOutput;
|
||||
|
|
|
@ -306,8 +306,6 @@ static ALWAYS_INLINE void handleFuelInjectionEvent(int injEventIndex, InjectionE
|
|||
|
||||
OutputSignalPair *pair = &ENGINE(engineConfiguration2)->fuelActuators[injEventIndex];
|
||||
|
||||
engine->engineConfiguration2->wasOverlapping[injEventIndex] = event->isOverlapping;
|
||||
|
||||
if (event->isSimultanious) {
|
||||
/**
|
||||
* this is pretty much copy-paste of 'scheduleOutput'
|
||||
|
@ -370,41 +368,6 @@ static void scheduleOutput2(OutputSignalPair *pair, efitimeus_t nowUs, float del
|
|||
#endif /* EFI_GPIO */
|
||||
}
|
||||
|
||||
static void handleFuelScheduleOverlap(FuelSchedule *fs DECLARE_ENGINE_PARAMETER_S) {
|
||||
/**
|
||||
* here we need to avoid a fuel miss due to changes between previous and current fuel schedule
|
||||
* see https://sourceforge.net/p/rusefi/tickets/299/
|
||||
* see testFuelSchedulerBug299smallAndLarge unit test
|
||||
*/
|
||||
//
|
||||
for (int injEventIndex = 0; injEventIndex < CONFIG(specs.cylindersCount); injEventIndex++) {
|
||||
InjectionEvent *event = &fs->elements[injEventIndex];
|
||||
if (!engine->engineConfiguration2->wasOverlapping[injEventIndex] && event->isOverlapping) {
|
||||
// we are here if new fuel schedule is crossing engine cycle boundary with this event
|
||||
|
||||
InjectorOutputPin *output = event->outputs[0];
|
||||
|
||||
// todo: recalc fuel? account for wetting?
|
||||
floatms_t injectionDuration = ENGINE(fuelMs);
|
||||
|
||||
OutputSignalPair* pair = &ENGINE(engineConfiguration2)->overlappingFuelActuator[injEventIndex];
|
||||
if (pair->isScheduled) {
|
||||
#if EFI_UNIT_TEST || EFI_SIMULATOR || defined(__DOXYGEN__)
|
||||
printf("still used2 %s %d\r\n", output->name, (int)getTimeNowUs());
|
||||
#endif /* EFI_UNIT_TEST || EFI_SIMULATOR */
|
||||
continue; // this OutputSignalPair is still needed for an extremely long injection scheduled previously
|
||||
}
|
||||
|
||||
efitimeus_t nowUs = getTimeNowUs();
|
||||
|
||||
output->overlappingScheduleOffTime = nowUs + MS2US(injectionDuration);
|
||||
|
||||
pair->event = event;
|
||||
scheduleOutput2(pair, nowUs, 0, MS2US(injectionDuration), output);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static ALWAYS_INLINE void handleFuel(const bool limitedFuel, uint32_t trgEventIndex, int rpm DECLARE_ENGINE_PARAMETER_S) {
|
||||
efiAssertVoid(getRemainingStack(chThdSelf()) > 128, "lowstck#3");
|
||||
efiAssertVoid(trgEventIndex < engine->engineCycleEventCount, "handleFuel/event index");
|
||||
|
@ -426,10 +389,6 @@ static ALWAYS_INLINE void handleFuel(const bool limitedFuel, uint32_t trgEventIn
|
|||
fs->addFuelEvents(PASS_ENGINE_PARAMETER_F);
|
||||
}
|
||||
|
||||
if (trgEventIndex == 0) {
|
||||
handleFuelScheduleOverlap(fs PASS_ENGINE_PARAMETER);
|
||||
}
|
||||
|
||||
#if FUEL_MATH_EXTREME_LOGGING || defined(__DOXYGEN__)
|
||||
scheduleMsg(logger, "handleFuel ind=%d %d", trgEventIndex, getRevolutionCounter());
|
||||
#endif /* FUEL_MATH_EXTREME_LOGGING */
|
||||
|
|
|
@ -290,5 +290,5 @@ int getRusEfiVersion(void) {
|
|||
return 123; // this is here to make the compiler happy about the unused array
|
||||
if (UNUSED_CCM_SIZE[0] * 0 != 0)
|
||||
return 3211; // this is here to make the compiler happy about the unused array
|
||||
return 20161130;
|
||||
return 20161201;
|
||||
}
|
||||
|
|
|
@ -599,7 +599,6 @@ static void assertInjectionEvent(const char *msg, InjectionEvent *ev, int inject
|
|||
assertEqualsM4(msg, "inj index", injectorIndex, ev->outputs[0]->injectorIndex);
|
||||
assertEqualsM4(msg, " event index", eventIndex, ev->injectionStart.eventIndex);
|
||||
assertEqualsM4(msg, " event offset", angleOffset, ev->injectionStart.angleOffset);
|
||||
assertTrueM("is overlapping", isOverlapping == ev->isOverlapping);
|
||||
}
|
||||
|
||||
static void setTestBug299small(EngineTestHelper *eth) {
|
||||
|
@ -666,7 +665,7 @@ static void setTestBug299(EngineTestHelper *eth) {
|
|||
FuelSchedule * t = ENGINE(engineConfiguration2)->injectionEvents;
|
||||
|
||||
assertInjectionEvent("#0", &t->elements[0], 0, 1, 153, false);
|
||||
assertInjectionEvent("#1@", &t->elements[1], 1, 1, 333, false);
|
||||
assertInjectionEvent("#1_i_@", &t->elements[1], 1, 1, 333, false);
|
||||
assertInjectionEvent("#2@", &t->elements[2], 0, 0, 153, false);
|
||||
assertInjectionEvent("inj#3@", &t->elements[3], 1, 0, 153 + 180, false);
|
||||
|
||||
|
@ -762,7 +761,7 @@ void testFuelSchedulerBug299smallAndMedium(void) {
|
|||
|
||||
FuelSchedule * t;
|
||||
|
||||
assertInjectors("#0", 0, 0);
|
||||
assertInjectors("#0_inj", 0, 0);
|
||||
|
||||
|
||||
int engineLoadIndex = findIndex(config->fuelLoadBins, FUEL_LOAD_COUNT, testMafValue);
|
||||
|
@ -837,7 +836,7 @@ void testFuelSchedulerBug299smallAndMedium(void) {
|
|||
t = ENGINE(engineConfiguration2)->injectionEvents;
|
||||
|
||||
assertInjectionEvent("#0", &t->elements[0], 0, 0, 315, false);
|
||||
assertInjectionEvent("#1", &t->elements[1], 1, 1, 135, false);
|
||||
assertInjectionEvent("#1__", &t->elements[1], 1, 1, 135, false);
|
||||
assertInjectionEvent("inj#2", &t->elements[2], 0, 0, 153, false);
|
||||
assertInjectionEvent("inj#3", &t->elements[3], 1, 0, 333, false);
|
||||
|
||||
|
@ -855,7 +854,7 @@ void testFuelSchedulerBug299smallAndMedium(void) {
|
|||
// assertInjectorDownEvent("26@0", 0, MS2US(10.0), 0);
|
||||
|
||||
eth.firePrimaryTriggerRise();
|
||||
assertEqualsM("qs#2#2", 6, schedulingQueue.size());
|
||||
assertEqualsM("qs#2#2", 4, schedulingQueue.size());
|
||||
assertEqualsM("rev cnt6", 6, engine->rpmCalculator.getRevolutionCounter());
|
||||
// time...|-20.....|-10.....|0.......|10......|20......|30......|40......|
|
||||
// inj #0 |########|.....###|########|....####|........|........|........|
|
||||
|
@ -864,16 +863,16 @@ void testFuelSchedulerBug299smallAndMedium(void) {
|
|||
// assertInjectorUpEvent("06@6", 6, MS2US(37.5), 0);
|
||||
// assertInjectorDownEvent("06@7", 7, MS2US(40.0), 1);
|
||||
|
||||
assertEqualsM("exec#7", 1, schedulingQueue.executeAll(timeNow));
|
||||
assertEqualsM("exec#7", 0, schedulingQueue.executeAll(timeNow));
|
||||
|
||||
assertInjectors("#1", 1, 0);
|
||||
assertInjectors("#1_ij_", 0, 0);
|
||||
|
||||
timeNow += MS2US(20);
|
||||
|
||||
// time...|-20.....|-10.....|0.......|10......|20......|30......|40......|
|
||||
// inj #0 |########|.......#|........|........|........|........|........|
|
||||
// inj #1 |....####|########|........|........|........|........|........|
|
||||
assertEqualsM("qs#022", 5, schedulingQueue.size());
|
||||
assertEqualsM("qs#022", 4, schedulingQueue.size());
|
||||
// assertInjectorUpEvent("7@0", 0, MS2US(-12.5), 1);
|
||||
// assertInjectorDownEvent("7@1", 1, MS2US(-10.0), 0);
|
||||
// assertInjectorUpEvent("7@2", 2, MS2US(-2.5), 0);
|
||||
|
@ -884,7 +883,7 @@ void testFuelSchedulerBug299smallAndMedium(void) {
|
|||
//// assertInjectorDownEvent("7@7", 7, MS2US(20), 1);
|
||||
// // todo index 8
|
||||
|
||||
assertEqualsM("executed #06", 4, schedulingQueue.executeAll(timeNow));
|
||||
assertEqualsM("executed #06", 3, schedulingQueue.executeAll(timeNow));
|
||||
assertInjectors("#4", 1, 0);
|
||||
assertEqualsM("qs#06", 1, schedulingQueue.size());
|
||||
assertInjectorDownEvent("17@0", 0, MS2US(10), 0);
|
||||
|
|
Loading…
Reference in New Issue