diff options
| author | Keith Packard <keithp@keithp.com> | 2017-05-28 15:52:17 -0700 | 
|---|---|---|
| committer | Keith Packard <keithp@keithp.com> | 2017-05-28 15:52:17 -0700 | 
| commit | 78b4bf77fca96bef2cce443ad4c9544ae83f0acc (patch) | |
| tree | 8521eac7af38082305d8c075320067596b09b178 /altoslib/AltosCalData.java | |
| parent | dcf533d5befffa4c9c872f3c3d21d11ffeb61307 (diff) | |
altoslib: Reset transient AltosCalData values before processing data
Values in cal_data which are used to hold intermediate results need to
get reset back to their initial values before processing a series of
flight data again.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altoslib/AltosCalData.java')
| -rw-r--r-- | altoslib/AltosCalData.java | 17 | 
1 files changed, 16 insertions, 1 deletions
| diff --git a/altoslib/AltosCalData.java b/altoslib/AltosCalData.java index 408d8d7e..cb58e492 100644 --- a/altoslib/AltosCalData.java +++ b/altoslib/AltosCalData.java @@ -65,8 +65,11 @@ public class AltosCalData {  	public int		device_type = AltosLib.MISSING;  	public void set_device_type(int device_type) { -		if (device_type != AltosLib.MISSING) +		if (device_type != AltosLib.MISSING) {  			this.device_type = device_type; +			if (product == null) +				set_product(AltosLib.product_name(device_type)); +		}  	}  	public int		config_major = AltosLib.MISSING; @@ -179,6 +182,18 @@ public class AltosCalData {  		}  	} +	/* Reset all values which change during flight +	 */ +	public void reset() { +		state = AltosLib.MISSING; +		tick = AltosLib.MISSING; +		prev_tick = AltosLib.MISSING; +		temp_gps = null; +		prev_gps = null; +		temp_gps_sat_tick = AltosLib.MISSING; +		accel = AltosLib.MISSING; +	} +  	public int		boost_tick = AltosLib.MISSING;  	public void set_boost_tick() { | 
