From 3ace827de5907ee77ffdfcf54b0822a1e65570ea Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Tue, 6 Oct 2020 18:54:27 -0700 Subject: [PATCH] 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 --- altoslib/AltosTelemetryLocation.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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); } } -- 2.30.2