* Track flight state from telemetry or eeprom data stream
*/
-package org.altusmetrum.altoslib_3;
+package org.altusmetrum.altoslib_4;
public class AltosState implements Cloneable {
private AltosGpsAltitude gps_altitude;
+ private AltosValue gps_ground_speed;
+ private AltosValue gps_ascent_rate;
+ private AltosValue gps_course;
+
public double altitude() {
double a = altitude.value();
if (a != AltosLib.MISSING)
gps_altitude.set(new_gps_altitude, time);
}
+ public double gps_ground_speed() {
+ return gps_ground_speed.value();
+ }
+
+ public double gps_ascent_rate() {
+ return gps_ascent_rate.value();
+ }
+
+ public double gps_course() {
+ return gps_course.value();
+ }
+
class AltosPressure extends AltosValue {
void set(double p, double time) {
super.set(p, time);
public double ground_accel_avg;
public int log_format;
+ public String product;
public AltosMs5607 baro;
public AltosCompanion companion;
+ public int pyro_fired;
+
public void set_npad(int npad) {
this.npad = npad;
gps_waiting = MIN_PAD_SAMPLES - npad;
gps_altitude = new AltosGpsAltitude();
gps_ground_altitude = new AltosGpsGroundAltitude();
+ gps_ground_speed = new AltosValue();
+ gps_ascent_rate = new AltosValue();
+ gps_course = new AltosValue();
speak_tick = AltosLib.MISSING;
speak_altitude = AltosLib.MISSING;
ground_accel_avg = AltosLib.MISSING;
log_format = AltosLib.MISSING;
+ product = null;
serial = AltosLib.MISSING;
receiver_serial = AltosLib.MISSING;
baro = null;
companion = null;
+
+ pyro_fired = 0;
}
void finish_update() {
gps_altitude.copy(old.gps_altitude);
gps_ground_altitude.copy(old.gps_ground_altitude);
+ gps_ground_speed.copy(old.gps_ground_speed);
+ gps_ascent_rate.copy(old.gps_ascent_rate);
+ gps_course.copy(old.gps_course);
pad_lat = old.pad_lat;
pad_lon = old.pad_lon;
ground_accel_avg = old.ground_accel_avg;
log_format = old.log_format;
+ product = old.product;
serial = old.serial;
receiver_serial = old.receiver_serial;
baro = old.baro;
companion = old.companion;
+
+ pyro_fired = old.pyro_fired;
}
void update_time() {
gps_ground_altitude.set(gps.alt, time);
}
gps_altitude.set(gps.alt, time);
+ if (gps.climb_rate != AltosLib.MISSING)
+ gps_ascent_rate.set(gps.climb_rate, time);
+ if (gps.ground_speed != AltosLib.MISSING)
+ gps_ground_speed.set(gps.ground_speed, time);
+ if (gps.course != AltosLib.MISSING)
+ gps_course.set(gps.course, time);
}
if (gps.lat != 0 && gps.lon != 0 &&
pad_lat != AltosLib.MISSING &&
this.device_type = device_type;
}
- public void set_config(int major, int minor, int apogee_delay, int main_deploy, int flight_log_max) {
- config_major = major;
- config_minor = minor;
+ public void set_flight_params(int apogee_delay, int main_deploy) {
this.apogee_delay = apogee_delay;
this.main_deploy = main_deploy;
+ }
+
+ public void set_config(int major, int minor, int flight_log_max) {
+ config_major = major;
+ config_minor = minor;
this.flight_log_max = flight_log_max;
}
this.ignitor_voltage = voltage;
}
+ public void set_pyro_fired(int fired) {
+ this.pyro_fired = fired;
+ }
+
public double time_since_boost() {
if (tick == AltosLib.MISSING)
return 0.0;