Skip to content

Commit

Permalink
Update lib fix gps coordinates
Browse files Browse the repository at this point in the history
  • Loading branch information
lewisxhe committed Sep 2, 2024
1 parent 0cf16f4 commit da935be
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 18 deletions.
16 changes: 10 additions & 6 deletions lib/TinyGSM/src/TinyGsmClientA7608.h
Original file line number Diff line number Diff line change
Expand Up @@ -573,9 +573,9 @@ class TinyGsmA7608 : public TinyGsmModem<TinyGsmA7608>,
if (fixMode == 1 || fixMode == 2 || fixMode == 3) {
// init variables
float ilat = 0;
// char north;
char north;
float ilon = 0;
// char east;
char east;
float ispeed = 0;
float ialt = 0;
int ivsat = 0;
Expand All @@ -595,10 +595,10 @@ class TinyGsmA7608 : public TinyGsmModem<TinyGsmA7608>,
streamSkipUntil(','); // GLONASS-SVs satellite valid numbers
streamSkipUntil(','); // GALILEO-SVs satellite valid numbers
ilat = streamGetFloatBefore(','); // Latitude in ddmm.mmmmmm
/* north = */stream.read(); // N/S Indicator, N=north or S=south
north = stream.read(); // N/S Indicator, N=north or S=south
streamSkipUntil(',');
ilon = streamGetFloatBefore(','); // Longitude in ddmm.mmmmmm
/* east = */stream.read(); // E/W Indicator, E=east or W=west
east = stream.read(); // E/W Indicator, E=east or W=west
streamSkipUntil(',');

// Date. Output format is ddmmyy
Expand All @@ -623,8 +623,12 @@ class TinyGsmA7608 : public TinyGsmModem<TinyGsmA7608>,
*status = fixMode;
}
// Set pointers
if (lat != NULL) *lat = ilat;
if (lon != NULL) *lon = ilon;
if (lat != NULL){
*lat = (ilat) * (north == 'N' ? 1 : -1);
}
if (lon != NULL){
*lon = (ilon) * (east == 'E' ? 1 : -1);
}
if (speed != NULL) *speed = ispeed;
if (alt != NULL) *alt = ialt;
if (vsat != NULL) *vsat = ivsat;
Expand Down
12 changes: 6 additions & 6 deletions lib/TinyGSM/src/TinyGsmClientA7670.h
Original file line number Diff line number Diff line change
Expand Up @@ -568,9 +568,9 @@ class TinyGsmA7670 : public TinyGsmModem<TinyGsmA7670>,
if (fixMode == 1 || fixMode == 2 || fixMode == 3) {
// init variables
float ilat = 0;
// char north;
char north;
float ilon = 0;
// char east;
char east;
float ispeed = 0;
float ialt = 0;
int ivsat = 0;
Expand All @@ -588,10 +588,10 @@ class TinyGsmA7670 : public TinyGsmModem<TinyGsmA7670>,
streamSkipUntil(','); // skip dump , A7670
streamSkipUntil(','); // BEIDOU satellite valid numbers
ilat = streamGetFloatBefore(','); // Latitude in ddmm.mmmmmm
/* north = */stream.read(); // N/S Indicator, N=north or S=south
north = stream.read(); // N/S Indicator, N=north or S=south
streamSkipUntil(',');
ilon = streamGetFloatBefore(','); // Longitude in ddmm.mmmmmm
/* east = */stream.read(); // E/W Indicator, E=east or W=west
east = stream.read(); // E/W Indicator, E=east or W=west
streamSkipUntil(',');

// Date. Output format is ddmmyy
Expand All @@ -618,10 +618,10 @@ class TinyGsmA7670 : public TinyGsmModem<TinyGsmA7670>,
}
// Set pointers
if (lat != NULL){
*lat = ilat;
*lat = (ilat) * (north == 'N' ? 1 : -1);
}
if (lon != NULL){
*lon = ilon;
*lon = (ilon) * (east == 'E' ? 1 : -1);
}
if (speed != NULL) *speed = ispeed;
if (alt != NULL) *alt = ialt;
Expand Down
12 changes: 6 additions & 6 deletions lib/TinyGSM/src/TinyGsmClientSIM7672.h
Original file line number Diff line number Diff line change
Expand Up @@ -504,9 +504,9 @@ class TinyGsmSim7672 : public TinyGsmModem<TinyGsmSim7672>,
if (fixMode == 1 || fixMode == 2 || fixMode == 3) {
// init variables
float ilat = 0;
// char north;
char north;
float ilon = 0;
// char east;
char east;
float ispeed = 0;
float ialt = 0;
int ivsat = 0;
Expand All @@ -524,10 +524,10 @@ class TinyGsmSim7672 : public TinyGsmModem<TinyGsmSim7672>,
streamSkipUntil(','); // BEIDOU satellite valid numbers
streamSkipUntil(',');
ilat = streamGetFloatBefore(','); // Latitude in ddmm.mmmmmm
/* north = */stream.read(); // N/S Indicator, N=north or S=south
north = stream.read(); // N/S Indicator, N=north or S=south
streamSkipUntil(',');
ilon = streamGetFloatBefore(','); // Longitude in ddmm.mmmmmm
/* east = */stream.read(); // E/W Indicator, E=east or W=west
east = stream.read(); // E/W Indicator, E=east or W=west
streamSkipUntil(',');

// Date. Output format is ddmmyy
Expand Down Expand Up @@ -555,10 +555,10 @@ class TinyGsmSim7672 : public TinyGsmModem<TinyGsmSim7672>,
}
// Set pointers
if (lat != NULL){
*lat = ilat;
*lat = (ilat) * (north == 'N' ? 1 : -1);
}
if (lon != NULL){
*lon = ilon;
*lon = (ilon) * (east == 'E' ? 1 : -1);
}
if (speed != NULL) *speed = ispeed;
if (alt != NULL) *alt = ialt;
Expand Down

0 comments on commit da935be

Please sign in to comment.