mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-18 08:54:15 +01:00
Flight/USB_HID: Change to deal with buffer filling up when GCS not ACK'ing the
usb transmissions. Clear TX buffer after any NAK. git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2147 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
88a0ede73b
commit
cfbdad5e0d
@ -228,7 +228,13 @@ int32_t PIOS_USB_HID_TxBufferPutMoreNonBlocking(uint8_t id, const uint8_t * buff
|
||||
if(!transfer_possible)
|
||||
return -1;
|
||||
|
||||
uint8_t previous_data = fifoBuf_getUsed(&tx_pios_fifo_buffer);
|
||||
if(GetEPTxStatus(ENDP1) == EP_TX_NAK) {
|
||||
/* This happens on windows when plugged in but GCS not connected */
|
||||
/* in this case clear buffer and keep trying */
|
||||
fifoBuf_clearData(&tx_pios_fifo_buffer);
|
||||
}
|
||||
|
||||
uint16_t previous_data = fifoBuf_getUsed(&tx_pios_fifo_buffer);
|
||||
|
||||
if (len > fifoBuf_getFree(&tx_pios_fifo_buffer))
|
||||
return -2; /* Cannot send all requested bytes */
|
||||
|
Loading…
x
Reference in New Issue
Block a user