1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-01 09:24:10 +01:00

OP-1246 fixed clumsy error handling of UAVTalkSendObject calls from RadioComBridge

This commit is contained in:
Philippe Renon 2014-03-04 09:49:34 +01:00
parent 14f2894464
commit 1e3e8a29a9

View File

@ -342,11 +342,11 @@ static void telemetryTxTask(__attribute__((unused)) void *parameters)
updateRadioComBridgeStats(); updateRadioComBridgeStats();
} }
// Send update (with retries) // Send update (with retries)
int32_t ret = -1;
uint32_t retries = 0; uint32_t retries = 0;
int32_t success = -1; while (retries <= MAX_RETRIES && ret == -1) {
while (retries < MAX_RETRIES && success == -1) { ret = UAVTalkSendObject(data->telemUAVTalkCon, ev.obj, ev.instId, 0, RETRY_TIMEOUT_MS);
success = UAVTalkSendObject(data->telemUAVTalkCon, ev.obj, ev.instId, 0, RETRY_TIMEOUT_MS) == 0; if (ret == -1) {
if (success == -1) {
++retries; ++retries;
} }
} }
@ -376,11 +376,11 @@ static void radioTxTask(__attribute__((unused)) void *parameters)
if (xQueueReceive(data->radioEventQueue, &ev, MAX_PORT_DELAY) == pdTRUE) { if (xQueueReceive(data->radioEventQueue, &ev, MAX_PORT_DELAY) == pdTRUE) {
if ((ev.event == EV_UPDATED) || (ev.event == EV_UPDATE_REQ)) { if ((ev.event == EV_UPDATED) || (ev.event == EV_UPDATE_REQ)) {
// Send update (with retries) // Send update (with retries)
int32_t ret = -1;
uint32_t retries = 0; uint32_t retries = 0;
int32_t success = -1; while (retries <= MAX_RETRIES && ret == -1) {
while (retries < MAX_RETRIES && success == -1) { ret = UAVTalkSendObject(data->radioUAVTalkCon, ev.obj, ev.instId, 0, RETRY_TIMEOUT_MS);
success = UAVTalkSendObject(data->radioUAVTalkCon, ev.obj, ev.instId, 0, RETRY_TIMEOUT_MS) == 0; if (ret == -1) {
if (success == -1) {
++retries; ++retries;
} }
} }