From 33cae7645de1fc8b20ad2f4959bbd1f6951de243 Mon Sep 17 00:00:00 2001 From: Brian Webb Date: Tue, 12 Jun 2012 19:47:25 -0700 Subject: [PATCH] Fixed calculation of retries on PipX. --- flight/Modules/RadioComBridge/RadioComBridge.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/flight/Modules/RadioComBridge/RadioComBridge.c b/flight/Modules/RadioComBridge/RadioComBridge.c index ceb547fd1..7124e5ae0 100644 --- a/flight/Modules/RadioComBridge/RadioComBridge.c +++ b/flight/Modules/RadioComBridge/RadioComBridge.c @@ -567,8 +567,9 @@ static void sendDataTask(void *parameters) uint32_t retries = 0; int32_t success = -1; while (retries < MAX_RETRIES && success == -1) { - success = UAVTalkSendObject(data->outUAVTalkCon, ev.obj, 0, 0, RETRY_TIMEOUT_MS); - ++retries; + success = UAVTalkSendObject(data->outUAVTalkCon, ev.obj, 0, 0, RETRY_TIMEOUT_MS) == 0; + if (!success) + ++retries; } data->comTxRetries += retries; } @@ -578,8 +579,9 @@ static void sendDataTask(void *parameters) uint32_t retries = 0; int32_t success = -1; while (retries < MAX_RETRIES && success == -1) { - success = UAVTalkSendAck(data->outUAVTalkCon, ev.obj, ev.instId); - ++retries; + success = UAVTalkSendAck(data->outUAVTalkCon, ev.obj, ev.instId) == 0; + if (!success) + ++retries; } data->comTxRetries += retries; } @@ -589,8 +591,9 @@ static void sendDataTask(void *parameters) uint32_t retries = 0; int32_t success = -1; while (retries < MAX_RETRIES && success == -1) { - success = UAVTalkSendNack(data->outUAVTalkCon, UAVObjGetID(ev.obj)); - ++retries; + success = UAVTalkSendNack(data->outUAVTalkCon, UAVObjGetID(ev.obj)) == 0; + if (!success) + ++retries; } data->comTxRetries += retries; }