auto-sync

This commit is contained in:
rusEfi 2016-11-30 19:01:43 -05:00
parent 90989a6579
commit 0fe292a6ac
6 changed files with 14 additions and 15 deletions

View File

@ -58,7 +58,7 @@ public:
int eventsCount; int eventsCount;
private: private:
void clear(); void clear();
void registerInjectionEvent(int injectorIndex, float angle, angle_t injectionDuration, bool isSimultanious DECLARE_ENGINE_PARAMETER_S); void registerInjectionEvent(InjectorOutputPin *output, InjectorOutputPin *secondOutput, float angle, angle_t injectionDuration, bool isSimultanious DECLARE_ENGINE_PARAMETER_S);
}; };
/** /**

View File

@ -27,7 +27,7 @@
InjectionEvent::InjectionEvent() { InjectionEvent::InjectionEvent() {
isSimultanious = false; isSimultanious = false;
isOverlapping = false; isOverlapping = false;
output = NULL; memset(outputs, 0, sizeof(outputs));
} }
event_trigger_position_s::event_trigger_position_s() { event_trigger_position_s::event_trigger_position_s() {

View File

@ -37,7 +37,7 @@ public:
* It's more efficient to handle all injectors together if that's the case * It's more efficient to handle all injectors together if that's the case
*/ */
bool isSimultanious; bool isSimultanious;
InjectorOutputPin *output; InjectorOutputPin *outputs[MAX_WIRES_COUNT];
bool isOverlapping; bool isOverlapping;
event_trigger_position_s injectionStart; event_trigger_position_s injectionStart;

View File

@ -93,10 +93,9 @@ void setSingleCoilDwell(engine_configuration_s *engineConfiguration) {
#if EFI_ENGINE_CONTROL || defined(__DOXYGEN__) #if EFI_ENGINE_CONTROL || defined(__DOXYGEN__)
void FuelSchedule::registerInjectionEvent(int injectorIndex, float angle, angle_t injectionDuration, void FuelSchedule::registerInjectionEvent(InjectorOutputPin *output, InjectorOutputPin *secondOutput, float angle, angle_t injectionDuration,
bool isSimultanious DECLARE_ENGINE_PARAMETER_S) { bool isSimultanious DECLARE_ENGINE_PARAMETER_S) {
InjectorOutputPin *output = &enginePins.injectors[injectorIndex];
if (!isSimultanious && !isPinAssigned(output)) { if (!isSimultanious && !isPinAssigned(output)) {
// todo: extract method for this index math // todo: extract method for this index math
@ -111,7 +110,7 @@ void FuelSchedule::registerInjectionEvent(int injectorIndex, float angle, angle_
fixAngle(angle); fixAngle(angle);
ev->isOverlapping = angle < 720 && (angle + injectionDuration) > 720; ev->isOverlapping = angle < 720 && (angle + injectionDuration) > 720;
ev->output = output; ev->outputs[0] = output;
ev->isSimultanious = isSimultanious; ev->isSimultanious = isSimultanious;
@ -168,7 +167,7 @@ void FuelSchedule::addFuelEvents(injection_mode_e mode DECLARE_ENGINE_PARAMETER_
int index = getCylinderId(engineConfiguration->specs.firingOrder, i) - 1; int index = getCylinderId(engineConfiguration->specs.firingOrder, i) - 1;
float angle = baseAngle float angle = baseAngle
+ ENGINE(engineCycle) * i / CONFIG(specs.cylindersCount); + ENGINE(engineCycle) * i / CONFIG(specs.cylindersCount);
registerInjectionEvent(index, angle, injectionDuration, false PASS_ENGINE_PARAMETER); registerInjectionEvent(&enginePins.injectors[index], NULL, angle, injectionDuration, false PASS_ENGINE_PARAMETER);
} }
break; break;
case IM_SIMULTANEOUS: case IM_SIMULTANEOUS:
@ -180,7 +179,7 @@ void FuelSchedule::addFuelEvents(injection_mode_e mode DECLARE_ENGINE_PARAMETER_
* We do not need injector pin here because we will control all injectors * We do not need injector pin here because we will control all injectors
* simultaneously * simultaneously
*/ */
registerInjectionEvent(0, angle, injectionDuration, true PASS_ENGINE_PARAMETER); registerInjectionEvent(&enginePins.injectors[0], NULL, angle, injectionDuration, true PASS_ENGINE_PARAMETER);
} }
break; break;
case IM_BATCH: case IM_BATCH:
@ -188,7 +187,7 @@ void FuelSchedule::addFuelEvents(injection_mode_e mode DECLARE_ENGINE_PARAMETER_
int index = i % (engineConfiguration->specs.cylindersCount / 2); int index = i % (engineConfiguration->specs.cylindersCount / 2);
float angle = baseAngle float angle = baseAngle
+ i * ENGINE(engineCycle) / CONFIG(specs.cylindersCount); + i * ENGINE(engineCycle) / CONFIG(specs.cylindersCount);
registerInjectionEvent(index, angle, injectionDuration, false PASS_ENGINE_PARAMETER); registerInjectionEvent(&enginePins.injectors[index], NULL, angle, injectionDuration, false PASS_ENGINE_PARAMETER);
if (CONFIG(twoWireBatchInjection)) { if (CONFIG(twoWireBatchInjection)) {
@ -196,7 +195,7 @@ void FuelSchedule::addFuelEvents(injection_mode_e mode DECLARE_ENGINE_PARAMETER_
* also fire the 2nd half of the injectors so that we can implement a batch mode on individual wires * also fire the 2nd half of the injectors so that we can implement a batch mode on individual wires
*/ */
index = index + (CONFIG(specs.cylindersCount) / 2); index = index + (CONFIG(specs.cylindersCount) / 2);
registerInjectionEvent(index, angle, injectionDuration, false PASS_ENGINE_PARAMETER); registerInjectionEvent(&enginePins.injectors[index], NULL, angle, injectionDuration, false PASS_ENGINE_PARAMETER);
} }
} }
break; break;

View File

@ -237,7 +237,7 @@ static ALWAYS_INLINE void handleFuelInjectionEvent(int injEventIndex, InjectionE
* wetting coefficient works the same way for any injection mode, or is something * wetting coefficient works the same way for any injection mode, or is something
* x2 or /2? * x2 or /2?
*/ */
const floatms_t injectionDuration = ENGINE(wallFuel).adjust(event->output->injectorIndex, ENGINE(fuelMs) PASS_ENGINE_PARAMETER); const floatms_t injectionDuration = ENGINE(wallFuel).adjust(event->outputs[0]->injectorIndex, ENGINE(fuelMs) PASS_ENGINE_PARAMETER);
#if EFI_PRINTF_FUEL_DETAILS || defined(__DOXYGEN__) #if EFI_PRINTF_FUEL_DETAILS || defined(__DOXYGEN__)
printf("fuel fuelMs=%f adjusted=%f\t\n", ENGINE(fuelMs), injectionDuration); printf("fuel fuelMs=%f adjusted=%f\t\n", ENGINE(fuelMs), injectionDuration);
#endif /*EFI_PRINTF_FUEL_DETAILS */ #endif /*EFI_PRINTF_FUEL_DETAILS */
@ -309,14 +309,14 @@ static ALWAYS_INLINE void handleFuelInjectionEvent(int injEventIndex, InjectionE
// we are in this branch of code only in case of NOT IM_SIMULTANEOUS injection // we are in this branch of code only in case of NOT IM_SIMULTANEOUS injection
// we are ignoring low RPM in order not to handle "engine was stopped to engine now running" transition // we are ignoring low RPM in order not to handle "engine was stopped to engine now running" transition
if (rpm > 2 * engineConfiguration->cranking.rpm) { if (rpm > 2 * engineConfiguration->cranking.rpm) {
const char *outputName = event->output->name; const char *outputName = event->outputs[0]->name;
if (prevOutputName == outputName) { if (prevOutputName == outputName) {
warning(CUSTOM_OBD_SKIPPED_FUEL, "looks like skipped fuel event %d %s", getRevolutionCounter(), outputName); warning(CUSTOM_OBD_SKIPPED_FUEL, "looks like skipped fuel event %d %s", getRevolutionCounter(), outputName);
} }
prevOutputName = outputName; prevOutputName = outputName;
} }
scheduleFuelInjection(rpm, signal, getTimeNowUs(), injectionStartDelayUs, MS2US(injectionDuration), event->output PASS_ENGINE_PARAMETER); scheduleFuelInjection(rpm, signal, getTimeNowUs(), injectionStartDelayUs, MS2US(injectionDuration), event->outputs[0] PASS_ENGINE_PARAMETER);
} }
} }
@ -360,7 +360,7 @@ static void handleFuelScheduleOverlap(InjectionEventList *injectionEvents DECLAR
if (!engine->engineConfiguration2->wasOverlapping[injEventIndex] && event->isOverlapping) { if (!engine->engineConfiguration2->wasOverlapping[injEventIndex] && event->isOverlapping) {
// we are here if new fuel schedule is crossing engine cycle boundary with this event // we are here if new fuel schedule is crossing engine cycle boundary with this event
InjectorOutputPin *output = event->output; InjectorOutputPin *output = event->outputs[0];
// todo: recalc fuel? account for wetting? // todo: recalc fuel? account for wetting?
floatms_t injectionDuration = ENGINE(fuelMs); floatms_t injectionDuration = ENGINE(fuelMs);

View File

@ -600,7 +600,7 @@ void assertInjectorDownEvent(const char *msg, int eventIndex, efitime_t momentX,
} }
static void assertInjectionEvent(const char *msg, InjectionEvent *ev, int injectorIndex, int eventIndex, angle_t angleOffset, bool isOverlapping) { static void assertInjectionEvent(const char *msg, InjectionEvent *ev, int injectorIndex, int eventIndex, angle_t angleOffset, bool isOverlapping) {
assertEqualsM4(msg, "inj index", injectorIndex, ev->output->injectorIndex); assertEqualsM4(msg, "inj index", injectorIndex, ev->outputs[0]->injectorIndex);
assertEqualsM4(msg, " event index", eventIndex, ev->injectionStart.eventIndex); assertEqualsM4(msg, " event index", eventIndex, ev->injectionStart.eventIndex);
assertEqualsM4(msg, " event offset", angleOffset, ev->injectionStart.angleOffset); assertEqualsM4(msg, " event offset", angleOffset, ev->injectionStart.angleOffset);
assertTrueM("is overlapping", isOverlapping == ev->isOverlapping); assertTrueM("is overlapping", isOverlapping == ev->isOverlapping);