diff --git a/firmware/console/binary/tunerstudio_io.cpp b/firmware/console/binary/tunerstudio_io.cpp index 5ea71ce9d6..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; @@ -152,17 +151,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_ */