parent
af9dfe1989
commit
fc77a09c35
|
@ -86,3 +86,4 @@ typedef enum __attribute__ ((__packed__)) {
|
|||
|
||||
size_t getFiringOrderCylinderId(size_t index);
|
||||
size_t getNextFiringCylinderId(size_t prevCylinderId);
|
||||
size_t getCylinderNumberAtIndex(size_t cylinderIndex);
|
||||
|
|
|
@ -165,7 +165,7 @@ bool InjectionEvent::update() {
|
|||
injectorIndex = 0;
|
||||
} else if (mode == IM_SEQUENTIAL || mode == IM_BATCH) {
|
||||
// Map order index -> cylinder index (firing order)
|
||||
injectorIndex = ID2INDEX(getFiringOrderCylinderId(ownIndex));
|
||||
injectorIndex = getCylinderNumberAtIndex(ownIndex);
|
||||
} else {
|
||||
firmwareError(ObdCode::CUSTOM_OBD_UNEXPECTED_INJECTION_MODE, "Unexpected injection mode %d", mode);
|
||||
injectorIndex = 0;
|
||||
|
@ -182,7 +182,7 @@ bool InjectionEvent::update() {
|
|||
// Each injector gets fired as a primary (the same as sequential), but also
|
||||
// fires the injector 360 degrees later in the firing order.
|
||||
int secondOrder = (ownIndex + (engineConfiguration->cylindersCount / 2)) % engineConfiguration->cylindersCount;
|
||||
int secondIndex = ID2INDEX(getFiringOrderCylinderId(secondOrder));
|
||||
int secondIndex = getCylinderNumberAtIndex(secondOrder);
|
||||
secondOutput = &enginePins.injectors[secondIndex];
|
||||
secondOutputStage2 = &enginePins.injectorsStage2[secondIndex];
|
||||
} else {
|
||||
|
|
|
@ -96,7 +96,7 @@ static void prepareCylinderIgnitionSchedule(angle_t dwellAngleDuration, floatms_
|
|||
}
|
||||
|
||||
const int index = getIgnitionPinForIndex(event->cylinderIndex, ignitionMode);
|
||||
const int coilIndex = ID2INDEX(getFiringOrderCylinderId(index));
|
||||
const int coilIndex = getCylinderNumberAtIndex(index);
|
||||
angle_t finalIgnitionTiming = getEngineState()->timingAdvance[coilIndex];
|
||||
// Stash which cylinder we're scheduling so that knock sensing knows which
|
||||
// cylinder just fired
|
||||
|
@ -140,7 +140,7 @@ static void prepareCylinderIgnitionSchedule(angle_t dwellAngleDuration, floatms_
|
|||
bool isTwoWireWasted = engineConfiguration->twoWireBatchIgnition || (engineConfiguration->ignitionMode == IM_INDIVIDUAL_COILS);
|
||||
if (ignitionMode == IM_WASTED_SPARK && isTwoWireWasted) {
|
||||
int secondIndex = index + engineConfiguration->cylindersCount / 2;
|
||||
int secondCoilIndex = ID2INDEX(getFiringOrderCylinderId(secondIndex));
|
||||
int secondCoilIndex = getCylinderNumberAtIndex(secondIndex);
|
||||
secondOutput = &enginePins.coils[secondCoilIndex];
|
||||
assertPinAssigned(secondOutput);
|
||||
} else {
|
||||
|
|
|
@ -271,3 +271,7 @@ size_t getNextFiringCylinderId(size_t prevCylinderId) {
|
|||
|
||||
return 1;
|
||||
}
|
||||
|
||||
size_t getCylinderNumberAtIndex(size_t cylinderIndex) {
|
||||
return ID2INDEX(getFiringOrderCylinderId(cylinderIndex));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue