cyclops1982 / RAKTracker

Example code that get's a distance measure and sends it via lora. First implementation. Very basic.
0 stars 0 forks source link

Review GNSS fix code #10

Closed cyclops1982 closed 5 months ago

cyclops1982 commented 1 year ago

We have this block of code:

  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.

cyclops1982 commented 5 months ago

We have done a few pushes that check GNNSFIXOK and the HDOP value, which allows for better accuracy.

What we changed and why?