]> Pileus Git - aweather/commitdiff
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 977fcb722f7491587f6a2ac0361b3e56bb7fe123..c2ef65e81f45cf63b01301799d95c1ed7939dc86 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) {
 
        /* 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);
                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);
                g_debug("GritsPluginGps: process_gps - gps_read returned %d, "
                        "position %f, %f.", result,
                        gps_data->fix.latitude, gps_data->fix.longitude);