1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-20 10:54:14 +01:00

PiOS/USB_HID: No longer clear buffer after getting a NAK. This was required

before because if transmission got NAK then sending would stop.  Now the next
time data is added to the buffer a new send will be attempted.

fifoBuf: in clearData just set the read pointer to the write pointer.  This is
safer for multiple people accessing it assuming the reader will be clearing it.

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2279 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
peabody124 2010-12-24 17:16:04 +00:00 committed by peabody124
parent ba8351f60a
commit 1142b1fb1e
2 changed files with 2 additions and 8 deletions

View File

@ -67,7 +67,7 @@ uint16_t fifoBuf_getFree(t_fifo_buffer *buf)
void fifoBuf_clearData(t_fifo_buffer *buf)
{ // remove all data from the buffer
buf->rd = buf->wr = 0;
buf->rd = buf->wr;
}
void fifoBuf_removeData(t_fifo_buffer *buf, uint16_t len)

View File

@ -238,13 +238,7 @@ int32_t PIOS_USB_HID_TxBufferPutMoreNonBlocking(uint8_t id, const uint8_t * buff
uint16_t ret;
if(!transfer_possible)
return -1;
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);
}
return -1;
if (len > fifoBuf_getFree(&tx_pios_fifo_buffer))
return -2; /* Cannot send all requested bytes */