1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-24 16:55:36 +03:00

Merge pull request #11764 from SteveCEvans/fix_spi_frsky

Backout unintended change impacting F7
This commit is contained in:
haslinghuis 2022-07-28 21:39:42 +02:00 committed by GitHub
commit 3c4a23ef55
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -409,11 +409,17 @@ uint32_t CDC_Receive_BytesAvailable(void)
uint32_t CDC_Send_FreeBytes(void)
{
// return the bytes free in the circular buffer
/*
return the bytes free in the circular buffer
functionally equivalent to:
(APP_Rx_ptr_out > APP_Rx_ptr_in ? APP_Rx_ptr_out - APP_Rx_ptr_in : APP_RX_DATA_SIZE - APP_Rx_ptr_in + APP_Rx_ptr_in)
but without the impact of the condition check.
*/
uint32_t freeBytes;
ATOMIC_BLOCK(NVIC_BUILD_PRIORITY(6, 0)) {
freeBytes = APP_RX_DATA_SIZE - rxAvailable;
freeBytes = ((UserTxBufPtrOut - UserTxBufPtrIn) + (-((int)(UserTxBufPtrOut <= UserTxBufPtrIn)) & APP_TX_DATA_SIZE)) - 1;
}
return freeBytes;