diff --git a/firmware/config/boards/subaru_eg33/board.mk b/firmware/config/boards/subaru_eg33/board.mk index 58124facc6..e8e31447cd 100644 --- a/firmware/config/boards/subaru_eg33/board.mk +++ b/firmware/config/boards/subaru_eg33/board.mk @@ -14,14 +14,13 @@ ifeq ($(USE_BOOTLOADER),yes) endif #LED -LED_CRITICAL_ERROR_BRAIN_PIN = -DLED_CRITICAL_ERROR_BRAIN_PIN=GPIOG_7 +DDEFS += -DLED_CRITICAL_ERROR_BRAIN_PIN=GPIOG_7 # We are running on Subaru EG33 hardware! DDEFS += -DHW_SUBARU_EG33=1 # Override DEFAULT_ENGINE_TYPE -# Fix -DDEFS += -DDEFAULT_ENGINE_TYPE=SUBARUEG33_DEFAULTS -DSTM32F765xx $(LED_CRITICAL_ERROR_BRAIN_PIN) +DDEFS += -DDEFAULT_ENGINE_TYPE=SUBARUEG33_DEFAULTS #Some options override DDEFS += -DHAL_TRIGGER_USE_PAL=TRUE diff --git a/firmware/config/boards/subaru_eg33/board_configuration.cpp b/firmware/config/boards/subaru_eg33/board_configuration.cpp index b10f574eed..0acd5c4d7c 100644 --- a/firmware/config/boards/subaru_eg33/board_configuration.cpp +++ b/firmware/config/boards/subaru_eg33/board_configuration.cpp @@ -50,8 +50,9 @@ void setBoardDefaultConfiguration(void) { engineConfiguration->vbattAdcChannel = EFI_ADC_6; /* Throttle position */ engineConfiguration->tps1_1AdcChannel = EFI_ADC_12; - /* MAP */ - engineConfiguration->map.sensor.hwChannel = EFI_ADC_10; + /* MAP: stock car dows not have MAP + * but EFI_ADC_10 is reserved for this purpose */ + engineConfiguration->map.sensor.hwChannel = EFI_ADC_NONE; /* MAF */ engineConfiguration->mafAdcChannel = EFI_ADC_3; /* coolant t */ @@ -118,13 +119,13 @@ void setBoardDefaultConfiguration(void) { /* MC33972 */ engineConfiguration->mc33972spiDevice = SPI_DEVICE_4; engineConfiguration->mc33972_cs = GPIOE_10; /* SPI4_NSS2 */ - engineConfiguration->mc33972_csPinMode = OM_OPENDRAIN; + engineConfiguration->mc33972_csPinMode = OM_DEFAULT; /* TLE6240 - OUT3, also PG2 */ engineConfiguration->tachOutputPin = TLE6240_PIN_2; engineConfiguration->tachOutputPinMode = OM_DEFAULT; /* spi driven - TLE6240 - OUT5 */ -#if 0 +#if 1 engineConfiguration->fuelPumpPin = TLE6240_PIN_5; engineConfiguration->fuelPumpPinMode = OM_DEFAULT; /* self shutdown? */ diff --git a/firmware/config/engines/subaru.cpp b/firmware/config/engines/subaru.cpp index 5be575fa53..25fce83a58 100644 --- a/firmware/config/engines/subaru.cpp +++ b/firmware/config/engines/subaru.cpp @@ -10,6 +10,7 @@ #include "subaru.h" #include "custom_engine.h" +#include "allsensors.h" EXTERN_CONFIG; @@ -81,9 +82,7 @@ void setSubaruEG33Defaults(DECLARE_ENGINE_PARAMETER_SIGNATURE) { /* TODO: */ engineConfiguration->globalTriggerAngleOffset = 114; // the end of 19th tooth? - /* TODO: */ - //engineConfiguration->fuelAlgorithm = LM_REAL_MAF; - engineConfiguration->fuelAlgorithm = LM_ALPHA_N; + engineConfiguration->fuelAlgorithm = LM_REAL_MAF; engineConfiguration->specs.displacement = 3.30; engineConfiguration->injector.flow = 250; @@ -101,10 +100,9 @@ void setSubaruEG33Defaults(DECLARE_ENGINE_PARAMETER_SIGNATURE) { engineConfiguration->canReadEnabled = true; engineConfiguration->canWriteEnabled = false; - /* TODO: */ - //engineConfiguration->tpsMin = convertVoltageTo10bitADC(0.250); - //engineConfiguration->tpsMax = convertVoltageTo10bitADC(4.538); - //engineConfiguration->tpsMax = convertVoltageTo10bitADC(5.000); + /* Reversed: fully closed - 4.7V, fully opened - 0.9 */ + engineConfiguration->tpsMin = convertVoltageTo10bitADC(4.7); + engineConfiguration->tpsMax = convertVoltageTo10bitADC(0.9); engineConfiguration->tpsErrorDetectionTooLow = -10; // -10% open engineConfiguration->tpsErrorDetectionTooHigh = 110; // 110% open diff --git a/firmware/hw_layer/ports/stm32/stm32f7/STM32F76xxI.ld b/firmware/hw_layer/ports/stm32/stm32f7/STM32F76xxI.ld index 982cdf7fa8..c404b00922 100644 --- a/firmware/hw_layer/ports/stm32/stm32f7/STM32F76xxI.ld +++ b/firmware/hw_layer/ports/stm32/stm32f7/STM32F76xxI.ld @@ -73,11 +73,11 @@ REGION_ALIAS("RAM_INIT_FLASH_LMA", flash0); /* RAM region to be used for Main stack. This stack accommodates the processing of all exceptions and interrupts.*/ -REGION_ALIAS("MAIN_STACK_RAM", ram3); +REGION_ALIAS("MAIN_STACK_RAM", ram0); /* RAM region to be used for the process stack. This is the stack used by the main() function.*/ -REGION_ALIAS("PROCESS_STACK_RAM", ram3); +REGION_ALIAS("PROCESS_STACK_RAM", ram0); /* RAM region to be used for data segment.*/ REGION_ALIAS("DATA_RAM", ram0);