From 29e5a0babb63ba1d5a651d10859a38e38a6e72fa Mon Sep 17 00:00:00 2001 From: Matthew Kennedy Date: Wed, 29 Jun 2022 15:10:29 -0700 Subject: [PATCH] use detected hellen board type on h72 (#4305) * use detected hellen board type * s * s * name --- .../hellen/hellen154hyundai/board_configuration.cpp | 4 +--- .../boards/hellen/hellen72/board_configuration.cpp | 9 ++++++++- firmware/controllers/algo/engine_state.txt | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/firmware/config/boards/hellen/hellen154hyundai/board_configuration.cpp b/firmware/config/boards/hellen/hellen154hyundai/board_configuration.cpp index 96269b80ba..2b1eb66a08 100644 --- a/firmware/config/boards/hellen/hellen154hyundai/board_configuration.cpp +++ b/firmware/config/boards/hellen/hellen154hyundai/board_configuration.cpp @@ -94,8 +94,6 @@ static void setupDefaultSensorInputs() { engineConfiguration->auxTempSensor2.adcChannel = EFI_ADC_NONE; } -extern int hellenBoardId; - static bool isFirstInvocation = true; void setBoardConfigOverrides() { @@ -107,7 +105,7 @@ void setBoardConfigOverrides() { engineConfiguration->clt.config.bias_resistor = 4700; engineConfiguration->iat.config.bias_resistor = 4700; - if (hellenBoardId == 0) { + if (engine->engineState.hellenBoardId == 0) { // first revision of did not have Hellen Board ID // https://github.com/rusefi/hellen154hyundai/issues/55 engineConfiguration->etbIo[1].directionPin1 = Gpio::Unassigned; diff --git a/firmware/config/boards/hellen/hellen72/board_configuration.cpp b/firmware/config/boards/hellen/hellen72/board_configuration.cpp index 87772ba8e9..b6c7d45509 100644 --- a/firmware/config/boards/hellen/hellen72/board_configuration.cpp +++ b/firmware/config/boards/hellen/hellen72/board_configuration.cpp @@ -92,7 +92,14 @@ static void setupDefaultSensorInputs() { void setBoardConfigOverrides() { setHellen176LedPins(); setupVbatt(); - setHellenSdCardSpi3(); + + if (engine->engineState.hellenBoardId == 0) { + // Rev a-d use SPI3 for SD card + setHellenSdCardSpi3(); + } else { + // Revs E and later use SPI2 for SD card + setHellenSdCardSpi2(); + } engineConfiguration->etbIo[0].directionPin1 = Gpio::C7; // out_pwm3 engineConfiguration->etbIo[0].directionPin2 = Gpio::C8; // out_pwm4 diff --git a/firmware/controllers/algo/engine_state.txt b/firmware/controllers/algo/engine_state.txt index d1f58d2b5d..637aeeea70 100644 --- a/firmware/controllers/algo/engine_state.txt +++ b/firmware/controllers/algo/engine_state.txt @@ -81,7 +81,7 @@ running_fuel_s running int16_t autoscale timingIatCorrection;;"deg",{1/@@PACK_MULT_PERCENT@@}, 0, -20, 20, 2 int16_t autoscale timingPidCorrection;;"deg",{1/@@PACK_MULT_PERCENT@@}, 0, -20, 20, 2 - int16_t hellenBoardId;How does this board self identifies;"id", 1, 0, 0, 3000, 0 + int16_t hellenBoardId;Detected Board ID;"id", 1, 0, 0, 3000, 0 bit clutchUpState;@@INDICATOR_NAME_CLUTCH_UP@@ bit clutchDownState;@@INDICATOR_NAME_CLUTCH_DOWN@@