while (1)
{
gpsFixType = g_GNSS.getFixType(); // Get the fix type
if (gpsFixType == 3 && g_GNSS.getGnssFixOk())
{
SERIAL_LOG("FixType 3 and GnnsFixOK");
break;
}
else
{
delay(500);
}
if ((millis() - gpsStart) > gnssTimeout)
{
SERIAL_LOG("GNSS fix timeout: %u > %u", (millis() - gpsStart), gnssTimeout);
break;
}
SERIAL_LOG("FixType: %d", gpsFixType);
}
Should i not be enough to check if getGnssFixOk() is true? What if we jump from fixtype 2 to fixtype 4?
The delay is 500ms here, is that a good thing? Should it be configurable? We really don't care that much about getting a fix quickly, we might as well make it 2 seconds and 'sleep' more and not waste CPU cycles on this.
We have done a few pushes that check GNNSFIXOK and the HDOP value, which allows for better accuracy.
What we changed and why?
HDOP allows us to set some accuracy options. We considered PostionAccuracy as well, but that didn't result in the desired behaviour.
We did change the delay to 1000ms, as we can do that. With powersave modes, we actually end up getting a fix really quickly, so making it longer than 1 second seems to be wrong.
We have this block of code:
Should i not be enough to check if
getGnssFixOk()
is true? What if we jump from fixtype 2 to fixtype 4? The delay is 500ms here, is that a good thing? Should it be configurable? We really don't care that much about getting a fix quickly, we might as well make it 2 seconds and 'sleep' more and not waste CPU cycles on this.