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
diff --git a/firmware/ice40-riscv/icE1usb/gps.c b/firmware/ice40-riscv/icE1usb/gps.c
index 49798fd..6f8480f 100644
--- a/firmware/ice40-riscv/icE1usb/gps.c
+++ b/firmware/ice40-riscv/icE1usb/gps.c
@@ -161,12 +161,10 @@
_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');
}
}