1
0
Fork 0
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:
ligenxxxx 2020-12-24 11:20:41 +08:00
parent abc9f868b1
commit 00f73a6e0b

View file

@ -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