along with this program. If not, see <http://www.gnu.org/licenses/>.
****/
+#include <math.h>
+
#include "callbacks.h"
#include "appdata.h"
#include "util.h"
void location_changed(LocationGPSDevice* device, gpointer data) {
//print_location(device);
+ g_assert(data);
+ g_assert(device);
AppData* appdata = (AppData*) data;
+ // check for NaN before passing values
if(device->fix->fields & LOCATION_GPS_DEVICE_SPEED_SET) {
- g_print("Speed is %.2f km/h\n", device->fix->speed);
- interpret_speed_from_gps(appdata, device->fix->speed);
+ if(!isnan(device->fix->speed)) {
+ interpret_speed_from_gps(appdata, device->fix->speed);
+ }
}
}