GPS for mbed
Fork of GPS by
Revision 1:f491b73cbbcf, committed 2017-01-15
- Comitter:
- Happy111
- Date:
- Sun Jan 15 16:05:12 2017 +0000
- Parent:
- 0:0f423a982334
- Commit message:
- MPOA_GPS
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 Fri Jul 27 15:07:00 2012 +0000 +++ b/GPS.cpp Sun Jan 15 16:05:12 2017 +0000 @@ -20,7 +20,7 @@ getline(); // 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(sscanf(msg, "GPGGA,%f,%f,%c,%f,%c,%d,%d", &time, &latitude, &ns, &longitude, &ew, &lock, &snum) >= 1) { if(!lock) { longitude = 0.0; latitude = 0.0; @@ -34,9 +34,75 @@ degrees = trunc(longitude / 100.0f * 0.01f); minutes = longitude - (degrees * 100.0f); longitude = degrees + minutes / 60.0f; - return 1; + xns = ns; + xtime = time; + xew = ew; + //return 1; } } + /* + Parsing GSV message + totmsg - total number of messages in cycle + actmsg - message number + siv - number of SVs in view + prn - SV PRN number + svele - elevation + svaz - azimuth + */ + if(sscanf(msg, "GPGSV,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d", &totmsg, &actmsg, &siv, &tempprn1, &tempsvele1, &tempsvaz1, &tempprn2, &tempsvele2, &tempsvaz2, &tempprn3, &tempsvele3, &tempsvaz3, &tempprn4, &tempsvele4, &tempsvaz4) >= 1) { + if(!lock) { + totmsg = 0; + actmsg = 0; + siv = 0; + tempprn1 = 0; + tempsvele1 = 0; + tempsvaz1 = 0; + tempprn2 = 0; + tempsvele2 = 0; + tempsvaz2 = 0; + tempprn3 = 0; + tempsvele3 = 0; + tempsvaz3 = 0; + tempprn4 = 0; + tempsvele4 = 0; + tempsvaz4 = 0; + return 0; + } else { + if(actmsg==1){ + prn1 = tempprn1; + svele1 = tempsvele1; + svaz1 = tempsvaz1; + prn2 = tempprn2; + svele2 = tempsvele2; + svaz2 = tempsvaz2; + prn3 = tempprn3; + svele3 = tempsvele3; + svaz3 = tempsvaz3; + prn4 = tempprn4; + svele4 = tempsvele4; + svaz4 = tempsvaz4; + return 1; + } + //naznačené řešení pro příjem druhé čtveřice údají o satelitech + /*if(actmsg==2){ + prn5 = tempprn1; + svele5 = tempsvele1; + svaz5 = tempsvaz1; + prn6 = tempprn2; + svele6 = tempsvele2; + svaz6 = tempsvaz2; + prn7 = tempprn3; + svele7 = tempsvele3; + svaz7 = tempsvaz3; + prn8 = tempprn4; + svele8 = tempsvele4; + svaz8 = tempsvaz4; + return 1; + }*/ + + } + } + } }
--- a/GPS.h Fri Jul 27 15:07:00 2012 +0000 +++ b/GPS.h Sun Jan 15 16:05:12 2017 +0000 @@ -36,6 +36,52 @@ * The latitude (call sample() to set) */ float latitude; + char xns; + float xtime; + char xew; + int snum; + + int totmsg; + int actmsg; + int siv; + int prn1; + int svele1; + int svaz1; + int prn2; + int svele2; + int svaz2; + int prn3; + int svele3; + int svaz3; + int prn4; + int svele4; + int svaz4; + /* + int prn5; + int svele5; + int svaz5; + int prn6; + int svele6; + int svaz6; + int prn7; + int svele7; + int svaz7; + int prn8; + int svele8; + int svaz8; + */ + int tempprn1; + int tempsvele1; + int tempsvaz1; + int tempprn2; + int tempsvele2; + int tempsvaz2; + int tempprn3; + int tempsvele3; + int tempsvaz3; + int tempprn4; + int tempsvele4; + int tempsvaz4; private: