From 4e81b67ca313cfa9d3f0a322cfcdb8d4a0910690 Mon Sep 17 00:00:00 2001 From: Matthew Kennedy Date: Fri, 21 Aug 2020 11:12:28 -0700 Subject: [PATCH] harmonize blocking factor (#1709) * harmonize blocking factor * static assert --- firmware/config/boards/kinetis/halconf.h | 2 +- firmware/config/stm32f4ems/halconf.h | 2 +- firmware/config/stm32f7ems/halconf.h | 2 +- firmware/console/binary/tunerstudio_io.cpp | 2 ++ firmware/integration/rusefi_config.txt | 2 +- firmware/tunerstudio/rusefi.input | 2 +- 6 files changed, 7 insertions(+), 5 deletions(-) diff --git a/firmware/config/boards/kinetis/halconf.h b/firmware/config/boards/kinetis/halconf.h index 548e7f5243..8030635316 100644 --- a/firmware/config/boards/kinetis/halconf.h +++ b/firmware/config/boards/kinetis/halconf.h @@ -347,7 +347,7 @@ * buffers. */ #if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__) -#define SERIAL_USB_BUFFERS_SIZE 256 +#define SERIAL_USB_BUFFERS_SIZE 320 #endif /** diff --git a/firmware/config/stm32f4ems/halconf.h b/firmware/config/stm32f4ems/halconf.h index b4847c8f13..de9e5527df 100644 --- a/firmware/config/stm32f4ems/halconf.h +++ b/firmware/config/stm32f4ems/halconf.h @@ -341,7 +341,7 @@ * buffers. */ #if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__) -#define SERIAL_USB_BUFFERS_SIZE 256 +#define SERIAL_USB_BUFFERS_SIZE 320 #endif /** diff --git a/firmware/config/stm32f7ems/halconf.h b/firmware/config/stm32f7ems/halconf.h index be500a7351..15247a3204 100644 --- a/firmware/config/stm32f7ems/halconf.h +++ b/firmware/config/stm32f7ems/halconf.h @@ -339,7 +339,7 @@ * buffers. */ #if !defined(SERIAL_USB_BUFFERS_SIZE) || defined(__DOXYGEN__) -#define SERIAL_USB_BUFFERS_SIZE 256 +#define SERIAL_USB_BUFFERS_SIZE 320 #endif /** diff --git a/firmware/console/binary/tunerstudio_io.cpp b/firmware/console/binary/tunerstudio_io.cpp index 9e3a0e26bf..7bb4d2bd26 100644 --- a/firmware/console/binary/tunerstudio_io.cpp +++ b/firmware/console/binary/tunerstudio_io.cpp @@ -24,6 +24,8 @@ extern LoggingWithStorage tsLogger; #include "usbconsole.h" #if HAL_USE_SERIAL_USB +// Assert that the USB tx/rx buffers are large enough to fit one full packet +static_assert(SERIAL_USB_BUFFERS_SIZE >= BLOCKING_FACTOR + 10); extern SerialUSBDriver SDU1; #endif /* HAL_USE_SERIAL_USB */ diff --git a/firmware/integration/rusefi_config.txt b/firmware/integration/rusefi_config.txt index eadce204e2..669aee4167 100644 --- a/firmware/integration/rusefi_config.txt +++ b/firmware/integration/rusefi_config.txt @@ -70,7 +70,7 @@ struct_no_prefix engine_configuration_s #define LE_COMMAND_LENGTH 200 ! see 'blockingFactor' in rusefi.ini -#define BLOCKING_FACTOR 400 +#define BLOCKING_FACTOR 256 #define FSIO_ANALOG_INPUT_COUNT 4 diff --git a/firmware/tunerstudio/rusefi.input b/firmware/tunerstudio/rusefi.input index dcdeb3126f..0a2ea5cc78 100644 --- a/firmware/tunerstudio/rusefi.input +++ b/firmware/tunerstudio/rusefi.input @@ -65,7 +65,7 @@ enable2ndByteCanID = false ; delayAfterPortOpen = 500 - blockingFactor = 256 ; max chunk size + blockingFactor = @@BLOCKING_FACTOR@@ ; max chunk size ;end communication settings ; name = bits, type, offset, bits