projects
/
fw
/
altos
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
telegps: Working towards building fat versions of telegps application
[fw/altos]
/
altoslib
/
AltosState.java
diff --git
a/altoslib/AltosState.java
b/altoslib/AltosState.java
index 6d52dc40619931ca4ede8b8bae651d8c8f0115df..9e8e22ac8d945168512db1266df11656c63cc9e4 100644
(file)
--- a/
altoslib/AltosState.java
+++ b/
altoslib/AltosState.java
@@
-19,7
+19,7
@@
* Track flight state from telemetry or eeprom data stream
*/
* Track flight state from telemetry or eeprom data stream
*/
-package org.altusmetrum.altoslib_
3
;
+package org.altusmetrum.altoslib_
4
;
public class AltosState implements Cloneable {
public class AltosState implements Cloneable {
@@
-50,12
+50,13
@@
public class AltosState implements Cloneable {
private double set_time;
private double prev_set_time;
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;
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;
max_value = value;
- }
set_time = time;
}
}
set_time = time;
}
}
@@
-108,7
+109,7
@@
public class AltosState implements Cloneable {
void set_derivative(AltosValue in) {
double n = in.rate();
void set_derivative(AltosValue in) {
double n = in.rate();
-
+
if (n == AltosLib.MISSING)
return;
if (n == AltosLib.MISSING)
return;
@@
-123,7
+124,7
@@
public class AltosState implements Cloneable {
/* Clip changes to reduce noise */
double ddt = in.time() - pt;
double ddv = (n - p) / ddt;
/* Clip changes to reduce noise */
double ddt = in.time() - pt;
double ddv = (n - p) / ddt;
-
+
final double max = 100000;
/* 100gs */
final double max = 100000;
/* 100gs */
@@
-246,11
+247,11
@@
public class AltosState implements Cloneable {
void set_integral(AltosValue in) {
computed.set_integral(in);
}
void set_integral(AltosValue in) {
computed.set_integral(in);
}
-
+
void set_integral(AltosCValue in) {
set_integral(in.altos_value());
}
void set_integral(AltosCValue in) {
set_integral(in.altos_value());
}
-
+
void copy(AltosCValue old) {
measured.copy(old.measured);
computed.copy(old.computed);
void copy(AltosCValue old) {
measured.copy(old.measured);
computed.copy(old.computed);
@@
-337,7
+338,7
@@
public class AltosState implements Cloneable {
}
private AltosGroundPressure ground_pressure;
}
private AltosGroundPressure ground_pressure;
-
+
public double ground_pressure() {
return ground_pressure.value();
}
public double ground_pressure() {
return ground_pressure.value();
}
@@
-481,7
+482,11
@@
public class AltosState implements Cloneable {
}
class AltosSpeed extends AltosCValue {
}
class AltosSpeed extends AltosCValue {
-
+
+ boolean can_max() {
+ return state < AltosLib.ao_flight_fast;
+ }
+
void set_accel() {
acceleration.set_derivative(this);
}
void set_accel() {
acceleration.set_derivative(this);
}
@@
-519,6
+524,11
@@
public class AltosState implements Cloneable {
}
class AltosAccel extends AltosCValue {
}
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)
void set_measured(double a, double time) {
super.set_measured(a, time);
if (ascent)
@@
-604,11
+614,14
@@
public class AltosState implements Cloneable {
public double ground_accel_avg;
public int log_format;
public double ground_accel_avg;
public int log_format;
+ public String product;
public AltosMs5607 baro;
public AltosCompanion companion;
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;
public void set_npad(int npad) {
this.npad = npad;
gps_waiting = MIN_PAD_SAMPLES - npad;
@@
-696,11
+709,14
@@
public class AltosState implements Cloneable {
ground_accel_avg = AltosLib.MISSING;
log_format = AltosLib.MISSING;
ground_accel_avg = AltosLib.MISSING;
log_format = AltosLib.MISSING;
+ product = null;
serial = AltosLib.MISSING;
receiver_serial = AltosLib.MISSING;
baro = null;
companion = null;
serial = AltosLib.MISSING;
receiver_serial = AltosLib.MISSING;
baro = null;
companion = null;
+
+ pyro_fired = 0;
}
void finish_update() {
}
void finish_update() {
@@
-729,7
+745,7
@@
public class AltosState implements Cloneable {
time = old.time;
time_change = old.time_change;
prev_time = old.time;
time = old.time;
time_change = old.time_change;
prev_time = old.time;
-
+
tick = old.tick;
prev_tick = old.tick;
boost_tick = old.boost_tick;
tick = old.tick;
prev_tick = old.tick;
boost_tick = old.boost_tick;
@@
-747,7
+763,7
@@
public class AltosState implements Cloneable {
apogee_delay = old.apogee_delay;
main_deploy = old.main_deploy;
flight_log_max = old.flight_log_max;
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);
set = 0;
ground_pressure.copy(old.ground_pressure);
@@
-825,20
+841,22
@@
public class AltosState implements Cloneable {
ground_accel_avg = old.ground_accel_avg;
log_format = old.log_format;
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;
serial = old.serial;
receiver_serial = old.receiver_serial;
baro = old.baro;
companion = old.companion;
+
+ pyro_fired = old.pyro_fired;
}
}
-
+
void update_time() {
}
void update_gps() {
elevation = 0;
range = -1;
void update_time() {
}
void update_gps() {
elevation = 0;
range = -1;
- gps_height = 0;
if (gps == null)
return;
if (gps == null)
return;
@@
-1105,6
+1123,10
@@
public class AltosState implements Cloneable {
this.ignitor_voltage = voltage;
}
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;
public double time_since_boost() {
if (tick == AltosLib.MISSING)
return 0.0;