fix sequential mode cranking (#2919)
* fix * use the right enum * do it for fuel too * earlier * s
This commit is contained in:
parent
6455870ba8
commit
41ab294281
|
@ -60,11 +60,17 @@ bool FuelSchedule::addFuelEventsForCylinder(int i ) {
|
|||
|
||||
injection_mode_e mode = engine->getCurrentInjectionMode();
|
||||
|
||||
// We need two outputs if:
|
||||
// - we are running batch fuel, and have "use two wire batch" enabled
|
||||
// - running mode is sequential, but cranking mode is batch, so we should run two wire batch while cranking
|
||||
// (if we didn't, only half of injectors would fire while cranking)
|
||||
bool isTwoWireBatch = engineConfiguration->twoWireBatchInjection || (engineConfiguration->injectionMode == IM_SEQUENTIAL);
|
||||
|
||||
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 && engineConfiguration->twoWireBatchInjection)) {
|
||||
} else if (mode == IM_SEQUENTIAL || (mode == IM_BATCH && isTwoWireBatch)) {
|
||||
// Map order index -> cylinder index (firing order)
|
||||
injectorIndex = getCylinderId(i) - 1;
|
||||
} else if (mode == IM_BATCH) {
|
||||
|
@ -76,7 +82,8 @@ bool FuelSchedule::addFuelEventsForCylinder(int i ) {
|
|||
}
|
||||
|
||||
InjectorOutputPin *secondOutput;
|
||||
if (mode == IM_BATCH && engineConfiguration->twoWireBatchInjection) {
|
||||
|
||||
if (mode == IM_BATCH && isTwoWireBatch) {
|
||||
/**
|
||||
* also fire the 2nd half of the injectors so that we can implement a batch mode on individual wires
|
||||
*/
|
||||
|
|
|
@ -89,7 +89,12 @@ static void prepareCylinderIgnitionSchedule(angle_t dwellAngleDuration, floatms_
|
|||
IgnitionOutputPin *output = &enginePins.coils[coilIndex];
|
||||
|
||||
IgnitionOutputPin *secondOutput;
|
||||
if (getCurrentIgnitionMode() == IM_WASTED_SPARK && engineConfiguration->twoWireBatchIgnition) {
|
||||
|
||||
// We need two outputs if:
|
||||
// - we are running wasted spark, and have "two wire" mode enabled
|
||||
// - We are running sequential mode, but we're cranking, so we should run in two wire wasted mode (not one wire wasted)
|
||||
bool isTwoWireWasted = engineConfiguration->twoWireBatchIgnition || (engineConfiguration->ignitionMode == IM_INDIVIDUAL_COILS);
|
||||
if (getCurrentIgnitionMode() == IM_WASTED_SPARK && isTwoWireWasted) {
|
||||
int secondIndex = index + engineConfiguration->specs.cylindersCount / 2;
|
||||
int secondCoilIndex = ID2INDEX(getCylinderId(secondIndex));
|
||||
secondOutput = &enginePins.coils[secondCoilIndex];
|
||||
|
|
Loading…
Reference in New Issue