X-Git-Url: https://git.gag.com/?p=fw%2Faltos;a=blobdiff_plain;f=ao-tools%2Faltosui%2FAltosState.java;h=90e73f5eff42a3aadd83b4322047ee1e2cb029cf;hp=c13dfe68451adb303530d1619474568486c267f7;hb=1260589976c1a95848b298497fd251c4ee7d3f93;hpb=c443f43f8dee6e0fcbcecf9d09e948fd928b7af4 diff --git a/ao-tools/altosui/AltosState.java b/ao-tools/altosui/AltosState.java index c13dfe68..90e73f5e 100644 --- a/ao-tools/altosui/AltosState.java +++ b/ao-tools/altosui/AltosState.java @@ -64,6 +64,8 @@ public class AltosState { boolean gps_ready; AltosGreatCircle from_pad; + double elevation; /* from pad */ + double range; /* total distance */ double gps_height; @@ -78,7 +80,7 @@ public class AltosState { data = cur; ground_altitude = data.ground_altitude(); - height = data.altitude() - ground_altitude; + height = data.filtered_altitude() - ground_altitude; report_time = System.currentTimeMillis(); @@ -124,7 +126,7 @@ public class AltosState { } if (state == Altos.ao_flight_pad) { - if (data.gps != null && data.gps.locked && data.gps.nsat >= 4) { + if (data.gps != null && data.gps.locked) { npad++; if (npad > 1) { /* filter pad position */ @@ -161,11 +163,18 @@ public class AltosState { if (data.gps != null) { if (gps == null || !gps.locked || data.gps.locked) gps = data.gps; - if (npad > 0 && gps.locked) + if (npad > 0 && gps.locked) { from_pad = new AltosGreatCircle(pad_lat, pad_lon, gps.lat, gps.lon); + } } + elevation = 0; + range = -1; if (npad > 0) { gps_height = gps.alt - pad_alt; + if (from_pad != null) { + elevation = Math.atan2(height, from_pad.distance) * 180 / Math.PI; + range = Math.sqrt(height * height + from_pad.distance * from_pad.distance); + } } else { gps_height = 0; }