make spark and fuel more similar

This commit is contained in:
Matthew Kennedy 2023-06-25 01:37:45 -07:00
parent e5ee320b67
commit ade14a956f
2 changed files with 5 additions and 17 deletions

View File

@ -1734,7 +1734,7 @@ enum class ObdCode : uint16_t {
CUSTOM_6019 = 6019,
CUSTOM_6020 = 6020,
CUSTOM_OBD_UNEXPECTED_INJECTION_MODE = 6021,
CUSTOM_6021 = 6021,
CUSTOM_6022 = 6022,
CUSTOM_OBD_UNKNOWN_FIRING_ORDER = 6023,
CUSTOM_OBD_WRONG_FIRING_ORDER = 6024,

View File

@ -127,17 +127,8 @@ bool FuelSchedule::addFuelEventsForCylinder(int i) {
injection_mode_e mode = getCurrentInjectionMode();
engine->outputChannels.currentInjectionMode = static_cast<uint8_t>(mode);
int injectorIndex;
if (mode == IM_SIMULTANEOUS || mode == IM_SINGLE_POINT) {
// These modes only have one injector
injectorIndex = 0;
} else if (mode == IM_SEQUENTIAL || mode == IM_BATCH) {
// Map order index -> cylinder index (firing order)
injectorIndex = getCylinderId(i) - 1;
} else {
firmwareError(ObdCode::CUSTOM_OBD_UNEXPECTED_INJECTION_MODE, "Unexpected injection mode %d", mode);
injectorIndex = 0;
}
int injectorIndex = ID2INDEX(getCylinderId(i));
InjectorOutputPin *secondOutput;
@ -155,12 +146,9 @@ bool FuelSchedule::addFuelEventsForCylinder(int i) {
secondOutput = nullptr;
}
InjectorOutputPin *output = &enginePins.injectors[injectorIndex];
bool isSimultaneous = mode == IM_SIMULTANEOUS;
ev->outputs[0] = output;
ev->outputs[0] = &enginePins.injectors[injectorIndex];
ev->outputs[1] = secondOutput;
ev->isSimultaneous = isSimultaneous;
ev->isSimultaneous = mode == IM_SIMULTANEOUS;
// Stash the cylinder number so we can select the correct fueling bank later
ev->cylinderNumber = injectorIndex;