mirror of
https://github.com/meshtastic/firmware.git
synced 2025-04-30 19:29:17 +00:00
fix a positional timestamp reading bug (#886)
* fix a positional timestamp reading bug * lying about fixType is no longer required
This commit is contained in:
parent
a914ee133c
commit
3893810b76
@ -170,28 +170,30 @@ bool UBloxGPS::lookForLocation()
|
|||||||
{
|
{
|
||||||
bool foundLocation = false;
|
bool foundLocation = false;
|
||||||
|
|
||||||
// catch fixType changes here, instead of whileActive()
|
|
||||||
if (ublox.moduleQueried.fixType) {
|
|
||||||
fixType = ublox.getFixType();
|
|
||||||
}
|
|
||||||
|
|
||||||
// check if GPS has an acceptable lock
|
|
||||||
if (! hasLock()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// check if a complete GPS solution set is available for reading
|
// check if a complete GPS solution set is available for reading
|
||||||
// (some of these, like lat/lon are redundant and can be removed)
|
// (some of these, like lat/lon are redundant and can be removed)
|
||||||
if ( ! (ublox.moduleQueried.latitude &&
|
if ( ! (ublox.moduleQueried.fixType &&
|
||||||
|
ublox.moduleQueried.latitude &&
|
||||||
ublox.moduleQueried.longitude &&
|
ublox.moduleQueried.longitude &&
|
||||||
ublox.moduleQueried.altitude &&
|
ublox.moduleQueried.altitude &&
|
||||||
ublox.moduleQueried.pDOP &&
|
ublox.moduleQueried.pDOP &&
|
||||||
ublox.moduleQueried.gpsiTOW))
|
ublox.moduleQueried.gpsDay))
|
||||||
{
|
{
|
||||||
// Not ready? No problem! We'll try again later.
|
// Not ready? No problem! We'll try again later.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fixType = ublox.getFixType();
|
||||||
|
#ifdef UBLOX_EXTRAVERBOSE
|
||||||
|
DEBUG_MSG("FixType=%d\n", fixType);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// check if GPS has an acceptable lock
|
||||||
|
if (! hasLock()) {
|
||||||
|
ublox.flushPVT(); // reset ALL freshness flags
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// read lat/lon/alt/dop data into temporary variables to avoid
|
// read lat/lon/alt/dop data into temporary variables to avoid
|
||||||
// overwriting global variables with potentially invalid data
|
// overwriting global variables with potentially invalid data
|
||||||
int32_t tmp_dop = ublox.getPDOP(0); // PDOP (an accuracy metric) is reported in 10^2 units so we have to scale down when we use it
|
int32_t tmp_dop = ublox.getPDOP(0); // PDOP (an accuracy metric) is reported in 10^2 units so we have to scale down when we use it
|
||||||
@ -241,9 +243,13 @@ bool UBloxGPS::lookForLocation()
|
|||||||
pos_timestamp = tmp_ts;
|
pos_timestamp = tmp_ts;
|
||||||
dop = tmp_dop;
|
dop = tmp_dop;
|
||||||
} else {
|
} else {
|
||||||
DEBUG_MSG("Invalid location discarded\n");
|
// INVALID solution - should never happen
|
||||||
|
DEBUG_MSG("Invalid location lat/lon/hae/dop %d/%d/%d/%d - discarded\n",
|
||||||
|
tmp_lat, tmp_lon, tmp_alt_hae, tmp_dop);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ublox.flushPVT(); // reset ALL freshness flags at the end
|
||||||
|
|
||||||
return foundLocation;
|
return foundLocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user