PUD: also do an immediate transmit when we updated the position
authorFerry Huberts <f.huberts@mindef.nl>
Thu, 30 Jun 2011 15:58:31 +0000 (17:58 +0200)
committerFerry Huberts <f.huberts@mindef.nl>
Mon, 4 Jul 2011 05:42:33 +0000 (07:42 +0200)
Signed-off-by: Ferry Huberts <f.huberts@mindef.nl>
lib/pud/src/receiver.c

index 576537a..1740c98 100644 (file)
@@ -669,9 +669,6 @@ bool receiverUpdateGpsInformation(unsigned char * rxBuffer, size_t rxCount) {
                                        " updates will be sent to the OLSR network");
                        goto end;
                }
-
-               /* do an immediate transmit */
-               txToAllOlsrInterfaces();
        }
 
 #if defined(PUD_DUMP_AVERAGING)
@@ -684,11 +681,10 @@ bool receiverUpdateGpsInformation(unsigned char * rxBuffer, size_t rxCount) {
         */
 
        updateTransmitGpsInformation = externalStateChange
-                       || (state.externalState == MOVING)
                        || (positionValid(posAvgEntry) && !positionValid(&txPosition))
                        || (movementResult.inside == SET);
 
-       if (updateTransmitGpsInformation) {
+       if ((state.externalState == MOVING) || updateTransmitGpsInformation) {
                memcpy(&txPosition.nmeaInfo, &posAvgEntry->nmeaInfo, sizeof(nmeaINFO));
                (void) pthread_mutex_lock(&transmitGpsInformation.mutex);
                memcpy(&transmitGpsInformation.txPosition.nmeaInfo,
@@ -702,6 +698,11 @@ bool receiverUpdateGpsInformation(unsigned char * rxBuffer, size_t rxCount) {
                        "receiverUpdateGpsInformation: transmitGpsInformation");
 #endif /* PUD_DUMP_AVERAGING */
 
+       if (updateTransmitGpsInformation) {
+               /* do an immediate transmit */
+               txToAllOlsrInterfaces();
+       }
+
        retval = true;
 
        end: (void) pthread_mutex_unlock(&positionAverageList.mutex);