summaryrefslogtreecommitdiff
path: root/gpsd_json.c
diff options
context:
space:
mode:
authorGary E. Miller <gem@rellim.com>2019-05-06 12:24:51 -0700
committerGary E. Miller <gem@rellim.com>2019-05-06 12:24:51 -0700
commit16bdab87537085e0d3f5bdc9e9aa495f7d1ede82 (patch)
treedc867c3ee1ac9c3e94851c230408e55e661d0987 /gpsd_json.c
parent41141c03a4cfa52e78f66557aefe6bbb41d651f5 (diff)
downloadgpsd-16bdab87537085e0d3f5bdc9e9aa495f7d1ede82.tar.gz
gpsd_json: Filter out PRN from SKY w/o Elevation and Azimuth
NMEA says to not report bad elevation and azimuth, so follow that advice. This only affects some u-blox 8 binary, and one odd GREIS regression.
Diffstat (limited to 'gpsd_json.c')
-rw-r--r--gpsd_json.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/gpsd_json.c b/gpsd_json.c
index d6fa2ee0..053490d1 100644
--- a/gpsd_json.c
+++ b/gpsd_json.c
@@ -348,6 +348,13 @@ void json_sky_dump(const struct gps_data_t *datap,
(void)strlcat(reply, "\"satellites\":[", replylen);
for (i = 0; i < reported; i++) {
if (datap->skyview[i].PRN) {
+ if (-90 > datap->skyview[i].elevation ||
+ 90 < datap->skyview[i].elevation ||
+ 0 > datap->skyview[i].azimuth ||
+ 360 < datap->skyview[i].azimuth) {
+ /* do not report PRN w/o valid elevation and azimuth */
+ continue;
+ }
str_appendf(reply, replylen,
"{\"PRN\":%d,\"el\":%d,\"az\":%d,\"ss\":%.0f,\"used\":%s",
datap->skyview[i].PRN,