X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=altoslib%2FAltosFlightSeries.java;h=f7ea0d153ffc57678c5615d89ed985cc7e7d373d;hb=c6be13e8ef80e5afc836e04cbfe4cb17631540e4;hp=45d3b4563207a0c5f4f11309c6e41064ca107392;hpb=0da4e201041a4420f273c2e0cda77eea78099518;p=fw%2Faltos diff --git a/altoslib/AltosFlightSeries.java b/altoslib/AltosFlightSeries.java index 45d3b456..f7ea0d15 100644 --- a/altoslib/AltosFlightSeries.java +++ b/altoslib/AltosFlightSeries.java @@ -150,15 +150,13 @@ public class AltosFlightSeries extends AltosDataListener { 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) - return; - this.state = state; - state_series.add(time(), state); + if (state != AltosLib.ao_flight_pad && state != AltosLib.MISSING && state != AltosLib.ao_flight_stateless) { + if (state_series == null) + state_series = add_series(state_name, AltosConvert.state_name); + if (this.state() != state) + state_series.add(time(), state); + } + super.set_state(state); } public AltosTimeSeries accel_series; @@ -363,11 +361,11 @@ public class AltosFlightSeries extends AltosDataListener { double dt = time - prev_time; if (dt > 0) { - double roll = AltosConvert.degrees_to_radians(roll_v.value); - double pitch = AltosConvert.degrees_to_radians(gyro_pitch.value(time)); - double yaw = AltosConvert.degrees_to_radians(gyro_yaw.value(time)); + double roll = AltosConvert.degrees_to_radians(roll_v.value) * dt; + double pitch = AltosConvert.degrees_to_radians(gyro_pitch.value(time)) * dt; + double yaw = AltosConvert.degrees_to_radians(gyro_yaw.value(time)) * dt; - rotation.rotate(dt, pitch, yaw, roll); + rotation.rotate(pitch, yaw, roll); orient_series.add(time, rotation.tilt()); } prev_time = time; @@ -643,7 +641,7 @@ public class AltosFlightSeries extends AltosDataListener { public void set_igniter_voltage(double[] voltage) { int channels = voltage.length; if (igniter_voltage == null || igniter_voltage.length <= channels) { - AltosTimeSeries[] new_igniter_voltage = new AltosTimeSeries[channels + 1]; + AltosTimeSeries[] new_igniter_voltage = new AltosTimeSeries[channels]; int i = 0; if (igniter_voltage != null) {