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;
- 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;
- return boost_tick / 100.0;
+ return boost_tick / ticks_per_sec;
}
public int state = AltosLib.MISSING;
* 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() {
if (temp_gps != null) {
if (temp_gps.locked && temp_gps.nsat >= 4)
set_gps(temp_gps);
+ prev_gps = temp_gps;
temp_gps = null;
}
}
}
public AltosGPS make_temp_gps(int tick, boolean sats) {
- if (temp_gps == null)
- temp_gps = new AltosGPS();
+ if (temp_gps == null) {
+ if (prev_gps != null)
+ temp_gps = prev_gps.clone();
+ else
+ temp_gps = new AltosGPS();
+ }
if (sats) {
if (tick != temp_gps_sat_tick)
temp_gps.cc_gps_sat = null;