From f88187c826e088a6ada3dbecef1107bee1bb2b24 Mon Sep 17 00:00:00 2001 From: rusefillc Date: Sat, 29 Oct 2022 23:38:22 -0400 Subject: [PATCH] refactoring: helper method --- .../hellen/harley81/board_configuration.cpp | 16 ++-------------- .../hellen/hellen-gm-e67/board_configuration.cpp | 5 ++--- .../hellen/hellen121vag/board_configuration.cpp | 1 - .../hellen154hyundai/board_configuration.cpp | 5 ++--- .../hellen154hyundai/compile_hellen154hyundai.sh | 0 firmware/config/engines/vw_b6.cpp | 7 +++---- 6 files changed, 9 insertions(+), 25 deletions(-) mode change 100644 => 100755 firmware/config/boards/hellen/hellen154hyundai/compile_hellen154hyundai.sh diff --git a/firmware/config/boards/hellen/harley81/board_configuration.cpp b/firmware/config/boards/hellen/harley81/board_configuration.cpp index d8f2d57bb0..f1616efbba 100644 --- a/firmware/config/boards/hellen/harley81/board_configuration.cpp +++ b/firmware/config/boards/hellen/harley81/board_configuration.cpp @@ -13,12 +13,9 @@ #include "pch.h" #include "custom_engine.h" #include "hellen_meta.h" +#include "defaults.h" static OutputPin alphaEn; -static OutputPin alphaTachPullUp; -static OutputPin alphaTempPullUp; -static OutputPin alphaCrankPPullUp; -static OutputPin alphaCrankNPullUp; static void setInjectorPins() { engineConfiguration->injectionPins[0] = H144_LS_1; @@ -98,8 +95,7 @@ static void setupDefaultSensorInputs() { engineConfiguration->tps1_2AdcChannel = H144_IN_O2S2; engineConfiguration->tps2_1AdcChannel = EFI_ADC_NONE; - engineConfiguration->throttlePedalPositionAdcChannel = H144_IN_PPS; - engineConfiguration->throttlePedalPositionSecondAdcChannel = H144_IN_AUX1; + setPPSInputs(H144_IN_PPS, H144_IN_AUX1); engineConfiguration->mafAdcChannel = H144_IN_MAP1; engineConfiguration->map.sensor.hwChannel = H144_IN_MAP2; @@ -120,18 +116,10 @@ void boardInitHardware() { alphaEn.initPin("a-EN", H144_OUT_IO3); alphaEn.setValue(1); -// alphaTachPullUp.initPin("a-tach", H144_OUT_IO1); -// alphaTempPullUp.initPin("a-temp", H144_OUT_IO4); -// alphaCrankPPullUp.initPin("a-crank-p", H144_OUT_IO2); -// alphaCrankNPullUp.initPin("a-crank-n", H144_OUT_IO5); boardOnConfigurationChange(nullptr); } void boardOnConfigurationChange(engine_configuration_s * /*previousConfiguration*/) { - alphaTachPullUp.setValue(engineConfiguration->boardUseTachPullUp); - alphaTempPullUp.setValue(engineConfiguration->boardUseTempPullUp); - alphaCrankPPullUp.setValue(engineConfiguration->boardUseCrankPullUp); - alphaCrankNPullUp.setValue(engineConfiguration->boardUseCrankPullUp); } void setBoardConfigOverrides() { diff --git a/firmware/config/boards/hellen/hellen-gm-e67/board_configuration.cpp b/firmware/config/boards/hellen/hellen-gm-e67/board_configuration.cpp index e46636ff6d..7bc7b90dbe 100644 --- a/firmware/config/boards/hellen/hellen-gm-e67/board_configuration.cpp +++ b/firmware/config/boards/hellen/hellen-gm-e67/board_configuration.cpp @@ -11,9 +11,9 @@ */ #include "pch.h" -#include "custom_engine.h" #include "hellen_meta.h" #include "gm_ls_4.h" +#include "defaults.h" static void setInjectorPins() { engineConfiguration->injectionPins[0] = H144_LS_1; @@ -80,8 +80,7 @@ static void setupDefaultSensorInputs() { engineConfiguration->tps1_2AdcChannel = H144_IN_AUX1; engineConfiguration->tps2_1AdcChannel = EFI_ADC_NONE; - engineConfiguration->throttlePedalPositionAdcChannel = H144_IN_PPS; - engineConfiguration->throttlePedalPositionSecondAdcChannel = H144_IN_AUX2; + setPPSInputs(H144_IN_PPS, H144_IN_AUX2); engineConfiguration->mafAdcChannel = EFI_ADC_10; engineConfiguration->map.sensor.hwChannel = EFI_ADC_11; diff --git a/firmware/config/boards/hellen/hellen121vag/board_configuration.cpp b/firmware/config/boards/hellen/hellen121vag/board_configuration.cpp index 404383dd9c..467e11c8ce 100644 --- a/firmware/config/boards/hellen/hellen121vag/board_configuration.cpp +++ b/firmware/config/boards/hellen/hellen121vag/board_configuration.cpp @@ -11,7 +11,6 @@ */ #include "pch.h" -#include "custom_engine.h" #include "electronic_throttle_impl.h" #include "hellen_meta.h" #include "defaults.h" diff --git a/firmware/config/boards/hellen/hellen154hyundai/board_configuration.cpp b/firmware/config/boards/hellen/hellen154hyundai/board_configuration.cpp index 26df261e38..8a9a6a4ff7 100644 --- a/firmware/config/boards/hellen/hellen154hyundai/board_configuration.cpp +++ b/firmware/config/boards/hellen/hellen154hyundai/board_configuration.cpp @@ -11,7 +11,7 @@ */ #include "pch.h" -#include "custom_engine.h" +#include "defaults.h" #include "hellen_meta.h" static void setInjectorPins() { @@ -72,8 +72,7 @@ static void setupDefaultSensorInputs() { engineConfiguration->throttlePedalSecondaryUpVoltage = 0.34; engineConfiguration->throttlePedalSecondaryWOTVoltage = 1.86; - engineConfiguration->throttlePedalPositionAdcChannel = EFI_ADC_3; - engineConfiguration->throttlePedalPositionSecondAdcChannel = EFI_ADC_14; + setPPSInputs(EFI_ADC_3, EFI_ADC_14); engineConfiguration->mafAdcChannel = EFI_ADC_NONE; engineConfiguration->map.sensor.hwChannel = H144_IN_MAP1; diff --git a/firmware/config/boards/hellen/hellen154hyundai/compile_hellen154hyundai.sh b/firmware/config/boards/hellen/hellen154hyundai/compile_hellen154hyundai.sh old mode 100644 new mode 100755 diff --git a/firmware/config/engines/vw_b6.cpp b/firmware/config/engines/vw_b6.cpp index 4b655a9e5e..cf847e4fdd 100644 --- a/firmware/config/engines/vw_b6.cpp +++ b/firmware/config/engines/vw_b6.cpp @@ -12,6 +12,7 @@ #include "table_helper.h" #include "electronic_throttle_impl.h" #include "mre_meta.h" +#include "defaults.h" #include "proteus_meta.h" static void commonPassatB6() { @@ -197,8 +198,7 @@ void setProteusVwPassatB6() { engineConfiguration->tps1_2AdcChannel = PROTEUS_IN_TPS1_2; - engineConfiguration->throttlePedalPositionAdcChannel = PROTEUS_IN_ANALOG_VOLT_9; - engineConfiguration->throttlePedalPositionSecondAdcChannel = PROTEUS_IN_PPS2; + setPPSInputs(PROTEUS_IN_ANALOG_VOLT_9, PROTEUS_IN_PPS2); strncpy(config->luaScript, R"( AIRBAG = 0x050 @@ -380,9 +380,8 @@ void setMreVwPassatB6() { // EFI_ADC_7: "31 - AN volt 3" - PA7 - engineConfiguration->throttlePedalPositionAdcChannel = MRE_IN_ANALOG_VOLT_3; // 36 - AN volt 8 - engineConfiguration->throttlePedalPositionSecondAdcChannel = MRE_IN_ANALOG_VOLT_8; + setPPSInputs(MRE_IN_ANALOG_VOLT_3, MRE_IN_ANALOG_VOLT_8); // "26 - AN volt 2" engineConfiguration->highPressureFuel.hwChannel = MRE_IN_ANALOG_VOLT_2;