mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-24 16:55:36 +03:00
Modified UART_TX_BUFFER_SIZE for USE_MSP_DISPLAYPORT
I did a test and added a lot of osd elements (basically all osd elements I can add, excluding GPS and ESC elements), and even some have overlapped. In this case, there is no problem at all. TxBufferSize is set to 1024. It is sufficient for normal conditions.
This commit is contained in:
parent
076732248e
commit
a5cd9ea7c3
2 changed files with 6 additions and 14 deletions
|
@ -29,7 +29,7 @@
|
|||
#define UART_RX_BUFFER_SIZE 128
|
||||
#endif
|
||||
#ifndef UART_TX_BUFFER_SIZE
|
||||
#define UART_TX_BUFFER_SIZE 256
|
||||
#define UART_TX_BUFFER_SIZE 1024
|
||||
#endif
|
||||
#elif defined(STM32F3)
|
||||
#define UARTDEV_COUNT_MAX 5
|
||||
|
@ -38,7 +38,7 @@
|
|||
#define UART_RX_BUFFER_SIZE 128
|
||||
#endif
|
||||
#ifndef UART_TX_BUFFER_SIZE
|
||||
#define UART_TX_BUFFER_SIZE 256
|
||||
#define UART_TX_BUFFER_SIZE 1024
|
||||
#endif
|
||||
#elif defined(STM32F4)
|
||||
#define UARTDEV_COUNT_MAX 6
|
||||
|
@ -47,7 +47,7 @@
|
|||
#define UART_RX_BUFFER_SIZE 128
|
||||
#endif
|
||||
#ifndef UART_TX_BUFFER_SIZE
|
||||
#define UART_TX_BUFFER_SIZE 256
|
||||
#define UART_TX_BUFFER_SIZE 1024
|
||||
#endif
|
||||
#elif defined(STM32F7)
|
||||
#define UARTDEV_COUNT_MAX 8
|
||||
|
@ -56,7 +56,7 @@
|
|||
#define UART_RX_BUFFER_SIZE 128
|
||||
#endif
|
||||
#ifndef UART_TX_BUFFER_SIZE
|
||||
#define UART_TX_BUFFER_SIZE 256
|
||||
#define UART_TX_BUFFER_SIZE 1024
|
||||
#endif
|
||||
#elif defined(STM32H7)
|
||||
#define UARTDEV_COUNT_MAX 8
|
||||
|
@ -65,7 +65,7 @@
|
|||
#define UART_RX_BUFFER_SIZE 128
|
||||
#endif
|
||||
#ifndef UART_TX_BUFFER_SIZE
|
||||
#define UART_TX_BUFFER_SIZE 256
|
||||
#define UART_TX_BUFFER_SIZE 1024
|
||||
#endif
|
||||
#elif defined(STM32G4)
|
||||
#define UARTDEV_COUNT_MAX 9 // UART1~5 + UART9 (Implemented with LPUART1)
|
||||
|
@ -74,7 +74,7 @@
|
|||
#define UART_RX_BUFFER_SIZE 128
|
||||
#endif
|
||||
#ifndef UART_TX_BUFFER_SIZE
|
||||
#define UART_TX_BUFFER_SIZE 256
|
||||
#define UART_TX_BUFFER_SIZE 1024
|
||||
#endif
|
||||
#else
|
||||
#error unknown MCU family
|
||||
|
|
|
@ -40,8 +40,6 @@
|
|||
|
||||
#include "msp_serial.h"
|
||||
|
||||
#include "drivers/time.h"
|
||||
|
||||
static mspPort_t mspPorts[MAX_MSP_PORT_COUNT];
|
||||
|
||||
static void resetMspPort(mspPort_t *mspPortToReset, serialPort_t *serialPort, bool sharedWithTelemetry)
|
||||
|
@ -292,13 +290,7 @@ static int mspSerialSendFrame(mspPort_t *msp, const uint8_t * hdr, int hdrLen, c
|
|||
// b) Response fits into TX buffer
|
||||
const int totalFrameLength = hdrLen + dataLen + crcLen;
|
||||
if (!isSerialTransmitBufferEmpty(msp->port) && ((int)serialTxBytesFree(msp->port) < totalFrameLength)) {
|
||||
#ifdef USE_MSP_DISPLAYPORT
|
||||
//Currently TxBuffer free space is not enough, Wait for TxBuffer empty
|
||||
const int perByteCostUs = (1000000 / (msp->port->baudRate / 10));
|
||||
delayMicroseconds((int)serialTxBytesFree(msp->port) * perByteCostUs);
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
// Transmit frame
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue