mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-24 16:55:36 +03:00
only delay when define USE_MSP_DISPLAYPORT
This commit is contained in:
parent
abc9f868b1
commit
00f73a6e0b
1 changed files with 4 additions and 1 deletions
|
@ -291,10 +291,13 @@ static int mspSerialSendFrame(mspPort_t *msp, const uint8_t * hdr, int hdrLen, c
|
|||
// this allows us to transmit jumbo frames bigger than TX buffer (serialWriteBuf will block, but for jumbo frames we don't care)
|
||||
// b) Response fits into TX buffer
|
||||
const int totalFrameLength = hdrLen + dataLen + crcLen;
|
||||
const int perByteCostUs = (1000000 / (msp->port->baudRate / 10));
|
||||
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;
|
||||
}
|
||||
|
||||
// Transmit frame
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue