X-Git-Url: http://git.openwrt.org/?a=blobdiff_plain;f=nmea.c;h=8e6160632f59b91f18be298d4192b24699258e63;hb=5e88403fc0d39ae8a270d2c6c6e9c8a4d5232cf3;hp=d51d936d2e69bcae34804a93d23d7f8df165c230;hpb=8e12414a2b7a8a1e7228ff37e3cf9bd9c63a33c1;p=project%2Fugps.git diff --git a/nmea.c b/nmea.c index d51d936..8e61606 100644 --- a/nmea.c +++ b/nmea.c @@ -54,6 +54,7 @@ struct nmea_param { static int nmea_bad_time; char longitude[33] = { 0 }, latitude[33] = { 0 }, course[17] = { 0 }, speed[17] = { 0 }, elevation[17] = { 0 }; int gps_valid = 0; +char gps_fields = 0; static void nmea_txt_cb(void) @@ -119,6 +120,8 @@ parse_gps_coords(char *latstr, char *vhem, char *lonstr, char *hhem) snprintf(longitude, sizeof(longitude), "%f", lon); DEBUG(3, "position: %s %s\n", latitude, longitude); + gps_fields |= GPS_FIELD_LAT | GPS_FIELD_LON; + gps_timestamp(); } @@ -220,6 +223,7 @@ nmea_gga_cb(void) if (!gps_valid) return; strncpy(elevation, nmea_params[9].str, sizeof(elevation)); + gps_fields |= GPS_FIELD_ALT; DEBUG(4, "height: %s\n", elevation); } @@ -230,6 +234,7 @@ nmea_vtg_cb(void) return; strncpy(course, nmea_params[1].str, sizeof(course)); strncpy(speed, nmea_params[7].str, sizeof(speed)); + gps_fields |= GPS_FIELD_COG | GPS_FIELD_SPD; DEBUG(4, "course: %s\n", course); DEBUG(4, "speed: %s\n", speed); }