From d4e61df6029075a1af4185759dd04e1ea702218a Mon Sep 17 00:00:00 2001 From: rusefillc Date: Mon, 23 Jan 2023 08:04:41 -0500 Subject: [PATCH] Default binary should have more relaxed pinout: serial #4998 we can now simplify code a bit --- firmware/CHANGELOG.md | 1 + firmware/console/binary/tunerstudio_io.h | 6 ------ firmware/console/binary/tunerstudio_io_serial.cpp | 4 ++-- .../console/binary/tunerstudio_io_serial_ports.cpp | 11 +++-------- 4 files changed, 6 insertions(+), 16 deletions(-) diff --git a/firmware/CHANGELOG.md b/firmware/CHANGELOG.md index 529e4bad13..9569d108a4 100644 --- a/firmware/CHANGELOG.md +++ b/firmware/CHANGELOG.md @@ -42,6 +42,7 @@ Release template (copy/paste this for new release): - STM32Cube v2.12 - detect and ignore doubled trigger edges #4656 - Additional fuel and timing correction gauges in Tunerstudio #4955 + - Default bundle no longer initializes UART TTL connectivity by default #4998 ### Fixed - multi-line tooltips in TS #4927 diff --git a/firmware/console/binary/tunerstudio_io.h b/firmware/console/binary/tunerstudio_io.h index 171f196969..da8bac011b 100644 --- a/firmware/console/binary/tunerstudio_io.h +++ b/firmware/console/binary/tunerstudio_io.h @@ -10,12 +10,6 @@ #include "global.h" #include "tunerstudio_impl.h" -#if (!TS_NO_PRIMARY && defined(TS_PRIMARY_UxART_PORT)) - #define HAS_UxART_PRIMARY true -#else - #define HAS_UxART_PRIMARY 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 0066e22959..d6f66ee876 100644 --- a/firmware/console/binary/tunerstudio_io_serial.cpp +++ b/firmware/console/binary/tunerstudio_io_serial.cpp @@ -4,7 +4,7 @@ #include "tunerstudio_io.h" -#if HAS_UxART_PRIMARY || defined(TS_SECONDARY_UxART_PORT) +#if defined(TS_PRIMARY_UxART_PORT) || defined(TS_SECONDARY_UxART_PORT) #if HAL_USE_SERIAL void SerialTsChannel::start(uint32_t baud) { SerialConfig cfg = { @@ -65,4 +65,4 @@ size_t UartTsChannel::readTimeout(uint8_t* buffer, size_t size, int timeout) { return size; } #endif // HAL_USE_UART -#endif // HAS_UxART_PRIMARY || defined(TS_SECONDARY_UxART_PORT) +#endif // defined(TS_PRIMARY_UxART_PORT) || defined(TS_SECONDARY_UxART_PORT) diff --git a/firmware/console/binary/tunerstudio_io_serial_ports.cpp b/firmware/console/binary/tunerstudio_io_serial_ports.cpp index c374a0d391..a269d17178 100644 --- a/firmware/console/binary/tunerstudio_io_serial_ports.cpp +++ b/firmware/console/binary/tunerstudio_io_serial_ports.cpp @@ -20,7 +20,6 @@ class UartDmaTsChannel; class UartTsChannel; class SerialTsChannel; -#if HAS_UxART_PRIMARY #ifdef TS_PRIMARY_UxART_PORT // We want to instantiate the correct channel type depending on what type of serial port we're @@ -36,7 +35,6 @@ class SerialTsChannel; UartTsChannel, #endif // EFI_USE_UART_DMA SerialTsChannel> primaryChannel(TS_PRIMARY_UxART_PORT); -#endif // TS_PRIMARY_UxART_PORT struct PrimaryChannelThread : public TunerstudioThread { PrimaryChannelThread() : TunerstudioThread("Primary TS Channel") { } @@ -56,9 +54,8 @@ class SerialTsChannel; }; static PrimaryChannelThread primaryChannelThread; -#endif // HAS_UxART_PRIMARY +#endif // defined(TS_PRIMARY_UxART_PORT) -#if defined(TS_SECONDARY_UxART_PORT) #ifdef TS_SECONDARY_UxART_PORT std::conditional_t< std::is_same_v, @@ -68,8 +65,6 @@ class SerialTsChannel; UartTsChannel, #endif // EFI_USE_UART_DMA SerialTsChannel> secondaryChannel(TS_SECONDARY_UxART_PORT); -#endif // defined(TS_SECONDARY_UxART_PORT) - struct SecondaryChannelThread : public TunerstudioThread { SecondaryChannelThread() : TunerstudioThread("Secondary TS Channel") { } @@ -90,7 +85,7 @@ class SerialTsChannel; #endif // defined(TS_SECONDARY_UxART_PORT) void startSerialChannels() { -#if HAS_UxART_PRIMARY +#if defined(TS_PRIMARY_UxART_PORT) // todo: invert setting one day? if (!engineConfiguration->disablePrimaryUart) { primaryChannelThread.start(); @@ -106,7 +101,7 @@ SerialTsChannelBase* getBluetoothChannel() { #if defined(TS_SECONDARY_UxART_PORT) // Prefer secondary channel for bluetooth return &secondaryChannel; -#elif HAS_UxART_PRIMARY +#elif defined(TS_PRIMARY_UxART_PORT) // Use primary channel for BT if no secondary exists return &primaryChannel; #endif