You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The function gps_storelocation(gpsStatus_t *gps_store) does check for .isUpdated(), but the updated flag is already reset while showing on the display. (push the button a few times to display GPS data)
This causes the gps_store data not to get updated and thus the random data of this struct (because it isn't initialized in the constructor) is sent to LoRa.
Then in the 2 places where this function is called, check for its return value:
#if (HAS_GPS)
if (GPSPORT == COUNTERPORT) {
// send GPS position only if we have a fixif (gps_hasfix()) {
if (gps_storelocation(&gps_status))
payload.addGPS(gps_status);
} elseESP_LOGD(TAG, "No valid GPS position");
}
#endif
#if (HAS_GPS)
case GPS_DATA:
if (GPSPORT != COUNTERPORT) {
// send GPS position only if we have a fixif (gps_hasfix()) {
if (gps_storelocation(&gps_status)) {
payload.reset();
payload.addGPS(gps_status);
SendPayload(GPSPORT);
}
} elseESP_LOGD(TAG, "No valid GPS position");
}
break;
#endif
This way, at least no bogus data is being sent to LoRa.
Tomorrow I will look into how we can read the GPS data without resetting the updated flag (or keep track of updated state elsewhere outside TinyGPS+)
The text was updated successfully, but these errors were encountered:
TD-er
added a commit
to TD-er/ESP32-Paxcounter
that referenced
this issue
Jun 11, 2024
The function
gps_storelocation(gpsStatus_t *gps_store)
does check for.isUpdated()
, but the updated flag is already reset while showing on the display. (push the button a few times to display GPS data)This causes the
gps_store
data not to get updated and thus the random data of this struct (because it isn't initialized in the constructor) is sent to LoRa.Proposal:
Change the function to return a bool:
And make sure to initialize the struct:
Then in the 2 places where this function is called, check for its return value:
This way, at least no bogus data is being sent to LoRa.
Tomorrow I will look into how we can read the GPS data without resetting the updated flag (or keep track of updated state elsewhere outside TinyGPS+)
The text was updated successfully, but these errors were encountered: