Staged injection support; use two sets of injectors on the same engine #5247

This commit is contained in:
Matthew Kennedy 2024-01-07 19:08:52 -05:00 committed by rusefillc
parent 7eaf105c65
commit 7037108500
2 changed files with 19 additions and 0 deletions

View File

@ -53,6 +53,12 @@ static const char* const injectorNames[] = { "Injector 1", "Injector 2", "Inject
static const char* const injectorShortNames[] = { PROTOCOL_INJ1_SHORT_NAME, "i2", "i3", "i4", "i5", "i6", "i7", "i8", static const char* const injectorShortNames[] = { PROTOCOL_INJ1_SHORT_NAME, "i2", "i3", "i4", "i5", "i6", "i7", "i8",
"i9", "iA", "iB", "iC"}; "i9", "iA", "iB", "iC"};
static const char* const injectorStage2Names[] = { "Injector Second Stage 1", "Injector Second Stage 2", "Injector Second Stage 3", "Injector Second Stage 4", "Injector Second Stage 5", "Injector Second Stage 6",
"Injector Second Stage 7", "Injector Second Stage 8", "Injector Second Stage 9", "Injector Second Stage 10", "Injector Second Stage 11", "Injector Second Stage 12"};
static const char* const injectorStage2ShortNames[] = { PROTOCOL_INJ1_STAGE2_SHORT_NAME, "j2", "j3", "j4", "j5", "j6", "j7", "j8",
"j9", "jA", "jB", "jC"};
static const char* const auxValveShortNames[] = { "a1", "a2"}; static const char* const auxValveShortNames[] = { "a1", "a2"};
static RegisteredOutputPin * registeredOutputHead = nullptr; static RegisteredOutputPin * registeredOutputHead = nullptr;
@ -178,6 +184,10 @@ EnginePins::EnginePins() :
enginePins.injectors[i].injectorIndex = i; enginePins.injectors[i].injectorIndex = i;
enginePins.injectors[i].name = injectorNames[i]; enginePins.injectors[i].name = injectorNames[i];
enginePins.injectors[i].shortName = injectorShortNames[i]; enginePins.injectors[i].shortName = injectorShortNames[i];
enginePins.injectorsStage2[i].injectorIndex = i;
// enginePins.injectorsStage2[i].setName(injectorStage2Names[i]);
enginePins.injectorsStage2[i].shortName = injectorStage2ShortNames[i];
} }
static_assert(efi::size(auxValveShortNames) >= AUX_DIGITAL_VALVE_COUNT, "Too many aux valve pins"); static_assert(efi::size(auxValveShortNames) >= AUX_DIGITAL_VALVE_COUNT, "Too many aux valve pins");
@ -207,6 +217,7 @@ bool EnginePins::stopPins() {
for (int i = 0; i < MAX_CYLINDER_COUNT; i++) { for (int i = 0; i < MAX_CYLINDER_COUNT; i++) {
result |= coils[i].stop(); result |= coils[i].stop();
result |= injectors[i].stop(); result |= injectors[i].stop();
result |= injectorsStage2[i].stop();
result |= trailingCoils[i].stop(); result |= trailingCoils[i].stop();
} }
for (int i = 0; i < AUX_DIGITAL_VALVE_COUNT; i++) { for (int i = 0; i < AUX_DIGITAL_VALVE_COUNT; i++) {
@ -275,6 +286,7 @@ void EnginePins::stopIgnitionPins() {
void EnginePins::stopInjectionPins() { void EnginePins::stopInjectionPins() {
for (int i = 0; i < MAX_CYLINDER_COUNT; i++) { for (int i = 0; i < MAX_CYLINDER_COUNT; i++) {
unregisterOutputIfPinOrModeChanged(enginePins.injectors[i], injectionPins[i], injectionPinMode); unregisterOutputIfPinOrModeChanged(enginePins.injectors[i], injectionPins[i], injectionPinMode);
// unregisterOutputIfPinOrModeChanged(enginePins.injectorsStage2[i], injectionPinsStage2[i], injectionPinMode);
} }
} }
@ -325,6 +337,12 @@ void EnginePins::startInjectionPins() {
output->initPin(output->name, engineConfiguration->injectionPins[i], output->initPin(output->name, engineConfiguration->injectionPins[i],
engineConfiguration->injectionPinMode); engineConfiguration->injectionPinMode);
} }
output = &enginePins.injectorsStage2[i];
if (isPinOrModeChanged(injectionPinsStage2[i], injectionPinMode)) {
output->initPin(output->getName(), engineConfiguration->injectionPinsStage2[i],
engineConfiguration->injectionPinMode);
}
} }
#endif /* EFI_PROD_CODE */ #endif /* EFI_PROD_CODE */
} }

View File

@ -118,6 +118,7 @@ public:
OutputPin accelerometerCs; OutputPin accelerometerCs;
InjectorOutputPin injectors[MAX_CYLINDER_COUNT]; InjectorOutputPin injectors[MAX_CYLINDER_COUNT];
InjectorOutputPin injectorsStage2[MAX_CYLINDER_COUNT];
IgnitionOutputPin coils[MAX_CYLINDER_COUNT]; IgnitionOutputPin coils[MAX_CYLINDER_COUNT];
IgnitionOutputPin trailingCoils[MAX_CYLINDER_COUNT]; IgnitionOutputPin trailingCoils[MAX_CYLINDER_COUNT];
NamedOutputPin auxValve[AUX_DIGITAL_VALVE_COUNT]; NamedOutputPin auxValve[AUX_DIGITAL_VALVE_COUNT];