diff options
| author | Keith Packard <keithp@keithp.com> | 2017-05-26 18:46:00 -0700 | 
|---|---|---|
| committer | Keith Packard <keithp@keithp.com> | 2017-05-26 18:46:00 -0700 | 
| commit | 21d864206043d2a6048cd859295623bad4d99365 (patch) | |
| tree | 2f1cd89b3a847fb9e1a109634360287f66718de1 | |
| parent | 3d29882f5c70e627b0bbfe42c0a31d6cb5f6b6bf (diff) | |
altoslib: Preserve old GPS data during operation
This avoids having the lat/lon values blank out when the GPS receiver
looses lock.
Signed-off-by: Keith Packard <keithp@keithp.com>
| -rw-r--r-- | altoslib/AltosCalData.java | 10 | 
1 files changed, 8 insertions, 2 deletions
| diff --git a/altoslib/AltosCalData.java b/altoslib/AltosCalData.java index fff6ba67..ae0a9294 100644 --- a/altoslib/AltosCalData.java +++ b/altoslib/AltosCalData.java @@ -220,6 +220,7 @@ public class AltosCalData {  	 * 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() { @@ -230,6 +231,7 @@ public class AltosCalData {  		if (temp_gps != null) {  			if (temp_gps.locked && temp_gps.nsat >= 4)  				set_gps(temp_gps); +			prev_gps = temp_gps;  			temp_gps = null;  		}  	} @@ -239,8 +241,12 @@ public class AltosCalData {  	}  	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; | 
