projects
/
fw
/
altos
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'master' of ssh://git.gag.com/scm/git/fw/altos
[fw/altos]
/
altoslib
/
AltosFlightStats.java
diff --git
a/altoslib/AltosFlightStats.java
b/altoslib/AltosFlightStats.java
index 82e477f8e2fd1d2b6d3d63889e30665c7d4eb2d8..1c7d67e0719d3d7c3a7df5b091423da1b81ceace 100644
(file)
--- a/
altoslib/AltosFlightStats.java
+++ b/
altoslib/AltosFlightStats.java
@@
-15,7
+15,7
@@
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_
6
;
+package org.altusmetrum.altoslib_
10
;
import java.io.*;
import java.io.*;
@@
-52,12
+52,12
@@
public class AltosFlightStats {
for (AltosState s : states) {
state = s;
for (AltosState s : states) {
state = s;
- if (state.state == AltosLib.ao_flight_landed)
+ if (state.state
()
== AltosLib.ao_flight_landed)
break;
}
if (state == null)
break;
}
if (state == null)
- return
0
;
+ return
AltosLib.MISSING
;
double landed_height = state.height();
double landed_height = state.height();
@@
-65,7
+65,7
@@
public class AltosFlightStats {
boolean above = true;
boolean above = true;
- double landed_time =
-1000
;
+ double landed_time =
AltosLib.MISSING
;
for (AltosState s : states) {
state = s;
for (AltosState s : states) {
state = s;
@@
-73,14
+73,12
@@
public class AltosFlightStats {
if (state.height() > landed_height + 10) {
above = true;
} else {
if (state.height() > landed_height + 10) {
above = true;
} else {
- if (above &&
state.height() < landed_height +
2) {
+ if (above &&
Math.abs(state.height() - landed_height) <
2) {
above = false;
landed_time = state.time;
}
}
}
above = false;
landed_time = state.time;
}
}
}
- if (landed_time == -1000)
- landed_time = state.time;
return landed_time;
}
return landed_time;
}
@@
-92,14
+90,12
@@
public class AltosFlightStats {
state = s;
if (state.acceleration() < 1)
boost_time = state.time;
state = s;
if (state.acceleration() < 1)
boost_time = state.time;
- if (state.state
>= AltosLib.ao_flight_boost && state.state
<= AltosLib.ao_flight_landed)
+ if (state.state
() >= AltosLib.ao_flight_boost && state.state()
<= AltosLib.ao_flight_landed)
break;
}
if (state == null)
break;
}
if (state == null)
- return
0
;
+ return
AltosLib.MISSING
;
- if (boost_time == AltosLib.MISSING)
- boost_time = state.time;
return boost_time;
}
return boost_time;
}
@@
-122,6
+118,13
@@
public class AltosFlightStats {
has_imu = false;
has_mag = false;
has_orient = false;
has_imu = false;
has_mag = false;
has_orient = false;
+
+ for (int s = AltosLib.ao_flight_startup; s <= AltosLib.ao_flight_landed; s++) {
+ state_count[s] = 0;
+ state_speed[s] = 0.0;
+ state_accel[s] = 0.0;
+ }
+
for (AltosState state : states) {
if (serial == AltosLib.MISSING && state.serial != AltosLib.MISSING)
serial = state.serial;
for (AltosState state : states) {
if (serial == AltosLib.MISSING && state.serial != AltosLib.MISSING)
serial = state.serial;
@@
-138,11
+141,14
@@
public class AltosFlightStats {
if (state.pressure() != AltosLib.MISSING)
has_flight_data = true;
if (state.pressure() != AltosLib.MISSING)
has_flight_data = true;
- int state_id = state.state;
- if (
state.time >= boost_time && state_id < AltosLib.ao_flight_boost)
+ int state_id = state.state
()
;
+ if (
boost_time != AltosLib.MISSING && state.time >= boost_time && state_id < AltosLib.ao_flight_boost) {
state_id = AltosLib.ao_flight_boost;
state_id = AltosLib.ao_flight_boost;
- if (state.time >= landed_time && state_id < AltosLib.ao_flight_landed)
+ }
+ if (landed_time != AltosLib.MISSING && state.time >= landed_time && state_id < AltosLib.ao_flight_landed) {
state_id = AltosLib.ao_flight_landed;
state_id = AltosLib.ao_flight_landed;
+ }
+
if (state.gps != null && state.gps.locked) {
year = state.gps.year;
month = state.gps.month;
if (state.gps != null && state.gps.locked) {
year = state.gps.year;
month = state.gps.month;