diff --git a/firmware/config/boards/proteus/board.mk b/firmware/config/boards/proteus/board.mk index a07170d7dd..165d5735a1 100644 --- a/firmware/config/boards/proteus/board.mk +++ b/firmware/config/boards/proteus/board.mk @@ -29,9 +29,7 @@ ifneq ($(PROJECT_CPU),ARCH_STM32H7) endif # disable hardware serial ports on H7 -ifeq ($(PROJECT_CPU),ARCH_STM32H7) - DDEFS += -DTS_NO_PRIMARY -DTS_NO_SECONDARY -else +ifeq ($(PROJECT_CPU),ARCH_STM32F4) # Hardware serial port on UART 2 -> PD5/PD6 DDEFS += -DSTM32_UART_USE_USART2=TRUE DDEFS += -DTS_PRIMARY_UART=UARTD2 diff --git a/firmware/config/stm32f7ems/efifeatures.h b/firmware/config/stm32f7ems/efifeatures.h index 014d17f026..7c6de5bc3c 100644 --- a/firmware/config/stm32f7ems/efifeatures.h +++ b/firmware/config/stm32f7ems/efifeatures.h @@ -36,10 +36,9 @@ #undef EFI_USE_UART_DMA #define EFI_USE_UART_DMA FALSE -#undef TS_PRIMARY_UART -#undef TS_SECONDARY_UART -#undef TS_PRIMARY_SERIAL -#undef TS_SECONDARY_SERIAL +// UART driver not implemented on F7 +#define TS_NO_PRIMARY +#define TS_NO_SECONDARY #define AUX_SERIAL_DEVICE (&SD6) diff --git a/firmware/console/binary/tunerstudio_io.h b/firmware/console/binary/tunerstudio_io.h index 19ec0a2a91..66a14b09c9 100644 --- a/firmware/console/binary/tunerstudio_io.h +++ b/firmware/console/binary/tunerstudio_io.h @@ -9,6 +9,18 @@ #pragma once #include "global.h" +#if (!defined(TS_NO_PRIMARY) && (defined(TS_PRIMARY_UART) || defined(TS_PRIMARY_SERIAL))) + #define HAS_PRIMARY true +#else + #define HAS_PRIMARY false +#endif + +#if (!defined(TS_NO_SECONDARY) && (defined(TS_SECONDARY_UART) || defined(TS_SECONDARY_SERIAL))) + #define HAS_SECONDARY true +#else + #define HAS_SECONDARY false +#endif + #if EFI_USB_SERIAL #include "usbconsole.h" #endif // EFI_USB_SERIAL diff --git a/firmware/console/binary/tunerstudio_io_serial.cpp b/firmware/console/binary/tunerstudio_io_serial.cpp index 482ea74821..d90e52aace 100644 --- a/firmware/console/binary/tunerstudio_io_serial.cpp +++ b/firmware/console/binary/tunerstudio_io_serial.cpp @@ -4,6 +4,7 @@ #include "tunerstudio_io.h" +#if HAS_PRIMARY || HAS_PRIMARY #if HAL_USE_SERIAL void SerialTsChannel::start(uint32_t baud) { SerialConfig cfg = { @@ -64,3 +65,4 @@ size_t UartTsChannel::readTimeout(uint8_t* buffer, size_t size, int timeout) { return size; } #endif // HAL_USE_UART +#endif // HAS_PRIMARY || HAS_PRIMARY diff --git a/firmware/console/binary/tunerstudio_io_serial_ports.cpp b/firmware/console/binary/tunerstudio_io_serial_ports.cpp index 07de81988b..f8b6e4718a 100644 --- a/firmware/console/binary/tunerstudio_io_serial_ports.cpp +++ b/firmware/console/binary/tunerstudio_io_serial_ports.cpp @@ -4,25 +4,13 @@ * @date Mar 26, 2021 */ -#include "engine.h" +#include "pch.h" #if EFI_PROD_CODE || EFI_SIMULATOR #include "tunerstudio.h" #include "tunerstudio_io.h" #include "connector_uart_dma.h" -#if (!defined(TS_NO_PRIMARY) && (defined(TS_PRIMARY_UART) || defined(TS_PRIMARY_SERIAL))) - #define HAS_PRIMARY true -#else - #define HAS_PRIMARY false -#endif - -#if (!defined(TS_NO_SECONDARY) && (defined(TS_SECONDARY_UART) || defined(TS_SECONDARY_SERIAL))) - #define HAS_SECONDARY true -#else - #define HAS_SECONDARY false -#endif - #if HAS_PRIMARY #ifdef TS_PRIMARY_UART #if EFI_USE_UART_DMA