Skip to content

Commit

Permalink
display altitude too
Browse files Browse the repository at this point in the history
  • Loading branch information
ckuethe committed Jan 13, 2025
1 parent 7ad8a4d commit 2791161
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/rcmultispg.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,7 @@ def gps_worker(args: Namespace) -> None:
"""
ams.gauge_create("latitude")
ams.gauge_create("longitude")
ams.gauge_create("altitude")
ams.gauge_create("gps_mode")
ams.gauge_create("sats_seen")
ams.gauge_create("sats_used")
Expand All @@ -396,8 +397,11 @@ def gps_worker(args: Namespace) -> None:
try:
x = jloads(line)
if x["class"] == "SKY":
ams.gauge_update("sats_seen", int(x["nSat"]))
ams.gauge_update("sats_used", int(x["uSat"]))
try:
ams.gauge_update("sats_seen", int(x["nSat"]))
ams.gauge_update("sats_used", int(x["uSat"]))
except KeyError:
pass
if x["class"] != "TPV":
continue
if x["time"] == dedup:
Expand Down Expand Up @@ -428,6 +432,7 @@ def gps_worker(args: Namespace) -> None:
)
ams.gauge_update("latitude", tpv.payload["lat"])
ams.gauge_update("longitude", tpv.payload["lon"])
ams.gauge_update("altitude", tpv.payload.get("alt",-6378))
DATA_QUEUE.put(tpv)
except (KeyError, JSONDecodeError) as e: # skip bad messages, no fix, etc.
print(f"JSON processing error {e} in gps thread", file=stderr)
Expand Down

0 comments on commit 2791161

Please sign in to comment.