mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-26 01:35:41 +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)
|
// 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
|
// b) Response fits into TX buffer
|
||||||
const int totalFrameLength = hdrLen + dataLen + crcLen;
|
const int totalFrameLength = hdrLen + dataLen + crcLen;
|
||||||
const int perByteCostUs = (1000000 / (msp->port->baudRate / 10));
|
|
||||||
if (!isSerialTransmitBufferEmpty(msp->port) && ((int)serialTxBytesFree(msp->port) < totalFrameLength)) {
|
if (!isSerialTransmitBufferEmpty(msp->port) && ((int)serialTxBytesFree(msp->port) < totalFrameLength)) {
|
||||||
|
#ifdef USE_MSP_DISPLAYPORT
|
||||||
//Currently TxBuffer free space is not enough, Wait for TxBuffer empty
|
//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);
|
delayMicroseconds((int)serialTxBytesFree(msp->port) * perByteCostUs);
|
||||||
|
#else
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Transmit frame
|
// Transmit frame
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue