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

Fix VCP support for new Tx bytes free vtable entry

This commit is contained in:
Nicholas Sherlock 2015-09-24 21:46:52 +12:00
parent 94affd5841
commit ca2a6d9cdd
2 changed files with 11 additions and 3 deletions

View file

@ -648,8 +648,11 @@ blackboxBufferReserveStatus_e blackboxDeviceReserveBufferSpace(int32_t bytes)
// Handle failure:
switch (masterConfig.blackbox_device) {
case BLACKBOX_DEVICE_SERIAL:
// One byte of the tx buffer isn't available for user data (due to its circular list implementation), hence the -1
if (bytes > (int32_t) blackboxPort->txBufferSize - 1) {
/*
* One byte of the tx buffer isn't available for user data (due to its circular list implementation),
* hence the -1. Note that the USB VCP implementation doesn't use a buffer and has txBufferSize set to zero.
*/
if (blackboxPort->txBufferSize && bytes > (int32_t) blackboxPort->txBufferSize - 1) {
return BLACKBOX_RESERVE_PERMANENT_FAILURE;
}