mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-26 01:35:41 +03:00
Fix VCP support for new Tx bytes free vtable entry
This commit is contained in:
parent
94affd5841
commit
ca2a6d9cdd
2 changed files with 11 additions and 3 deletions
|
@ -648,8 +648,11 @@ blackboxBufferReserveStatus_e blackboxDeviceReserveBufferSpace(int32_t bytes)
|
||||||
// Handle failure:
|
// Handle failure:
|
||||||
switch (masterConfig.blackbox_device) {
|
switch (masterConfig.blackbox_device) {
|
||||||
case BLACKBOX_DEVICE_SERIAL:
|
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;
|
return BLACKBOX_RESERVE_PERMANENT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -99,7 +99,12 @@ void usbVcpWrite(serialPort_t *instance, uint8_t c)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct serialPortVTable usbVTable[] = { { usbVcpWrite, usbVcpAvailable, usbVcpRead, usbVcpSetBaudRate, isUsbVcpTransmitBufferEmpty, usbVcpSetMode } };
|
uint8_t usbTxBytesFree() {
|
||||||
|
// Because we block upon transmit and don't buffer bytes, our "buffer" capacity is effectively unlimited.
|
||||||
|
return 255;
|
||||||
|
}
|
||||||
|
|
||||||
|
const struct serialPortVTable usbVTable[] = { { usbVcpWrite, usbVcpAvailable, usbTxBytesFree, usbVcpRead, usbVcpSetBaudRate, isUsbVcpTransmitBufferEmpty, usbVcpSetMode } };
|
||||||
|
|
||||||
serialPort_t *usbVcpOpen(void)
|
serialPort_t *usbVcpOpen(void)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue