1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-29 14:52:12 +01:00

com: don't block forever waiting for a transmitter

Not all transmitters will continue to run when disconnected.
USB is one example of this.  When the USB cable was disconnected,
any transmitter blocked here would wait forever.

This was particularly noticeable when the telemetry Tx task
blocked forever on USB disconnect.  This also resulted in
the telemetry Rx task blocking forever waiting on the UAVTalk
connection lock.

We now block for a max of 5s waiting for space in the transmit
buffer.
This commit is contained in:
Stacey Sheldon 2011-12-30 12:55:51 -05:00
parent 7c03875013
commit 2cf1fe93c6

View File

@ -352,7 +352,7 @@ int32_t PIOS_COM_SendBuffer(uint32_t com_id, const uint8_t *buffer, uint16_t len
fifoBuf_getUsed(&com_dev->tx));
}
#if defined(PIOS_INCLUDE_FREERTOS)
if (xSemaphoreTake(com_dev->tx_sem, portMAX_DELAY) != pdTRUE) {
if (xSemaphoreTake(com_dev->tx_sem, 5000) != pdTRUE) {
return -3;
}
#endif