Generation 3 of the Harp project
Dependencies: Servo TMP36 GZ buffered-serial1 chan_fatfs_sd nmea_parser watchdog mbed-rtos mbed
Fork of HARP2 by
Diff: GPS/GPS.cpp
- Revision:
- 3:9cba44dd2f2b
- Parent:
- 2:0c9ade531a5b
- Child:
- 4:d47805009bbd
--- a/GPS/GPS.cpp Wed Feb 22 04:37:13 2012 +0000 +++ b/GPS/GPS.cpp Wed Feb 22 05:24:47 2012 +0000 @@ -51,25 +51,25 @@ // Check if it is a GPGGA msg (matches both locked and non-locked msg) if (sscanf(msg, "GPGGA,%f,%f,%c,%f,%c,%d,%d,%f,%f,%c", &utc_time, &nmea_latitude, &ns, &nmea_longitude, &ew, &lock, &satelites, &hdop, &msl_altitude, &msl_units) >= 1) { - line_parsed = 1; + line_parsed = GGA; } // Check if it is a GPRMC msg else if (sscanf(msg, "GPRMC,%f,%c,%f,%c,%f,%c,%f,%f,%d", &utc_time, &rmc_status, &nmea_latitude, &ns, &nmea_longitude, &ew, &speed_k, &course_d, &date) >= 1) { - line_parsed = 1; + line_parsed = RMC; } // GLL - Geographic Position-Lat/Lon else if (sscanf(msg, "GPGLL,%f,%c,%f,%c,%f,%c", &nmea_latitude, &ns, &nmea_longitude, &ew, &utc_time, &gll_status) >= 1) { - line_parsed = 1; + line_parsed = GLL; } // VTG-Course Over Ground and Ground Speed else if (sscanf(msg, "GPVTG,%f,%c,%f,%c,%f,%c,%f,%c", &course_t, &course_t_unit, &course_m, &course_m_unit, &speed_k, &speed_k_unit, &speed_km, &speed_km_unit) >= 1) { - line_parsed = 1; + line_parsed = VTG; } } if (!lock) { return NO_LOCK; } else if (line_parsed) { - return PARSED; + return line_parsed; } else { return NOT_PARSED; } @@ -139,5 +139,33 @@ if (!lock) return 0.0; else - return nmea_latitude; + return dec_latitude; +} + +float GPS::get_course_t() { + if (!lock) + return 0.0; + else + return course_t; } + +float GPS::get_course_m() { + if (!lock) + return 0.0; + else + return course_m; +} + +float GPS::get_speed_k() { + if (!lock) + return 0.0; + else + return speed_k; +} + +float GPS::get_speed_km() { + if (!lock) + return 0.0; + else + return speed_km; +} \ No newline at end of file