only:ID2INDEX

This commit is contained in:
rusefillc 2024-01-07 13:23:51 -05:00
parent 98092c306f
commit 0bfdada528
1 changed files with 2 additions and 2 deletions

View File

@ -143,7 +143,7 @@ bool InjectionEvent::update() {
injectorIndex = 0;
} else if (mode == IM_SEQUENTIAL || mode == IM_BATCH) {
// Map order index -> cylinder index (firing order)
injectorIndex = getCylinderId(ownIndex) - 1;
injectorIndex = ID2INDEX(getCylinderId(ownIndex));
} else {
firmwareError(ObdCode::CUSTOM_OBD_UNEXPECTED_INJECTION_MODE, "Unexpected injection mode %d", mode);
injectorIndex = 0;
@ -159,7 +159,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 = getCylinderId(secondOrder) - 1;
int secondIndex = ID2INDEX(getCylinderId(secondOrder));
secondOutput = &enginePins.injectors[secondIndex];
} else {
secondOutput = nullptr;