From abffeb1ca277e5695fdcaeed28e15e15b8dfcb16 Mon Sep 17 00:00:00 2001 From: Andrey Date: Thu, 14 Sep 2023 10:34:30 -0400 Subject: [PATCH] Hyundai PB --- firmware/config/engines/hyundai.cpp | 26 +++++++++---------- firmware/config/engines/hyundai.h | 2 +- .../controllers/algo/engine_configuration.cpp | 10 ++++--- firmware/controllers/algo/engine_types.h | 3 ++- firmware/tunerstudio/rusefi.input | 12 ++++++--- 5 files changed, 31 insertions(+), 22 deletions(-) diff --git a/firmware/config/engines/hyundai.cpp b/firmware/config/engines/hyundai.cpp index 2a4ad9a1ed..60a025ddcc 100644 --- a/firmware/config/engines/hyundai.cpp +++ b/firmware/config/engines/hyundai.cpp @@ -92,6 +92,18 @@ void setHyundaiPb() { engineConfiguration->hpfpValvePin = Gpio::PROTEUS_LS_6; engineConfiguration->vvtPins[0] = Gpio::PROTEUS_LS_15; // intake engineConfiguration->vvtPins[1] = Gpio::PROTEUS_LS_16; // exhaust + + + engineConfiguration->triggerInputPins[0] = PROTEUS_VR_1; + engineConfiguration->camInputs[0] = PROTEUS_DIGITAL_1; + engineConfiguration->camInputs[1] = PROTEUS_DIGITAL_2; // currently intake, TODO: flip! + + setProteusEtbIO(); + +// something something input levels are not happy for digital input pin? + engineConfiguration->starterControlPin = Gpio::PROTEUS_LS_14; + engineConfiguration->startStopButtonPin = PROTEUS_IN_AV_6_DIGITAL; + engineConfiguration->startStopButtonMode = PI_DEFAULT; #endif // HW_PROTEUS #if HW_PROTEUS @@ -201,20 +213,6 @@ end } -void setProteusHyundaiPb() { - setHyundaiPb(); - engineConfiguration->triggerInputPins[0] = PROTEUS_VR_1; - engineConfiguration->camInputs[0] = PROTEUS_DIGITAL_1; - engineConfiguration->camInputs[1] = PROTEUS_DIGITAL_2; // currently intake, TODO: flip! - - setProteusEtbIO(); - -// something something input levels are not happy for digital input pin? - engineConfiguration->starterControlPin = Gpio::PROTEUS_LS_14; - engineConfiguration->startStopButtonPin = PROTEUS_IN_AV_6_DIGITAL; - engineConfiguration->startStopButtonMode = PI_DEFAULT; -} - static void commonGenesisCoupe() { set201xHyundai(); diff --git a/firmware/config/engines/hyundai.h b/firmware/config/engines/hyundai.h index 299c913233..e78370575f 100644 --- a/firmware/config/engines/hyundai.h +++ b/firmware/config/engines/hyundai.h @@ -10,4 +10,4 @@ void setGenesisCoupeBK1(); void setGenesisCoupeBK2(); -void setProteusHyundaiPb(); +void setHyundaiPb(); diff --git a/firmware/controllers/algo/engine_configuration.cpp b/firmware/controllers/algo/engine_configuration.cpp index 91366eea05..9d461f28f3 100644 --- a/firmware/controllers/algo/engine_configuration.cpp +++ b/firmware/controllers/algo/engine_configuration.cpp @@ -738,6 +738,13 @@ void resetConfigurationExt(configuration_callback_t boardCallback, engine_type_e case engine_type_e::FUEL_BENCH: fuelBenchMode(); break; + +#if HW_PROTEUS || HW_HELLEN_4CHAN || HW_HELLEN_8CHAN + case engine_type_e::HYUNDAI_PB: + setHyundaiPb(); + break; +#endif + #if HW_PROTEUS case engine_type_e::ME17_9_MISC: setSlingshot(); @@ -748,9 +755,6 @@ void resetConfigurationExt(configuration_callback_t boardCallback, engine_type_e case engine_type_e::WASTEGATE_PROTEUS_TEST: proteusDcWastegateTest(); break; - case engine_type_e::PROTEUS_HYUNDAI_PB: - setProteusHyundaiPb(); - break; case engine_type_e::PROTEUS_NISSAN_VQ35: setProteusNissanVQ(); break; diff --git a/firmware/controllers/algo/engine_types.h b/firmware/controllers/algo/engine_types.h index b2f33e4be2..310cb88cde 100644 --- a/firmware/controllers/algo/engine_types.h +++ b/firmware/controllers/algo/engine_types.h @@ -231,7 +231,8 @@ enum class engine_type_e : uint16_t { PROTEUS_NISSAN_VQ35 = 103, - PROTEUS_HYUNDAI_PB = 104, + // both Proteus and 4chan/8chan + HYUNDAI_PB = 104, }; /** diff --git a/firmware/tunerstudio/rusefi.input b/firmware/tunerstudio/rusefi.input index 3f91c9f146..ca06bff2a8 100644 --- a/firmware/tunerstudio/rusefi.input +++ b/firmware/tunerstudio/rusefi.input @@ -2193,11 +2193,14 @@ cmd_set_engine_type_Proteus_Miata_TCU = "@@TS_IO_TEST_COMMAND_char@@@@ts_comm cmd_set_engine_type_PROTEUS_LUA_DEMO = "@@TS_IO_TEST_COMMAND_char@@@@ts_command_e_TS_SET_ENGINE_TYPE_16_hex@@@@engine_type_e_PROTEUS_LUA_DEMO_16_hex@@"@@if_show_Proteus_presets cmd_set_engine_type_PROTEUS_HARLEY = "@@TS_IO_TEST_COMMAND_char@@@@ts_command_e_TS_SET_ENGINE_TYPE_16_hex@@@@engine_type_e_PROTEUS_HARLEY_16_hex@@"@@if_show_Proteus_presets cmd_set_engine_type_PROTEUS_NISSAN_VQ35 = "@@TS_IO_TEST_COMMAND_char@@@@ts_command_e_TS_SET_ENGINE_TYPE_16_hex@@@@engine_type_e_PROTEUS_NISSAN_VQ35_16_hex@@"@@if_show_Proteus_presets -cmd_set_engine_type_PROTEUS_HYUNDAI_PB = "@@TS_IO_TEST_COMMAND_char@@@@ts_command_e_TS_SET_ENGINE_TYPE_16_hex@@@@engine_type_e_PROTEUS_HYUNDAI_PB_16_hex@@"@@if_show_Proteus_presets cmd_set_engine_type_PROTEUS_SBC = "@@TS_IO_TEST_COMMAND_char@@@@ts_command_e_TS_SET_ENGINE_TYPE_16_hex@@@@engine_type_e_PROTEUS_SBC_16_hex@@"@@if_show_Proteus_presets cmd_set_engine_type_PROTEUS_M111 = "@@TS_IO_TEST_COMMAND_char@@@@ts_command_e_TS_SET_ENGINE_TYPE_16_hex@@@@engine_type_e_PROTEUS_M111_16_hex@@"@@if_show_Proteus_presets -cmd_set_engine_type_ALPHAX_8CHAN_SBC = "@@TS_IO_TEST_COMMAND_char@@@@ts_command_e_TS_SET_ENGINE_TYPE_16_hex@@@@engine_type_e_ALPHAX_8CHAN_SBC_16_hex@@" +cmd_set_engine_type_HYUNDAI_PB = "@@TS_IO_TEST_COMMAND_char@@@@ts_command_e_TS_SET_ENGINE_TYPE_16_hex@@@@engine_type_e_HYUNDAI_PB_16_hex@@"@@if_show_Proteus_presets +cmd_set_engine_type_HYUNDAI_PB = "@@TS_IO_TEST_COMMAND_char@@@@ts_command_e_TS_SET_ENGINE_TYPE_16_hex@@@@engine_type_e_HYUNDAI_PB_16_hex@@"@@if_show_4chan_presets +cmd_set_engine_type_HYUNDAI_PB = "@@TS_IO_TEST_COMMAND_char@@@@ts_command_e_TS_SET_ENGINE_TYPE_16_hex@@@@engine_type_e_HYUNDAI_PB_16_hex@@"@@if_show_8chan_presets + +cmd_set_engine_type_ALPHAX_8CHAN_SBC = "@@TS_IO_TEST_COMMAND_char@@@@ts_command_e_TS_SET_ENGINE_TYPE_16_hex@@@@engine_type_e_ALPHAX_8CHAN_SBC_16_hex@@"@@if_show_8chan_presets cmd_set_engine_type_SMALL_CB_HONDA_BCM = "@@TS_IO_TEST_COMMAND_char@@@@ts_command_e_TS_SET_ENGINE_TYPE_16_hex@@@@engine_type_e_HELLEN_HONDA_BCM_16_hex@@"@@if_show_small_can_board_presets @@ -4344,8 +4347,11 @@ dialog = tcuControls, "Transmission Settings" commandButton = "microRusEFI Subaru EJ18", cmd_set_engine_type_MRE_SUBARU_EJ18@@if_show_microRusEFI_presets commandButton = "microRusEFI CAN Extender", cmd_set_engine_type_MRE_SECONDARY_CAN@@if_show_microRusEFI_presets + commandButton = "Hyundai PB", cmd_set_engine_type_PROTEUS_HYUNDAI_PB@@if_show_Proteus_presets + commandButton = "Hyundai PB", cmd_set_engine_type_PROTEUS_HYUNDAI_PB@@if_show_4chan_presets + commandButton = "Hyundai PB", cmd_set_engine_type_PROTEUS_HYUNDAI_PB@@if_show_8chan_presets + commandButton = "Proteus Nissan VQ", cmd_set_engine_type_PROTEUS_NISSAN_VQ35@@if_show_Proteus_presets - commandButton = "Proteus Hyundai PB", cmd_set_engine_type_PROTEUS_HYUNDAI_PB@@if_show_Proteus_presets commandButton = "Proteus M111", cmd_set_engine_type_PROTEUS_M111@@if_show_Proteus_presets commandButton = "Proteus M73 v12", cmd_set_engine_type_Proteus_M73@@if_show_Proteus_presets commandButton = "Proteus GDI VAG B6 test", cmd_set_engine_type_PROTEUS_VW_B6@@if_show_Proteus_presets