gps.c: Adjust $GPsts parser to what I observe with GPS03

The behavior I observe is as follows:

* $PERC,GPsts,0,0,0... on cold start
* $PERC,GPsts,1,0,0... once it has a fix
* $PERC,GPsts,2,0,0... if fix persists for long time
* $PERC,GPsts,3,0,0... if antenna disconnects after fix
* $PERC,GPsts,2,0,0... if antenna is re-connected

Change-Id: Id8f4c0d9a91edb52dace9b64f3b3d97443256eee
This commit is contained in:
Harald Welte 2022-09-05 20:26:48 +02:00
parent e343d94a63
commit e3ff9086b8
1 changed files with 2 additions and 4 deletions

View File

@ -161,12 +161,10 @@ void
_gps_parse_nmea(const char *nmea)
{
/* Very basic parsing, we just look at $PERC,GPsts message for
* state 1 and 2 */
* state 1 (survey mode) and 2 (position-hold) */
if (!strncmp(nmea, "$PERC,GPsts,", 12))
{
g_gps.fix.valid =
((nmea[12] == '1') || (nmea[12] == '2')) &&
(nmea[16] == '2');
g_gps.fix.valid = (nmea[12] == '1') || (nmea[12] == '2');
}
}