mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-27 16:54:15 +01:00
OP-1218 changes to RadioComBridge to support return code.
This commit is contained in:
parent
79b68ae886
commit
e16cf0ef8d
@ -415,7 +415,11 @@ static void radioRxTask(__attribute__((unused)) void *parameters)
|
|||||||
// Send the data straight to the telemetry port.
|
// Send the data straight to the telemetry port.
|
||||||
// FIXME following call can fail (with -2 error code) if buffer is full
|
// FIXME following call can fail (with -2 error code) if buffer is full
|
||||||
// it is the caller responsibility to retry in such cases...
|
// it is the caller responsibility to retry in such cases...
|
||||||
PIOS_COM_SendBufferNonBlocking(PIOS_COM_TELEMETRY, serial_data, bytes_to_process);
|
int32_t ret = -2;
|
||||||
|
uint8_t count = 5;
|
||||||
|
while(count-- > 0 && ret < -1){
|
||||||
|
ret = PIOS_COM_SendBufferNonBlocking(PIOS_COM_TELEMETRY, serial_data, bytes_to_process);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -511,8 +515,12 @@ static void serialRxTask(__attribute__((unused)) void *parameters)
|
|||||||
// Send the data over the radio link.
|
// Send the data over the radio link.
|
||||||
// FIXME following call can fail (with -2 error code) if buffer is full
|
// FIXME following call can fail (with -2 error code) if buffer is full
|
||||||
// it is the caller responsibility to retry in such cases...
|
// it is the caller responsibility to retry in such cases...
|
||||||
|
int32_t ret = -2;
|
||||||
|
uint8_t count = 5;
|
||||||
|
while(count-- > 0 && ret < -1){
|
||||||
PIOS_COM_SendBufferNonBlocking(PIOS_COM_RADIO, data->serialRxBuf, bytes_to_process);
|
PIOS_COM_SendBufferNonBlocking(PIOS_COM_RADIO, data->serialRxBuf, bytes_to_process);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
vTaskDelay(5);
|
vTaskDelay(5);
|
||||||
}
|
}
|
||||||
@ -541,7 +549,11 @@ static int32_t UAVTalkSendHandler(uint8_t *buf, int32_t length)
|
|||||||
if (outputPort) {
|
if (outputPort) {
|
||||||
// FIXME following call can fail (with -2 error code) if buffer is full
|
// FIXME following call can fail (with -2 error code) if buffer is full
|
||||||
// it is the caller responsibility to retry in such cases...
|
// it is the caller responsibility to retry in such cases...
|
||||||
|
ret = -2;
|
||||||
|
uint8_t count = 5;
|
||||||
|
while(count-- > 0 && ret < -1){
|
||||||
ret = PIOS_COM_SendBufferNonBlocking(outputPort, buf, length);
|
ret = PIOS_COM_SendBufferNonBlocking(outputPort, buf, length);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
ret = -1;
|
ret = -1;
|
||||||
}
|
}
|
||||||
@ -567,7 +579,12 @@ static int32_t RadioSendHandler(uint8_t *buf, int32_t length)
|
|||||||
if (outputPort && PIOS_COM_Available(outputPort)) {
|
if (outputPort && PIOS_COM_Available(outputPort)) {
|
||||||
// FIXME following call can fail (with -2 error code) if buffer is full
|
// FIXME following call can fail (with -2 error code) if buffer is full
|
||||||
// it is the caller responsibility to retry in such cases...
|
// it is the caller responsibility to retry in such cases...
|
||||||
return PIOS_COM_SendBufferNonBlocking(outputPort, buf, length);
|
int32_t ret = -2;
|
||||||
|
uint8_t count = 5;
|
||||||
|
while(count-- > 0 && ret < -1){
|
||||||
|
ret = PIOS_COM_SendBufferNonBlocking(outputPort, buf, length);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
} else {
|
} else {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user