From: Keith Packard Date: Wed, 7 Oct 2020 01:54:27 +0000 (-0700) Subject: altoslib: Don't pass along GPS information when the GPS device is busted X-Git-Tag: 1.9.6~1^2~4 X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=3ace827de5907ee77ffdfcf54b0822a1e65570ea;hp=29c5336f775eacbfee354000c8b28de1813ede81;p=fw%2Faltos altoslib: Don't pass along GPS information when the GPS device is busted If the telemetry packet indicates that there's no functioning GPS receiver, then don't pass along those packets so that the UI displays things more accurately. Signed-off-by: Keith Packard --- diff --git a/altoslib/AltosTelemetryLocation.java b/altoslib/AltosTelemetryLocation.java index 7a281fdf..60a1d68c 100644 --- a/altoslib/AltosTelemetryLocation.java +++ b/altoslib/AltosTelemetryLocation.java @@ -50,7 +50,6 @@ public class AltosTelemetryLocation extends AltosTelemetryStandard { } public void provide_data(AltosDataListener listener) { - super.provide_data(listener); AltosCalData cal_data = listener.cal_data(); @@ -63,6 +62,8 @@ public class AltosTelemetryLocation extends AltosTelemetryStandard { gps.pdop = pdop() / 10.0; gps.hdop = hdop() / 10.0; gps.vdop = vdop() / 10.0; + if (gps.connected) + super.provide_data(listener); if (gps.locked) { gps.lat = latitude() * 1.0e-7; @@ -78,6 +79,7 @@ public class AltosTelemetryLocation extends AltosTelemetryStandard { gps.course = course() * 2; gps.climb_rate = climb_rate() * 1.0e-2; } - listener.set_gps(gps, true, false); + if (gps.connected) + listener.set_gps(gps, true, false); } }