summaryrefslogtreecommitdiff
path: root/driver_nmea0183.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2014-08-25 16:50:06 -0400
committerEric S. Raymond <esr@thyrsus.com>2014-08-25 16:50:06 -0400
commit424d189f0073d0cfffa95e5b0e8358ef8623ab87 (patch)
tree5b7af82b1077745269238dc1b152f592d76985b7 /driver_nmea0183.c
parent6774530c498d9b883ecdfd8bd61e65b491063092 (diff)
downloadgpsd-424d189f0073d0cfffa95e5b0e8358ef8623ab87.tar.gz
Accumulate GNSS+GLONASS satelite reports.
This isn't ideal. Wgen a GPS emits both we get two SKY reports per cycle, with the second one cumulative.
Diffstat (limited to 'driver_nmea0183.c')
-rw-r--r--driver_nmea0183.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/driver_nmea0183.c b/driver_nmea0183.c
index d400bc7a..a7ef0d0b 100644
--- a/driver_nmea0183.c
+++ b/driver_nmea0183.c
@@ -541,6 +541,10 @@ static gps_mask_t processGSV(int count, char *field[],
* 46 Signal-to-noise ratio in decibels
* <repeat for up to 4 satellites per sentence>
* There my be up to three GSV sentences in a data packet
+ *
+ * Can occur with talker ID GP (GNSS) or GL (GLONASS). In the GLONASS
+ * version sat IDs start at 65. At least one GPS, the BU-353 GLONASS,
+ * emits a GPGSV set followed by a GLGSV set. We need to combine these.
*/
int n, fldnum;
if (count <= 3) {
@@ -565,8 +569,13 @@ static gps_mask_t processGSV(int count, char *field[],
gpsd_report(session->context->debug, LOG_WARN, "malformed GPGSV - bad part\n");
gpsd_zero_satellites(&session->gpsdata);
return ONLINE_SET;
- } else if (session->nmea.part == 1)
- gpsd_zero_satellites(&session->gpsdata);
+ } else if (session->nmea.part == 1) {
+ /* might have gone from GPGSV to GLGSV, in which case accumulate */
+ if (session->nmea.last_gsv_talker == '\0' || field[0][3] == session->nmea.last_gsv_talker) {
+ gpsd_zero_satellites(&session->gpsdata);
+ }
+ session->nmea.last_gsv_talker = field[0][2];
+ }
for (fldnum = 4; fldnum < count;) {
if (session->gpsdata.satellites_visible >= MAXCHANNELS) {
@@ -1312,6 +1321,10 @@ gps_mask_t nmea_parse(char *sentence, struct gps_device_t * session)
}
}
+ /* prevent overaccumulation of sat reports */
+ if (strncmp(session->nmea.field[0] + 2, "GSV", 3) !=0)
+ session->nmea.last_gsv_talker = '\0';
+
/* timestamp recording for fixes happens here */
if ((retval & TIME_SET) != 0) {
session->newdata.time = gpsd_utc_resolve(session);