X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=altoslib%2FAltosFlightSeries.java;h=3e2a05ec8f9b162f287eb869cc43b7a841f52d10;hb=8ec59ee5a6dda114ff55a4af4669842eed5ef79a;hp=7e643d9651359a10455504418766048ba024e60c;hpb=2c2eb1a15e745bb67721a1e3d84fb2fc0ce64eb1;p=fw%2Faltos diff --git a/altoslib/AltosFlightSeries.java b/altoslib/AltosFlightSeries.java index 7e643d96..3e2a05ec 100644 --- a/altoslib/AltosFlightSeries.java +++ b/altoslib/AltosFlightSeries.java @@ -143,6 +143,10 @@ public class AltosFlightSeries extends AltosDataListener { public static final String state_name = "State"; public void set_state(int state) { + + if (state == AltosLib.ao_flight_pad) + return; + if (state_series == null) state_series = add_series(state_name, AltosConvert.state_name); else if (this.state == state) @@ -156,9 +160,11 @@ public class AltosFlightSeries extends AltosDataListener { public static final String accel_name = "Accel"; public void set_acceleration(double acceleration) { - if (accel_series == null) { + if (acceleration == AltosLib.MISSING) + return; + if (accel_series == null) accel_series = add_series(accel_name, AltosConvert.accel); - } + accel_series.add(time(), acceleration); } @@ -181,17 +187,11 @@ public class AltosFlightSeries extends AltosDataListener { public static final String rssi_name = "RSSI"; - public AltosTimeSeries status_series; - - public static final String status_name = "Radio Status"; - public void set_rssi(int rssi, int status) { if (rssi_series == null) { rssi_series = add_series(rssi_name, null); - status_series = add_series(status_name, null); } rssi_series.add(time(), rssi); - status_series.add(time(), status); } public AltosTimeSeries pressure_series; @@ -207,12 +207,18 @@ public class AltosFlightSeries extends AltosDataListener { public static final String height_name = "Height"; public void set_pressure(double pa) { + if (pa == AltosLib.MISSING) + return; + if (pressure_series == null) pressure_series = add_series(pressure_name, AltosConvert.pressure); pressure_series.add(time(), pa); if (altitude_series == null) altitude_series = add_series(altitude_name, AltosConvert.height); + if (cal_data.ground_pressure == AltosLib.MISSING) + cal_data.set_ground_pressure(pa); + double altitude = AltosConvert.pressure_to_altitude(pa); altitude_series.add(time(), altitude); } @@ -224,6 +230,13 @@ public class AltosFlightSeries extends AltosDataListener { for (AltosTimeValue alt : altitude_series) height_series.add(alt.time, alt.value - ground_altitude); } + + if (gps_height == null && cal_data.gps_pad != null && gps_altitude != null) { + double gps_ground_altitude = cal_data.gps_pad.alt; + gps_height = add_series(gps_height_name, AltosConvert.height); + for (AltosTimeValue gps_alt : gps_altitude) + gps_height.add(gps_alt.time, gps_alt.value - gps_ground_altitude); + } } public AltosTimeSeries speed_series; @@ -417,28 +430,32 @@ public class AltosFlightSeries extends AltosDataListener { gps_vdop.add(time(), gps.vdop); } if (gps.locked) { - if (gps_altitude == null) { - gps_altitude = add_series(gps_altitude_name, AltosConvert.height); - gps_height = add_series(gps_height_name, AltosConvert.height); - gps_ground_speed = add_series(gps_ground_speed_name, AltosConvert.speed); - gps_ascent_rate = add_series(gps_ascent_rate_name, AltosConvert.speed); - gps_course = add_series(gps_course_name, null); - gps_speed = add_series(gps_speed_name, null); - } if (gps.alt != AltosLib.MISSING) { + if (gps_altitude == null) + gps_altitude = add_series(gps_altitude_name, AltosConvert.height); gps_altitude.add(time(), gps.alt); - if (cal_data.gps_pad != null) - gps_height.add(time(), gps.alt - cal_data.gps_pad.alt); } - if (gps.ground_speed != AltosLib.MISSING) + if (gps.ground_speed != AltosLib.MISSING) { + if (gps_ground_speed == null) + gps_ground_speed = add_series(gps_ground_speed_name, AltosConvert.speed); gps_ground_speed.add(time(), gps.ground_speed); - if (gps.climb_rate != AltosLib.MISSING) + } + if (gps.climb_rate != AltosLib.MISSING) { + if (gps_ascent_rate == null) + gps_ascent_rate = add_series(gps_ascent_rate_name, AltosConvert.speed); gps_ascent_rate.add(time(), gps.climb_rate); - if (gps.course != AltosLib.MISSING) + } + if (gps.course != AltosLib.MISSING) { + if (gps_course == null) + gps_course = add_series(gps_course_name, null); gps_course.add(time(), gps.course); - if (gps.ground_speed != AltosLib.MISSING && gps.climb_rate != AltosLib.MISSING) + } + if (gps.ground_speed != AltosLib.MISSING && gps.climb_rate != AltosLib.MISSING) { + if (gps_speed == null) + gps_speed = add_series(gps_speed_name, null); gps_speed.add(time(), Math.sqrt(gps.ground_speed * gps.ground_speed + gps.climb_rate * gps.climb_rate)); + } } if (gps.cc_gps_sat != null) { if (sats_in_view == null)