Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: BSP_DISCO_F746NG
Diff: GroveGPS.h
- Revision:
- 5:8a5414710483
- Parent:
- 4:0ee729b4a211
- Child:
- 6:c8648bfc56bb
diff -r 0ee729b4a211 -r 8a5414710483 GroveGPS.h
--- a/GroveGPS.h Thu Jun 06 21:26:39 2019 -0500
+++ b/GroveGPS.h Tue Jun 18 12:14:13 2019 -0500
@@ -35,36 +35,49 @@
long diff_ref_station_id;
} gps_gga;
- void getTimestamp(char* buffer) {
+ bool getTimestamp(char* buffer) {
m.lock();
parseLine();
+ bool valid = gps_gga.position_fix != 0;
sprintf(buffer, "%f", gps_gga.utc_time);
m.unlock();
+
+ return valid;
}
- void getLatitude(char* buffer) {
+ bool getLatitude(char* buffer) {
m.lock();
parseLine();
+ bool valid = false;
double coordinate = convertGPSToDecimal(gps_gga.latitude);
- if (gps_gga.position_fix==0)
+ if (gps_gga.position_fix==0) {
sprintf(buffer, "N/A");
- else
+ } else {
sprintf(buffer, "%c%f", (gps_gga.ns_indicator == 'N') ? '0' : '-', coordinate);
+ valid = true;
+ }
m.unlock();
+
+ return valid;
}
- void getLongitude(char* buffer) {
+ bool getLongitude(char* buffer) {
m.lock();
parseLine();
+ bool valid = false;
double coordinate = convertGPSToDecimal(gps_gga.longitude);
- if (gps_gga.position_fix==0)
+ if (gps_gga.position_fix==0) {
sprintf(buffer, "N/A");
- else
- sprintf(buffer, "%c%f", (gps_gga.ew_indicator == 'E') ? '0' : '-', coordinate);
+ } else {
+ sprintf(buffer, "%c%f", (gps_gga.ew_indicator == 'E') ? '0' : '-', coordinate);
+ valid = true;
+ }
m.unlock();
+
+ return valid;
}
private: