This commit is contained in:
rusefi 2019-10-26 21:53:22 -04:00
parent 3e8b46b6ca
commit 0a8a0d0b81
2 changed files with 10 additions and 7 deletions

View File

@ -45,7 +45,7 @@ typedef enum {
FO_1_10_9_4_3_6_5_8_7_2 = 14, // dodge and viper ram v10 FO_1_10_9_4_3_6_5_8_7_2 = 14, // dodge and viper ram v10
// 12 cylinder // 12 cylinder
FO_1_7_5_11_3_9_6_12_2_8_4_10 = 15, // bmw M70 etc FO_1_7_5_11_3_9_6_12_2_8_4_10 = 15, // bmw M70 & M73 etc
FO_1_7_4_10_2_8_6_12_3_9_5_11 = 16, // lamborghini, typical rusEfi use-case FO_1_7_4_10_2_8_6_12_3_9_5_11 = 16, // lamborghini, typical rusEfi use-case
FO_1_12_5_8_3_10_6_7_2_11_4_9 = 18, // VAG W12 FO_1_12_5_8_3_10_6_7_2_11_4_9 = 18, // VAG W12

View File

@ -436,7 +436,10 @@ int getCylinderId(int index DECLARE_ENGINE_PARAMETER_SUFFIX) {
return 1; return 1;
} }
static int getIgnitionPinForIndex(int i DECLARE_ENGINE_PARAMETER_SUFFIX) { /**
* @param cylinderIndex from 9 to cylinderCount, not cylinder number
*/
static int getIgnitionPinForIndex(int cylinderIndex DECLARE_ENGINE_PARAMETER_SUFFIX) {
switch (getCurrentIgnitionMode(PASS_ENGINE_PARAMETER_SIGNATURE)) { switch (getCurrentIgnitionMode(PASS_ENGINE_PARAMETER_SIGNATURE)) {
case IM_ONE_COIL: case IM_ONE_COIL:
return 0; return 0;
@ -446,11 +449,11 @@ static int getIgnitionPinForIndex(int i DECLARE_ENGINE_PARAMETER_SUFFIX) {
// we do not want to divide by zero // we do not want to divide by zero
return 0; return 0;
} }
return i % (CONFIG(specs.cylindersCount) / 2); return cylinderIndex % (CONFIG(specs.cylindersCount) / 2);
} }
break; break;
case IM_INDIVIDUAL_COILS: case IM_INDIVIDUAL_COILS:
return i; return cylinderIndex;
break; break;
default: default:
@ -462,8 +465,8 @@ static int getIgnitionPinForIndex(int i DECLARE_ENGINE_PARAMETER_SUFFIX) {
void prepareIgnitionPinIndices(ignition_mode_e ignitionMode DECLARE_ENGINE_PARAMETER_SUFFIX) { void prepareIgnitionPinIndices(ignition_mode_e ignitionMode DECLARE_ENGINE_PARAMETER_SUFFIX) {
if (ignitionMode != engine->ignitionModeForPinIndices) { if (ignitionMode != engine->ignitionModeForPinIndices) {
#if EFI_ENGINE_CONTROL #if EFI_ENGINE_CONTROL
for (int i = 0; i < CONFIG(specs.cylindersCount); i++) { for (int cylinderIndex = 0; cylinderIndex < CONFIG(specs.cylindersCount); cylinderIndex++) {
ENGINE(ignitionPin[i]) = getIgnitionPinForIndex(i PASS_ENGINE_PARAMETER_SUFFIX); ENGINE(ignitionPin[cylinderIndex]) = getIgnitionPinForIndex(cylinderIndex PASS_ENGINE_PARAMETER_SUFFIX);
} }
#endif /* EFI_ENGINE_CONTROL */ #endif /* EFI_ENGINE_CONTROL */
engine->ignitionModeForPinIndices = ignitionMode; engine->ignitionModeForPinIndices = ignitionMode;
@ -509,7 +512,7 @@ void prepareOutputSignals(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
#endif /* EFI_UNIT_TEST */ #endif /* EFI_UNIT_TEST */
for (int i = 0; i < CONFIG(specs.cylindersCount); i++) { for (int i = 0; i < CONFIG(specs.cylindersCount); i++) {
ENGINE(ignitionPositionWithinEngineCycle[i])= ENGINE(engineCycle) * i / CONFIG(specs.cylindersCount); ENGINE(ignitionPositionWithinEngineCycle[i]) = ENGINE(engineCycle) * i / CONFIG(specs.cylindersCount);
} }
prepareIgnitionPinIndices(CONFIG(ignitionMode) PASS_ENGINE_PARAMETER_SUFFIX); prepareIgnitionPinIndices(CONFIG(ignitionMode) PASS_ENGINE_PARAMETER_SUFFIX);