Save previous heading in case of nan
authorAndy Spencer <andy753421@gmail.com>
Wed, 15 Feb 2012 05:34:52 +0000 (05:34 +0000)
committerAndy Spencer <andy753421@gmail.com>
Wed, 15 Feb 2012 05:36:14 +0000 (05:36 +0000)
For some reason my GPS is giving me NaN's instead of headings..

src/plugins/gps-plugin.c

index 977fcb7..c2ef65e 100644 (file)
@@ -840,7 +840,10 @@ static void process_gps(gpointer data, gint source, GdkInputCondition condition)
 
        /* Process any data from the gps and call the hook function */
        if (gps_data != NULL) {
+               gdouble track = gps_data->fix.track;
                gint result = gps_read(gps_data);
+               if (isnan(gps_data->fix.track))
+                       gps_data->fix.track = track;
                g_debug("GritsPluginGps: process_gps - gps_read returned %d, "
                        "position %f, %f.", result,
                        gps_data->fix.latitude, gps_data->fix.longitude);