private double set_time;
private double prev_set_time;
+ boolean can_max() { return true; }
+
void set(double new_value, double time) {
if (new_value != AltosLib.MISSING) {
value = new_value;
- if (max_value == AltosLib.MISSING || value > max_value) {
+ if (can_max() && (max_value == AltosLib.MISSING || value > max_value))
max_value = value;
- }
set_time = time;
}
}
void set_derivative(AltosValue in) {
double n = in.rate();
-
+
if (n == AltosLib.MISSING)
return;
/* Clip changes to reduce noise */
double ddt = in.time() - pt;
double ddv = (n - p) / ddt;
-
+
final double max = 100000;
/* 100gs */
void set_integral(AltosValue in) {
computed.set_integral(in);
}
-
+
void set_integral(AltosCValue in) {
set_integral(in.altos_value());
}
-
+
void copy(AltosCValue old) {
measured.copy(old.measured);
computed.copy(old.computed);
}
private AltosGroundPressure ground_pressure;
-
+
public double ground_pressure() {
return ground_pressure.value();
}
}
class AltosSpeed extends AltosCValue {
-
+
+ boolean can_max() {
+ return state < AltosLib.ao_flight_fast;
+ }
+
void set_accel() {
acceleration.set_derivative(this);
}
}
class AltosAccel extends AltosCValue {
+
+ boolean can_max() {
+ return state < AltosLib.ao_flight_fast;
+ }
+
void set_measured(double a, double time) {
super.set_measured(a, time);
if (ascent)
public AltosCompanion companion;
+ public int pyro_fired;
+
public void set_npad(int npad) {
this.npad = npad;
gps_waiting = MIN_PAD_SAMPLES - npad;
baro = null;
companion = null;
+
+ pyro_fired = 0;
}
void finish_update() {
time = old.time;
time_change = old.time_change;
prev_time = old.time;
-
+
tick = old.tick;
prev_tick = old.tick;
boost_tick = old.boost_tick;
apogee_delay = old.apogee_delay;
main_deploy = old.main_deploy;
flight_log_max = old.flight_log_max;
-
+
set = 0;
ground_pressure.copy(old.ground_pressure);
baro = old.baro;
companion = old.companion;
+
+ pyro_fired = old.pyro_fired;
}
-
+
void update_time() {
}
void update_gps() {
elevation = 0;
range = -1;
- gps_height = 0;
if (gps == null)
return;
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;