diff --git a/firmware/config/boards/hellen/hellen121nissan/board_configuration.cpp b/firmware/config/boards/hellen/hellen121nissan/board_configuration.cpp index 320d9fb05f..4fca14ff71 100644 --- a/firmware/config/boards/hellen/hellen121nissan/board_configuration.cpp +++ b/firmware/config/boards/hellen/hellen121nissan/board_configuration.cpp @@ -164,9 +164,7 @@ void setBoardDefaultConfiguration() { engineConfiguration->startUpFuelPumpDuration = 4; engineConfiguration->postCrankingFactor = 1.05; - engineConfiguration->etb.pFactor = 6.1350; - engineConfiguration->etb.iFactor = 87.7182; - engineConfiguration->etb.dFactor = 0.0702; + setEtbPID(6.1350, 87.7182, 0.0702); // this calibration reminds me of VAG just flipped? engineConfiguration->tpsMin = 100; diff --git a/firmware/config/boards/hellen/hellen154hyundai/board_configuration.cpp b/firmware/config/boards/hellen/hellen154hyundai/board_configuration.cpp index fa968e9df9..b6a3a32dac 100644 --- a/firmware/config/boards/hellen/hellen154hyundai/board_configuration.cpp +++ b/firmware/config/boards/hellen/hellen154hyundai/board_configuration.cpp @@ -194,9 +194,7 @@ void setBoardDefaultConfiguration() { engineConfiguration->useOnlyRisingEdgeForTrigger = true; setAlgorithm(LM_SPEED_DENSITY); - engineConfiguration->etb.pFactor = 8.8944; - engineConfiguration->etb.iFactor = 70.2307; - engineConfiguration->etb.dFactor = 0.1855; + setEtbPID(8.8944, 70.2307, 0.1855); engineConfiguration->injectorCompensationMode = ICM_FixedRailPressure; diff --git a/firmware/controllers/algo/defaults/default_base_engine.cpp b/firmware/controllers/algo/defaults/default_base_engine.cpp index 4fb068bbd9..7b70c2b634 100644 --- a/firmware/controllers/algo/defaults/default_base_engine.cpp +++ b/firmware/controllers/algo/defaults/default_base_engine.cpp @@ -121,3 +121,9 @@ void setPPSCalibration(float primaryUp, float primaryDown, float secondaryUp, fl engineConfiguration->throttlePedalSecondaryUpVoltage = secondaryUp; engineConfiguration->throttlePedalSecondaryWOTVoltage = secondaryDown; } + +void setEtbPID(float p, float i, float d) { + engineConfiguration->etb.pFactor = p; + engineConfiguration->etb.iFactor = i; + engineConfiguration->etb.dFactor = d; +} diff --git a/firmware/controllers/algo/defaults/defaults.h b/firmware/controllers/algo/defaults/defaults.h index e84d11a832..2562549a06 100644 --- a/firmware/controllers/algo/defaults/defaults.h +++ b/firmware/controllers/algo/defaults/defaults.h @@ -12,4 +12,6 @@ void setPPSInputs(adc_channel_e pps1, adc_channel_e pps2); void setPPSCalibration(float primaryUp, float primaryDown, float secondaryUp, float secondaryDown); void setTPS1Inputs(adc_channel_e tps1, adc_channel_e tps2); -void setTPS1Calibration(uint16_t tpsMin, uint16_t tpsMax, uint16_t tps1SecondaryMin, uint16_t tps1SecondaryMax); \ No newline at end of file +void setTPS1Calibration(uint16_t tpsMin, uint16_t tpsMax, uint16_t tps1SecondaryMin, uint16_t tps1SecondaryMax); + +void setEtbPID(float p, float i, float d); \ No newline at end of file