diff options
author | Keith Packard <keithp@keithp.com> | 2019-09-25 13:10:36 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2019-09-25 13:10:36 -0700 |
commit | ff68c8855bc6983638db5102ffbc6822b83edb5d (patch) | |
tree | fad5d68814a491cd506f824bcf2bcbc74b8d51d0 | |
parent | 35351c7db337c4384ef642fbc8b8676f0944686a (diff) |
telegps: Get --graph mode working after recent changes
Was just exiting due to a null pointer exception caused by mis-ordered
setup of the map data. Also using stale API.
Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r-- | telegps/TeleGPS.java | 5 | ||||
-rw-r--r-- | telegps/TeleGPSGraphUI.java | 20 |
2 files changed, 17 insertions, 8 deletions
diff --git a/telegps/TeleGPS.java b/telegps/TeleGPS.java index af6d01b4..5df47202 100644 --- a/telegps/TeleGPS.java +++ b/telegps/TeleGPS.java @@ -650,7 +650,10 @@ public class TeleGPS } try { new TeleGPSGraphUI(set, file); - } catch (Exception e) { + } catch (IOException e) { + System.out.printf("Exception %s\n", e.toString()); + } catch (InterruptedException e) { + System.out.printf("Exception %s\n", e.toString()); return false; } return true; diff --git a/telegps/TeleGPSGraphUI.java b/telegps/TeleGPSGraphUI.java index 5d4fc9cf..b5a135c5 100644 --- a/telegps/TeleGPSGraphUI.java +++ b/telegps/TeleGPSGraphUI.java @@ -49,6 +49,7 @@ public class TeleGPSGraphUI extends AltosUIFrame implements AltosFontListener, A void fill_map(AltosFlightSeries flight_series) { boolean any_gps = false; AltosGPSTimeValue gtv_last = null; + double gps_pad_altitude = flight_series.cal_data().gps_pad_altitude;; if (flight_series.gps_series != null) { for (AltosGPSTimeValue gtv : flight_series.gps_series) { @@ -59,7 +60,9 @@ public class TeleGPSGraphUI extends AltosUIFrame implements AltosFontListener, A gps.nsat >= 4) { if (map == null) map = new AltosUIMap(); - map.show(gps, (int) flight_series.value_before(AltosFlightSeries.state_name, gtv.time)); + double gps_height = gps.alt - gps_pad_altitude; + int state = (int) flight_series.value_before(AltosFlightSeries.state_name, gtv.time); + map.show(gps, gtv.time, state, gps_height); this.gps = gps; has_gps = true; } @@ -67,8 +70,9 @@ public class TeleGPSGraphUI extends AltosUIFrame implements AltosFontListener, A } if (gtv_last != null) { int state = (int) flight_series.value_after(AltosFlightSeries.state_name, gtv_last.time); + double gps_height = gps.alt - gps_pad_altitude; if (state == AltosLib.ao_flight_landed) - map.show(gtv_last.gps, state); + map.show(gtv_last.gps, gtv_last.time, state, gps_height); } } @@ -113,17 +117,19 @@ public class TeleGPSGraphUI extends AltosUIFrame implements AltosFontListener, A super(file.getName()); AltosCalData cal_data = set.cal_data(); + pane = new JTabbedPane(); + flight_series = new AltosUIFlightSeries(cal_data); - set.capture_series(flight_series); - flight_series.finish(); - pane = new JTabbedPane(); + enable = new AltosUIEnable(this); - graph = new AltosGraph(enable, stats, flight_series); + set.capture_series(flight_series); + + flight_series.finish(); stats = new AltosFlightStats(flight_series); - enable = new AltosUIEnable(this); + graph = new AltosGraph(enable, stats, flight_series); statsTable = new AltosFlightStatsTable(stats); |