From 1b23f48b1425fac5c7eeb603f0619b2fa0e81990 Mon Sep 17 00:00:00 2001 From: rusefillc Date: Sat, 17 Feb 2024 14:52:18 -0500 Subject: [PATCH] SBC for uaEFI --- firmware/config/boards/board_id.cpp | 2 +- firmware/config/boards/hellen/uaefi/prepend.txt | 2 +- .../boards/proteus/board_configuration.cpp | 6 +++--- firmware/config/engines/gm_sbc.cpp | 16 +++++++++++++--- .../controllers/algo/engine_configuration.cpp | 5 +++-- firmware/controllers/algo/engine_types.h | 4 ++-- firmware/tunerstudio/rusefi.input | 13 +++++++++---- 7 files changed, 32 insertions(+), 16 deletions(-) diff --git a/firmware/config/boards/board_id.cpp b/firmware/config/boards/board_id.cpp index 81fb36fda2..08f1259893 100644 --- a/firmware/config/boards/board_id.cpp +++ b/firmware/config/boards/board_id.cpp @@ -21,7 +21,7 @@ board_id_t getBoardId() { // a way to test harness patch cord return STATIC_BOARD_ID_PROTEUS_HARLEY; } - if (engineConfiguration->engineType == engine_type_e::PROTEUS_SBC) { + if (engineConfiguration->engineType == engine_type_e::GM_SBC) { // a way to test harness patch cord return STATIC_BOARD_ID_PROTEUS_SBC; } diff --git a/firmware/config/boards/hellen/uaefi/prepend.txt b/firmware/config/boards/hellen/uaefi/prepend.txt index 9c9050d80c..ad0e2f9fba 100644 --- a/firmware/config/boards/hellen/uaefi/prepend.txt +++ b/firmware/config/boards/hellen/uaefi/prepend.txt @@ -23,4 +23,4 @@ -#define show_8chan_presets false +#define show_uaefi_presets true diff --git a/firmware/config/boards/proteus/board_configuration.cpp b/firmware/config/boards/proteus/board_configuration.cpp index 0bc30d461f..d82b4e34ec 100644 --- a/firmware/config/boards/proteus/board_configuration.cpp +++ b/firmware/config/boards/proteus/board_configuration.cpp @@ -238,7 +238,7 @@ int getBoardMetaLowSideOutputsCount() { if (engineConfiguration->engineType == engine_type_e::HARLEY) { return getBoardMetaOutputsCount(); } - if (engineConfiguration->engineType == engine_type_e::PROTEUS_SBC) { + if (engineConfiguration->engineType == engine_type_e::GM_SBC) { return getBoardMetaOutputsCount(); } return 16; @@ -289,7 +289,7 @@ int getBoardMetaOutputsCount() { if (engineConfiguration->engineType == engine_type_e::HARLEY) { return efi::size(PROTEUS_HARLEY_OUTPUTS); } - if (engineConfiguration->engineType == engine_type_e::PROTEUS_SBC) { + if (engineConfiguration->engineType == engine_type_e::GM_SBC) { return efi::size(PROTEUS_SBC_OUTPUTS); } return efi::size(PROTEUS_OUTPUTS); @@ -313,7 +313,7 @@ Gpio* getBoardMetaOutputs() { if (engineConfiguration->engineType == engine_type_e::HARLEY) { return PROTEUS_HARLEY_OUTPUTS; } - if (engineConfiguration->engineType == engine_type_e::PROTEUS_SBC) { + if (engineConfiguration->engineType == engine_type_e::GM_SBC) { return PROTEUS_SBC_OUTPUTS; } return PROTEUS_OUTPUTS; diff --git a/firmware/config/engines/gm_sbc.cpp b/firmware/config/engines/gm_sbc.cpp index 76826a5581..84b7e5f5dd 100644 --- a/firmware/config/engines/gm_sbc.cpp +++ b/firmware/config/engines/gm_sbc.cpp @@ -16,9 +16,9 @@ void setStepperHw() { // for instance IWP069 engineConfiguration->injector.flow = 482.5; + setPPSInputs(EFI_ADC_NONE, EFI_ADC_NONE); -#if HW_HELLEN - setPPSInputs(EFI_ADC_NONE, EFI_ADC_NONE); +#if HW_HELLEN_8CHAN // using 8chan pinout for DC1: A26 (OUT_DC1+ AH pin "D") and A27 (OUT_DC1- AL pin "C") engineConfiguration->stepperDcIo[0].controlPin = Gpio::H144_GP_IO4; // DC1_PWM engineConfiguration->stepperDcIo[0].directionPin1 = Gpio::H144_GP_IO3; // DC1_DIR @@ -28,9 +28,19 @@ void setStepperHw() { engineConfiguration->stepperDcIo[1].controlPin = H144_UART1_TX; // DC2_PWM engineConfiguration->stepperDcIo[1].directionPin1 = H_SPI3_CS; // DC2_DIR engineConfiguration->stepperDcIo[1].directionPin2 = Gpio::Unassigned; -// open question if we need custom logic to handle shared disable pin? engineConfiguration->stepperDcIo[1].disablePin = Gpio::H144_GP_IO5; // ETB_DIS #endif // HW_HELLEN +#if HW_HELLEN_UAEFI + // TODO: all the copy-pasting here begs the question: "shall we rename etbIo to hBridgeIo and reuse for stepper"? + engineConfiguration->stepperDcIo[0].controlPin = Gpio::MM100_OUT_PWM3; + engineConfiguration->stepperDcIo[0].directionPin1 = Gpio::MM100_OUT_PWM4; + engineConfiguration->stepperDcIo[0].directionPin2 = Gpio::Unassigned; + engineConfiguration->stepperDcIo[0].disablePin = Gpio::MM100_SPI2_MISO; + engineConfiguration->stepperDcIo[1].controlPin = Gpio::MM100_OUT_PWM5; + engineConfiguration->stepperDcIo[1].directionPin1 = Gpio::MM100_SPI2_MOSI; + engineConfiguration->stepperDcIo[1].directionPin2 = Gpio::MM100_USB1ID; +#endif // HW_HELLEN_UAEFI + #if HW_PROTEUS // coil #1 - proteus pin 7 to AH pin "D" // PWM pin diff --git a/firmware/controllers/algo/engine_configuration.cpp b/firmware/controllers/algo/engine_configuration.cpp index c8ec362789..7965e90604 100644 --- a/firmware/controllers/algo/engine_configuration.cpp +++ b/firmware/controllers/algo/engine_configuration.cpp @@ -807,7 +807,7 @@ void resetConfigurationExt(configuration_callback_t boardCallback, engine_type_e case engine_type_e::PROTEUS_MIATA_NB2: setMiataNB2_Proteus(); break; - case engine_type_e::PROTEUS_SBC: + case engine_type_e::GM_SBC: setGmSbc(); break; #ifdef HARDWARE_CI @@ -854,7 +854,8 @@ void resetConfigurationExt(configuration_callback_t boardCallback, engine_type_e #endif // HW_HELLEN_4CHAN #if HW_HELLEN_8CHAN - case engine_type_e::ALPHAX_8CHAN_SBC: + case engine_type_e::UNUSED_97: + case engine_type_e::GM_SBC: setGmSbc(); break; #endif diff --git a/firmware/controllers/algo/engine_types.h b/firmware/controllers/algo/engine_types.h index db31cc5ce3..e77b5fe7cf 100644 --- a/firmware/controllers/algo/engine_types.h +++ b/firmware/controllers/algo/engine_types.h @@ -199,8 +199,8 @@ enum class engine_type_e : uint16_t { HELLEN_154_HYUNDAI_COUPE_BK2 = 95, WASTEGATE_PROTEUS_TEST = 96, - ALPHAX_8CHAN_SBC = 97, - PROTEUS_SBC = 98, + UNUSED_97 = 97, + GM_SBC = 98, /** * this configuration has as few pins configured as possible diff --git a/firmware/tunerstudio/rusefi.input b/firmware/tunerstudio/rusefi.input index 1650710fb3..a4584997d6 100644 --- a/firmware/tunerstudio/rusefi.input +++ b/firmware/tunerstudio/rusefi.input @@ -2252,14 +2252,17 @@ 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_HARLEY = "@@TS_IO_TEST_COMMAND_char@@@@ts_command_e_TS_SET_ENGINE_TYPE_16_hex@@@@engine_type_e_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_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_GM_SBC = "@@TS_IO_TEST_COMMAND_char@@@@ts_command_e_TS_SET_ENGINE_TYPE_16_hex@@@@engine_type_e_GM_SBC_16_hex@@"@@if_show_Proteus_presets +cmd_set_engine_type_GM_SBC = "@@TS_IO_TEST_COMMAND_char@@@@ts_command_e_TS_SET_ENGINE_TYPE_16_hex@@@@engine_type_e_GM_SBC_16_hex@@"@@if_show_8chan_presets +cmd_set_engine_type_GM_SBC = "@@TS_IO_TEST_COMMAND_char@@@@ts_command_e_TS_SET_ENGINE_TYPE_16_hex@@@@engine_type_e_GM_SBC_16_hex@@"@@if_show_uaefi_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_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 @@ -4539,7 +4542,7 @@ dialog = tcuControls, "Transmission Settings" 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 commandButton = "Proteus GM Gen4", cmd_set_engine_type_PROTEUS_GM_LS_4@@if_show_Proteus_presets - commandButton = "Proteus SBC", cmd_set_engine_type_PROTEUS_SBC@@if_show_Proteus_presets + commandButton = "Proteus SBC", cmd_set_engine_type_GM_SBC@@if_show_Proteus_presets ; commandButton = "Proteus Miata TCU", cmd_set_engine_type_Proteus_Miata_TCU@@if_show_Proteus_presets commandButton = "Proteus Lua Demo", cmd_set_engine_type_PROTEUS_LUA_DEMO@@if_show_Proteus_presets commandButton = "Proteus Miata NB2", cmd_set_engine_type_PROTEUS_MIATA_NB2@@if_show_Proteus_presets @@ -4548,7 +4551,9 @@ dialog = tcuControls, "Transmission Settings" commandButton = "Proteus Harley", cmd_set_engine_type_HARLEY@@if_show_Proteus_presets commandButton = "Fuel Bench", cmd_set_engine_type_FUEL_BENCH - commandButton = "SBC", cmd_set_engine_type_ALPHAX_8CHAN_SBC@@if_show_8chan_presets + commandButton = "Small Block Chevy", cmd_set_engine_type_GM_SBC@@if_show_uaefi_presets + + commandButton = "SBC", cmd_set_engine_type_GM_SBC@@if_show_8chan_presets commandButton = "Honda BCM", cmd_set_engine_type_SMALL_CB_HONDA_BCM@@if_show_small_can_board_presets commandButton = "Hellen NA6", cmd_set_engine_type_hellen_NA6@@if_show_HellenNA6_presets