refactoring: extracting useful method

This commit is contained in:
rusefi 2022-10-25 21:54:26 -04:00
parent 048c8ddd92
commit a74fc3c3c2
4 changed files with 13 additions and 8 deletions

View File

@ -207,14 +207,6 @@ void setBoardDefaultConfiguration() {
engineConfiguration->knockBankCyl5 = 0;
engineConfiguration->knockBankCyl6 = 1;
/* Cylinder to bank mapping */
engineConfiguration->cylinderBankSelect[1 - 1] = 0;
engineConfiguration->cylinderBankSelect[2 - 1] = 1;
engineConfiguration->cylinderBankSelect[3 - 1] = 0;
engineConfiguration->cylinderBankSelect[4 - 1] = 1;
engineConfiguration->cylinderBankSelect[5 - 1] = 0;
engineConfiguration->cylinderBankSelect[6 - 1] = 1;
/* Misc settings */
engineConfiguration->acSwitch = Gpio::MC33972_PIN_22;
engineConfiguration->acSwitchMode = PI_DEFAULT;

View File

@ -12,6 +12,7 @@
#include "subaru.h"
#include "custom_engine.h"
#include "defaults.h"
void setSubaru2003Wrx() {
setFrankenso_01_LCD(engineConfiguration);
@ -71,6 +72,7 @@ void setSubaruEG33Defaults() {
engineConfiguration->useOnlyRisingEdgeForTrigger = true;
engineConfiguration->specs.cylindersCount = 6;
setLeftRightBanksNeedBetterName();
engineConfiguration->specs.firingOrder = FO_1_6_3_2_5_4;
engineConfiguration->ignitionMode = IM_INDIVIDUAL_COILS;

View File

@ -13,6 +13,13 @@ static void setDefaultAlternatorParameters() {
engineConfiguration->alternatorControl.periodMs = 100;
}
/* Cylinder to bank mapping */
void setLeftRightBanksNeedBetterName() {
for (int i = 0;i<engineConfiguration->specs.cylindersCount;i++) {
engineConfiguration->cylinderBankSelect[i] = i % 2;
}
}
void setDefaultBaseEngine() {
// Base Engine Settings
engineConfiguration->specs.cylindersCount = 4;

View File

@ -1,4 +1,8 @@
/**
* file defaults.h
*/
void setLeftRightBanksNeedBetterName();
void setDefaultBaseEngine();
void setDefaultFuel();
void setDefaultIgnition();