From ce3c18e05041c801966df88bed8bb1d6736af3d1 Mon Sep 17 00:00:00 2001 From: Andrei Date: Tue, 30 May 2017 21:08:12 +0300 Subject: [PATCH 1/2] Add sr5ReadDataTimeout for bootloader --- firmware/console/binary/tunerstudio_io.cpp | 10 +++++++--- firmware/console/binary/tunerstudio_io.h | 1 + 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/firmware/console/binary/tunerstudio_io.cpp b/firmware/console/binary/tunerstudio_io.cpp index 5ea71ce9d6..17020dcd93 100644 --- a/firmware/console/binary/tunerstudio_io.cpp +++ b/firmware/console/binary/tunerstudio_io.cpp @@ -152,17 +152,21 @@ void sr5WriteData(ts_channel_s *tsChannel, const uint8_t * buffer, int size) { } } -int sr5ReadData(ts_channel_s *tsChannel, uint8_t * buffer, int size) { +int sr5ReadDataTimeout(ts_channel_s *tsChannel, uint8_t * buffer, int size, int timeout) { #if TS_UART_DMA_MODE || defined(__DOXYGEN__) UNUSED(tsChannel); - return (int)chIQReadTimeout(&tsUartDma.fifoRxQueue, (uint8_t * )buffer, (size_t)size, SR5_READ_TIMEOUT); + return (int)chIQReadTimeout(&tsUartDma.fifoRxQueue, (uint8_t * )buffer, (size_t)size, timeout); #else /* TS_UART_DMA_MODE */ if (tsChannel->channel == NULL) return 0; - return chnReadTimeout(tsChannel->channel, (uint8_t * )buffer, size, SR5_READ_TIMEOUT); + return chnReadTimeout(tsChannel->channel, (uint8_t * )buffer, size, timeout); #endif /* TS_UART_DMA_MODE */ } +int sr5ReadData(ts_channel_s *tsChannel, uint8_t * buffer, int size) { + return sr5ReadDataTimeout(tsChannel, buffer, size, SR5_READ_TIMEOUT); +} + /** * Adds size to the beginning of a packet and a crc32 at the end. Then send the packet. diff --git a/firmware/console/binary/tunerstudio_io.h b/firmware/console/binary/tunerstudio_io.h index f979c66063..d7e2bd69b2 100644 --- a/firmware/console/binary/tunerstudio_io.h +++ b/firmware/console/binary/tunerstudio_io.h @@ -101,6 +101,7 @@ void sr5WriteData(ts_channel_s *tsChannel, const uint8_t * buffer, int size); void sr5WriteCrcPacket(ts_channel_s *tsChannel, const uint8_t responseCode, const void *buf, const uint16_t size); void sr5SendResponse(ts_channel_s *tsChannel, ts_response_format_e mode, const uint8_t * buffer, int size); int sr5ReadData(ts_channel_s *tsChannel, uint8_t * buffer, int size); +int sr5ReadDataTimeout(ts_channel_s *tsChannel, uint8_t * buffer, int size, int timeout); bool sr5IsReady(bool isConsoleRedirect); #endif /* CONSOLE_TUNERSTUDIO_TUNERSTUDIO_IO_H_ */ From 9ce5e5f44482b8f051e76722b466f97a10f4f7c0 Mon Sep 17 00:00:00 2001 From: Andrei Date: Tue, 30 May 2017 21:16:03 +0300 Subject: [PATCH 2/2] Remove redundant includes from s5r code, needed by BL --- firmware/console/binary/tunerstudio_io.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/firmware/console/binary/tunerstudio_io.cpp b/firmware/console/binary/tunerstudio_io.cpp index 17020dcd93..b18e2e4883 100644 --- a/firmware/console/binary/tunerstudio_io.cpp +++ b/firmware/console/binary/tunerstudio_io.cpp @@ -20,7 +20,6 @@ extern LoggingWithStorage tsLogger; #if EFI_PROD_CODE || defined(__DOXYGEN__) #include "pin_repository.h" #include "usbconsole.h" -#include "map_averaging.h" #if HAL_USE_SERIAL_USB || defined(__DOXYGEN__) extern SerialUSBDriver SDU1;