+ public boolean boost; /* under power */
+ public int rssi;
+ public int status;
+ public int device_type;
+ public int config_major;
+ public int config_minor;
+ public int apogee_delay;
+ public int main_deploy;
+ public int flight_log_max;
+
+ private double pressure_to_altitude(double p) {
+ if (p == AltosLib.MISSING)
+ return AltosLib.MISSING;
+ return AltosConvert.pressure_to_altitude(p);
+ }
+
+ private AltosCValue ground_altitude;
+
+ public double ground_altitude() {
+ return ground_altitude.value();
+ }
+
+ public void set_ground_altitude(double a) {
+ ground_altitude.set_measured(a, time);
+ }
+
+ class AltosGpsGroundAltitude extends AltosValue implements Serializable {
+ void set(double a, double t) {
+ super.set(a, t);
+ pad_alt = value();
+ gps_altitude.set_gps_height();
+ }
+
+ void set_filtered(double a, double t) {
+ super.set_filtered(a, t);
+ pad_alt = value();
+ gps_altitude.set_gps_height();
+ }
+ }
+
+ private AltosGpsGroundAltitude gps_ground_altitude;
+
+ public double gps_ground_altitude() {
+ return gps_ground_altitude.value();
+ }
+
+ public void set_gps_ground_altitude(double a) {
+ gps_ground_altitude.set(a, time);
+ }
+
+ class AltosGroundPressure extends AltosCValue implements Serializable {
+ void set_filtered(double p, double time) {
+ computed.set_filtered(p, time);
+ if (!is_measured())
+ ground_altitude.set_computed(pressure_to_altitude(computed.value()), time);
+ }
+
+ void set_measured(double p, double time) {
+ super.set_measured(p, time);
+ ground_altitude.set_computed(pressure_to_altitude(p), time);
+ }
+ }
+
+ private AltosGroundPressure ground_pressure;
+
+ public double ground_pressure() {
+ return ground_pressure.value();
+ }
+
+ public void set_ground_pressure (double pressure) {
+ ground_pressure.set_measured(pressure, time);
+ }
+
+ class AltosAltitude extends AltosCValue implements Serializable {
+
+ private void set_speed(AltosValue v) {
+ if (!acceleration.is_measured() || !ascent)
+ speed.set_derivative(this);
+ }
+
+ void set_computed(double a, double time) {
+ super.set_computed(a,time);
+ set_speed(computed);
+ set |= set_position;
+ }
+
+ void set_measured(double a, double time) {
+ super.set_measured(a,time);
+ set_speed(measured);
+ set |= set_position;
+ }
+ }
+
+ private AltosAltitude altitude;
+
+ class AltosGpsAltitude extends AltosValue implements Serializable {
+
+ private void set_gps_height() {
+ double a = value();
+ double g = gps_ground_altitude.value();
+
+ if (a != AltosLib.MISSING && g != AltosLib.MISSING)
+ gps_height = a - g;
+ else
+ gps_height = AltosLib.MISSING;
+ }
+
+ void set(double a, double t) {
+ super.set(a, t);
+ set_gps_height();
+ }
+ }
+
+ private AltosGpsAltitude gps_altitude;
+
+ private AltosValue gps_ground_speed;
+ private AltosValue gps_ascent_rate;
+ private AltosValue gps_course;
+ private AltosValue gps_speed;
+
+ public double altitude() {
+ double a = altitude.value();
+ if (a != AltosLib.MISSING)
+ return a;
+ return gps_altitude.value();
+ }
+
+ public double max_altitude() {
+ double a = altitude.max();
+ if (a != AltosLib.MISSING)
+ return a;
+ return gps_altitude.max();
+ }
+
+ public void set_altitude(double new_altitude) {
+ altitude.set_measured(new_altitude, time);
+ }
+
+ public double gps_altitude() {
+ return gps_altitude.value();
+ }
+
+ public double max_gps_altitude() {
+ return gps_altitude.max();
+ }
+
+ public void set_gps_altitude(double new_gps_altitude) {
+ gps_altitude.set(new_gps_altitude, time);
+ }
+
+ public double gps_ground_speed() {
+ return gps_ground_speed.value();
+ }
+
+ public double max_gps_ground_speed() {
+ return gps_ground_speed.max();
+ }
+
+ public double gps_ascent_rate() {
+ return gps_ascent_rate.value();
+ }
+
+ public double max_gps_ascent_rate() {
+ return gps_ascent_rate.max();
+ }
+
+ public double gps_course() {
+ return gps_course.value();
+ }
+
+ public double gps_speed() {
+ return gps_speed.value();
+ }
+
+ public double max_gps_speed() {
+ return gps_speed.max();
+ }
+
+ class AltosPressure extends AltosValue implements Serializable {
+ void set(double p, double time) {
+ super.set(p, time);
+ if (state == AltosLib.ao_flight_pad)
+ ground_pressure.set_filtered(p, time);
+ double a = pressure_to_altitude(p);
+ altitude.set_computed(a, time);
+ }
+ }
+
+ private AltosPressure pressure;
+
+ public double pressure() {
+ return pressure.value();
+ }
+
+ public void set_pressure(double p) {
+ pressure.set(p, time);
+ }
+
+ public double baro_height() {
+ double a = altitude();
+ double g = ground_altitude();
+ if (a != AltosLib.MISSING && g != AltosLib.MISSING)
+ return a - g;
+ return AltosLib.MISSING;
+ }
+
+ public double height() {
+ double k = kalman_height.value();
+ if (k != AltosLib.MISSING)
+ return k;
+
+ double b = baro_height();
+ if (b != AltosLib.MISSING)
+ return b;