From 294ee555250fb0f0d24e7c092a1a4780feaff070 Mon Sep 17 00:00:00 2001 From: rusefi Date: Sun, 21 Jun 2020 20:47:46 -0400 Subject: [PATCH] refactoring connectivity --- firmware/config/stm32f4ems/halconf.h | 2 +- firmware/console/binary/tunerstudio_io.cpp | 1 - firmware/console/binary/tunerstudio_io.h | 2 +- firmware/console/console_io.cpp | 8 +++++--- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/firmware/config/stm32f4ems/halconf.h b/firmware/config/stm32f4ems/halconf.h index fcb732f7fb..2a6a687073 100644 --- a/firmware/config/stm32f4ems/halconf.h +++ b/firmware/config/stm32f4ems/halconf.h @@ -177,7 +177,7 @@ */ #if !defined(HAL_USE_UART) || defined(__DOXYGEN__) /* Configured in efifeatures.h */ -#if (TS_UART_DMA_MODE || TS_UART_MODE) +#if (PRIMARY_UART_DMA_MODE || TS_UART_DMA_MODE || TS_UART_MODE) #define HAL_USE_UART TRUE #else #define HAL_USE_UART FALSE diff --git a/firmware/console/binary/tunerstudio_io.cpp b/firmware/console/binary/tunerstudio_io.cpp index f290644c1a..bcf82ff6b3 100644 --- a/firmware/console/binary/tunerstudio_io.cpp +++ b/firmware/console/binary/tunerstudio_io.cpp @@ -164,7 +164,6 @@ int sr5ReadDataTimeout(ts_channel_s *tsChannel, uint8_t * buffer, int size, int } #endif - #if TS_UART_DMA_MODE #elif TS_UART_MODE UNUSED(tsChannel); diff --git a/firmware/console/binary/tunerstudio_io.h b/firmware/console/binary/tunerstudio_io.h index fc5fb4ee14..9d94e150ac 100644 --- a/firmware/console/binary/tunerstudio_io.h +++ b/firmware/console/binary/tunerstudio_io.h @@ -23,7 +23,7 @@ typedef enum { } ts_response_format_e; struct ts_channel_s { - BaseChannel * channel; + BaseChannel * channel = nullptr; uint8_t writeBuffer[7]; // size(2 bytes) + response(1 byte) + crc32 (4 bytes) /** * See 'blockingFactor' in rusefi.ini diff --git a/firmware/console/console_io.cpp b/firmware/console/console_io.cpp index b73e0fdf3a..09197a069d 100644 --- a/firmware/console/console_io.cpp +++ b/firmware/console/console_io.cpp @@ -222,6 +222,10 @@ bool isUsbSerial(BaseChannel * channel) { } BaseChannel * getConsoleChannel(void) { +#if defined(CONSOLE_UART_DEVICE) + return nullptr; +#endif //CONSOLE_UART_DEVICE + #if defined(EFI_CONSOLE_SERIAL_DEVICE) return (BaseChannel *) EFI_CONSOLE_SERIAL_DEVICE; #endif /* EFI_CONSOLE_SERIAL_DEVICE */ @@ -255,11 +259,9 @@ static THD_FUNCTION(consoleThreadEntryPoint, arg) { primaryChannel.channel = (BaseChannel *) getConsoleChannel(); #endif - if (primaryChannel.channel != NULL) { #if EFI_TUNER_STUDIO - runBinaryProtocolLoop(&primaryChannel); + runBinaryProtocolLoop(&primaryChannel); #endif /* EFI_TUNER_STUDIO */ - } } #endif /* EFI_CONSOLE_NO_THREAD */