summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Kocialkowski <contact@paulk.fr>2014-05-12 20:04:53 +0200
committerPaul Kocialkowski <contact@paulk.fr>2014-05-12 20:04:53 +0200
commit621088cc180926d8341dc97e876187f76d1a36fe (patch)
tree7f409b6238750c8ab34d361b9773cfc2bb28fc79
parent0bcd90da87361c7109d02e02950b5fb87674e10d (diff)
downloaddevice_goldelico_gta04-621088cc180926d8341dc97e876187f76d1a36fe.zip
device_goldelico_gta04-621088cc180926d8341dc97e876187f76d1a36fe.tar.gz
device_goldelico_gta04-621088cc180926d8341dc97e876187f76d1a36fe.tar.bz2
gps: Report speed in meters per second
Signed-off-by: Paul Kocialkowski <contact@paulk.fr>
-rw-r--r--gps/nmea.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/gps/nmea.c b/gps/nmea.c
index b8d6338..a2a5059 100644
--- a/gps/nmea.c
+++ b/gps/nmea.c
@@ -510,9 +510,13 @@ int gta04_gps_nmea_gprmc(char *nmea)
gta04_gps_nmea_coordinates(nmea);
buffer = gta04_gps_nmea_parse(nmea);
- if (buffer != NULL)
+ if (buffer != NULL) {
speed = gta04_gps_nmea_parse_float(buffer, 0, strlen(buffer));
+ // Convert knots (nautical miles per hour) to meters per second
+ speed = speed * 1.852f / 3.6f;
+ }
+
buffer = gta04_gps_nmea_parse(nmea);
if (buffer != NULL)
bearing = gta04_gps_nmea_parse_float(buffer, 0, strlen(buffer));