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.
Revision 1:2f131675f872, committed 2018-05-04
- Comitter:
- Tomo073
- Date:
- Fri May 04 15:16:02 2018 +0000
- Parent:
- 0:2c0d50143d85
- Child:
- 2:578f518a6a05
- Commit message:
- a
Changed in this revision
| GPS.cpp | Show annotated file Show diff for this revision Revisions of this file |
| GPS.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/GPS.cpp Thu May 03 14:19:36 2018 +0000
+++ b/GPS.cpp Fri May 04 15:16:02 2018 +0000
@@ -27,8 +27,8 @@
NVIC_SetPriority(UART2_IRQn,0);
- //m = 1;
- //reasonable = false;
+ info = 1;
+ reasonable = false;
//serial.attach(this,ExtractionData,Serial::RxIrq);
@@ -82,10 +82,10 @@
getstring(DATA);
if(!strcmp(DATA, "GPGGA")){
- //int m;
- for(m = 1; m < 6;m++){
+ //int info;
+ for(info = 1; info < 6;info++){
getstring(DATA);
- switch(m){
+ switch(info){
case 1:
time = strtof(DATA, NULL) + 90000.0;
break;
@@ -130,21 +130,25 @@
char DATA[20] = "\0";
Initialization();
+
+ if(!reasonable){
datadefault = serial.getc();
- if(datadefault == '$'){
- getstring(DATA);
- if(!strcmp(DATA, "GPGGA")){
- reasonable = true;
+ if(datadefault == '$'){
+
+ getstring(DATA);
+
+ if(!strcmp(DATA, "GPGGA")){
+ reasonable = true;
+ }
}
- }
-
- if(reasonable){
+
+ }else{
Initialization();
getstring(DATA);
- switch(m){
+ switch(info){
case 1:
Seconds = modff((strtof(DATA, NULL) + 90000.0)/100.0, &fHours)*100;
fMinutes = modff(fHours/100.0, &fHours)*100;
@@ -177,13 +181,13 @@
break;
case 10:
sprintf(altitudeFULL, "%s%s", altitudeFULL, DATA);
- m = 1;
+ info = 0;
reasonable = false;
readable = true;
break;
}
- m++;
+ info++;
//sizeof
}
}
@@ -217,4 +221,4 @@
latitudeFULL = "\0";
timeFULL = "\0";
altitudeFULL = "\0";
-}
\ No newline at end of file
+}
--- a/GPS.h Thu May 03 14:19:36 2018 +0000
+++ b/GPS.h Fri May 04 15:16:02 2018 +0000
@@ -79,7 +79,7 @@
Serial serial;
bool reasonable;
char buf[100];
- int Degrees, Minutes, Hours, m;
+ int info, Degrees, Minutes, Hours;
float fDegrees, fMinutes, Seconds, fHours;
void gpscmd(char *command);
void getstring(char DATA[]);