diff --git a/firmware/config/boards/proteus/board.mk b/firmware/config/boards/proteus/board.mk index b849cc4150..a8c51c7ff0 100644 --- a/firmware/config/boards/proteus/board.mk +++ b/firmware/config/boards/proteus/board.mk @@ -18,10 +18,13 @@ else BOARDINC += $(PROJECT_DIR)/config/stm32f7ems # efifeatures/halconf/chconf.h LDSCRIPT= $(BOARDS_DIR)/nucleo_f767/STM32F76xxI.ld CONFDIR=config/stm32f4ems + PROTEUS_LEGACY=TRUE endif - - - # Override DEFAULT_ENGINE_TYPE -DDEFS += $(MCU_DEFS) -DEFI_USE_OSC=TRUE -DEFI_FATAL_ERROR_PIN=GPIOE_3 -DFIRMWARE_ID=\"proteus\" -DDEFAULT_ENGINE_TYPE=PROTEUS -DUSE_ADC3_VBATT_HACK -DSTM32_ADC_USE_ADC3=TRUE -DEFI_INCLUDE_ENGINE_PRESETS=FALSE -DEFI_ICU_INPUTS=FALSE -DHAL_TRIGGER_USE_PAL=TRUE -DEFI_VEHICLE_SPEED=FALSE -DEFI_LOGIC_ANALYZER=FALSE +DDEFS += $(MCU_DEFS) -DEFI_USE_OSC=TRUE -DEFI_FATAL_ERROR_PIN=GPIOE_3 -DFIRMWARE_ID=\"proteus\" -DDEFAULT_ENGINE_TYPE=PROTEUS -DSTM32_ADC_USE_ADC3=TRUE -DEFI_INCLUDE_ENGINE_PRESETS=FALSE -DEFI_ICU_INPUTS=FALSE -DHAL_TRIGGER_USE_PAL=TRUE -DEFI_VEHICLE_SPEED=FALSE -DEFI_LOGIC_ANALYZER=FALSE + +# Proteus <=v0.2 needs ADC hack - vbatt is on ADC3 +ifeq ($(PROTEUS_LEGACY),TRUE) + DDEFS += -DUSE_ADC3_VBATT_HACK +endif diff --git a/firmware/config/boards/proteus/board_configuration.cpp b/firmware/config/boards/proteus/board_configuration.cpp index ea9708dcee..ef97f66b8b 100644 --- a/firmware/config/boards/proteus/board_configuration.cpp +++ b/firmware/config/boards/proteus/board_configuration.cpp @@ -78,7 +78,9 @@ static void setupVbatt() { // 82k high side/10k low side = 9.2 engineConfiguration->vbattDividerCoeff = (92.0f / 10.0f); - //engineConfiguration->vbattAdcChannel = TODO; + + // Battery sense on PA7 + engineConfiguration->vbattAdcChannel = EFI_ADC_7; engineConfiguration->adcVcc = 3.3f; } diff --git a/firmware/config/boards/proteus/mapping.yaml b/firmware/config/boards/proteus/mapping.yaml index 212eef7031..ff9c6b33b7 100644 --- a/firmware/config/boards/proteus/mapping.yaml +++ b/firmware/config/boards/proteus/mapping.yaml @@ -73,7 +73,7 @@ analog_inputs: # PA6 - pin #18 EFI_ADC_6: "Analog Volt 11" # PA7 - EFI_ADC_7: "Analog Volt 12" + EFI_ADC_7: "Battery Sense" # CLT = Analog Temp 3 = PB0 EFI_ADC_8: "Analog Temp 3" # PB1