PUD: restart timer on an 'extra' (external) position update
authorFerry Huberts <f.huberts@mindef.nl>
Mon, 4 Jul 2011 07:49:50 +0000 (09:49 +0200)
committerFerry Huberts <f.huberts@mindef.nl>
Mon, 4 Jul 2011 07:50:23 +0000 (09:50 +0200)
Signed-off-by: Ferry Huberts <f.huberts@mindef.nl>
lib/pud/src/receiver.c

index 1740c98..9d4d32a 100644 (file)
@@ -657,21 +657,6 @@ bool receiverUpdateGpsInformation(unsigned char * rxBuffer, size_t rxCount) {
 #if defined(PUD_DUMP_AVERAGING)
        olsr_printf(0, "receiverUpdateGpsInformation: newState = %s\n",
                        MovementStateToString(newState));
-#endif /* PUD_DUMP_AVERAGING */
-
-       /* perform externalState change actions */
-       if (externalStateChange) {
-               /* restart the timer for the new externalState */
-               if (!restartTimer(
-                               (state.externalState == STATIONARY) ? getUpdateIntervalStationary()
-                               : getUpdateIntervalMoving())) {
-                       pudError(0, "Could not restart receiver timer, no position"
-                                       " updates will be sent to the OLSR network");
-                       goto end;
-               }
-       }
-
-#if defined(PUD_DUMP_AVERAGING)
        dump_nmeaInfo(&posAvgEntry->nmeaInfo,
                        "receiverUpdateGpsInformation: posAvgEntry");
 #endif /* PUD_DUMP_AVERAGING */
@@ -699,6 +684,14 @@ bool receiverUpdateGpsInformation(unsigned char * rxBuffer, size_t rxCount) {
 #endif /* PUD_DUMP_AVERAGING */
 
        if (updateTransmitGpsInformation) {
+               if (!restartTimer(
+                               (state.externalState == STATIONARY) ? getUpdateIntervalStationary()
+                               : getUpdateIntervalMoving())) {
+                       pudError(0, "Could not restart receiver timer, no position"
+                                       " updates will be sent to the OLSR network");
+                       goto end;
+               }
+
                /* do an immediate transmit */
                txToAllOlsrInterfaces();
        }