projects
/
fw
/
altos
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
altoslib: Allow for other tick sizes
[fw/altos]
/
altoslib
/
AltosCalData.java
diff --git
a/altoslib/AltosCalData.java
b/altoslib/AltosCalData.java
index 3da0e4009f5da00480cf786c42877a84e7d58552..a9955ba8b503e52364cca89538c0641d164d03ff 100644
(file)
--- a/
altoslib/AltosCalData.java
+++ b/
altoslib/AltosCalData.java
@@
-182,18
+182,24
@@
public class AltosCalData {
boost_tick = tick;
}
boost_tick = tick;
}
+ public double ticks_per_sec = 100.0;
+
+ public void set_ticks_per_sec(double ticks_per_sec) {
+ this.ticks_per_sec = ticks_per_sec;
+ }
+
public double time() {
if (tick == AltosLib.MISSING)
return AltosLib.MISSING;
if (boost_tick == AltosLib.MISSING)
return AltosLib.MISSING;
public double time() {
if (tick == AltosLib.MISSING)
return AltosLib.MISSING;
if (boost_tick == AltosLib.MISSING)
return AltosLib.MISSING;
- return (tick - boost_tick) /
100.0
;
+ return (tick - boost_tick) /
ticks_per_sec
;
}
public double boost_time() {
if (boost_tick == AltosLib.MISSING)
return AltosLib.MISSING;
}
public double boost_time() {
if (boost_tick == AltosLib.MISSING)
return AltosLib.MISSING;
- return boost_tick /
100.0
;
+ return boost_tick /
ticks_per_sec
;
}
public int state = AltosLib.MISSING;
}
public int state = AltosLib.MISSING;
@@
-206,9
+212,13
@@
public class AltosCalData {
public AltosGPS gps_pad = null;
public AltosGPS gps_pad = null;
+ public double gps_pad_altitude = AltosLib.MISSING;
+
public void set_gps(AltosGPS gps) {
if ((state != AltosLib.MISSING && state < AltosLib.ao_flight_boost) || gps_pad == null)
gps_pad = gps;
public void set_gps(AltosGPS gps) {
if ((state != AltosLib.MISSING && state < AltosLib.ao_flight_boost) || gps_pad == null)
gps_pad = gps;
+ if (gps_pad_altitude == AltosLib.MISSING && gps.alt != AltosLib.MISSING)
+ gps_pad_altitude = gps.alt;
}
/*
}
/*
@@
-216,6
+226,7
@@
public class AltosCalData {
* object and then deliver the result atomically to the listener
*/
AltosGPS temp_gps = null;
* object and then deliver the result atomically to the listener
*/
AltosGPS temp_gps = null;
+ AltosGPS prev_gps = null;
int temp_gps_sat_tick = AltosLib.MISSING;
public AltosGPS temp_gps() {
int temp_gps_sat_tick = AltosLib.MISSING;
public AltosGPS temp_gps() {
@@
-226,8
+237,9
@@
public class AltosCalData {
if (temp_gps != null) {
if (temp_gps.locked && temp_gps.nsat >= 4)
set_gps(temp_gps);
if (temp_gps != null) {
if (temp_gps.locked && temp_gps.nsat >= 4)
set_gps(temp_gps);
+ prev_gps = temp_gps;
+ temp_gps = null;
}
}
- temp_gps = null;
}
public boolean gps_pending() {
}
public boolean gps_pending() {
@@
-236,7
+248,10
@@
public class AltosCalData {
public AltosGPS make_temp_gps(int tick, boolean sats) {
if (temp_gps == null) {
public AltosGPS make_temp_gps(int tick, boolean sats) {
if (temp_gps == null) {
- temp_gps = new AltosGPS();
+ if (prev_gps != null)
+ temp_gps = prev_gps.clone();
+ else
+ temp_gps = new AltosGPS();
}
if (sats) {
if (tick != temp_gps_sat_tick)
}
if (sats) {
if (tick != temp_gps_sat_tick)