From: Andy Spencer Date: Wed, 15 Feb 2012 05:34:52 +0000 (+0000) Subject: Save previous heading in case of nan X-Git-Tag: v0.7~1 X-Git-Url: http://pileus.org/git/?p=aweather;a=commitdiff_plain;h=11cb13cdcb190bb7732608c84b1e07fed7b929b2 Save previous heading in case of nan For some reason my GPS is giving me NaN's instead of headings.. --- diff --git a/src/plugins/gps-plugin.c b/src/plugins/gps-plugin.c index 977fcb7..c2ef65e 100644 --- a/src/plugins/gps-plugin.c +++ b/src/plugins/gps-plugin.c @@ -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);