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.
Dependents: TAREA_4_GPS_GSM Tarea6_GSM Tarea6_GPSGSM TareaGSM ... more
Fork of GPS7 by
Revision 2:8d7c7165ffe2, committed 2015-04-27
- Comitter:
- tony63
- Date:
- Mon Apr 27 02:08:24 2015 +0000
- Parent:
- 1:df8295aa2b2b
- Child:
- 3:7f621626d7e9
- Commit message:
- cordenadas de gps en enteros para google maps
Changed in this revision
| GPS.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/GPS.cpp Mon Oct 20 05:39:22 2014 +0000
+++ b/GPS.cpp Mon Apr 27 02:08:24 2015 +0000
@@ -35,28 +35,31 @@
while(1) {
getline();
-
+ //$GPGGA,123519,4807.038,N,01131.000,E,1,08,0.9,545.4,M,46.9,M,,*47
// Check if it is a GPGGA msg (matches both locked and non-locked msg)
if(sscanf(msg, "GPGGA,%f,%f,%c,%f,%c,%d", &time, &latitude, &ns, &longitude, &ew, &lock) >= 1) {
- if(!lock) {
+ if(!lock) { //si lock es 1 hay lecturas ok
longitude = 0.0;
latitude = 0.0;
return 0;
- } else {
+ }
+ else {
if(ns == 'S') { latitude *= -1.0; }
if(ew == 'W') { longitude *= -1.0; }
- float degrees = trunc(latitude / 100.0f);
- float minutes = latitude - (degrees * 100.0f);
- latitude = degrees + minutes / 60.0f;
- degrees = trunc(longitude / 100.0f * 0.01f);
- minutes = longitude - (degrees * 100.0f);
- longitude = degrees + minutes / 60.0f;
+ latitude = (latitude / 100.0f);
+ //float minutes = latitude - (degrees * 100.0f);
+ //latitude = degrees + minutes / 60.0f;
+ longitude = (longitude / 100.0f);
+ //minutes = longitude - (degrees * 100.0f);
+ //longitude = degrees + minutes / 60.0f;
+
return 1;
}
}
}
}
+/*
float GPS::trunc(float v) {
if(v < 0.0) {
v*= -1.0;
@@ -67,7 +70,7 @@
}
return v;
}
-
+*/
void GPS::getline() {
while(_gps.getc() != '$'); // wait for the start of a line
for(int i=0; i<256; i++) {
