diff options
| author | Keith Packard <keithp@keithp.com> | 2017-05-28 15:26:51 -0700 | 
|---|---|---|
| committer | Keith Packard <keithp@keithp.com> | 2017-05-28 15:26:51 -0700 | 
| commit | 4161d9e9e5b4cbd71ec6d982d26ea566a69726c3 (patch) | |
| tree | 65a8069b7f73517458619650cad08074072daf79 /altoslib/AltosFlightSeries.java | |
| parent | 8d6376c673af4648d494c1be71ad40380667bd25 (diff) | |
altoslib: Clean up gps series logging
Create each gps series only when data are avaiable.
Compute gps height series shen series is finished.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altoslib/AltosFlightSeries.java')
| -rw-r--r-- | altoslib/AltosFlightSeries.java | 39 | 
1 files changed, 25 insertions, 14 deletions
diff --git a/altoslib/AltosFlightSeries.java b/altoslib/AltosFlightSeries.java index d5cc7fd1..4072307b 100644 --- a/altoslib/AltosFlightSeries.java +++ b/altoslib/AltosFlightSeries.java @@ -232,6 +232,13 @@ public class AltosFlightSeries extends AltosDataListener {  			for (AltosTimeValue alt : altitude_series)  				height_series.add(alt.time, alt.value - ground_altitude);  		} + +		if (gps_height == null && cal_data.gps_pad != null && gps_altitude != null) { +			double gps_ground_altitude = cal_data.gps_pad.alt; +			gps_height = add_series(gps_height_name, AltosConvert.height); +			for (AltosTimeValue gps_alt : gps_altitude) +				gps_height.add(gps_alt.time, gps_alt.value - gps_ground_altitude); +		}  	}  	public AltosTimeSeries speed_series; @@ -425,28 +432,32 @@ public class AltosFlightSeries extends AltosDataListener {  			gps_vdop.add(time(), gps.vdop);  		}  		if (gps.locked) { -			if (gps_altitude == null) { -				gps_altitude = add_series(gps_altitude_name, AltosConvert.height); -				gps_height = add_series(gps_height_name, AltosConvert.height); -				gps_ground_speed = add_series(gps_ground_speed_name, AltosConvert.speed); -				gps_ascent_rate = add_series(gps_ascent_rate_name, AltosConvert.speed); -				gps_course = add_series(gps_course_name, null); -				gps_speed = add_series(gps_speed_name, null); -			}  			if (gps.alt != AltosLib.MISSING) { +				if (gps_altitude == null) +					gps_altitude = add_series(gps_altitude_name, AltosConvert.height);  				gps_altitude.add(time(), gps.alt); -				if (cal_data.gps_pad != null) -					gps_height.add(time(), gps.alt - cal_data.gps_pad.alt);  			} -			if (gps.ground_speed != AltosLib.MISSING) +			if (gps.ground_speed != AltosLib.MISSING) { +				if (gps_ground_speed == null) +					gps_ground_speed = add_series(gps_ground_speed_name, AltosConvert.speed);  				gps_ground_speed.add(time(), gps.ground_speed); -			if (gps.climb_rate != AltosLib.MISSING) +			} +			if (gps.climb_rate != AltosLib.MISSING) { +				if (gps_ascent_rate == null) +					gps_ascent_rate = add_series(gps_ascent_rate_name, AltosConvert.speed);  				gps_ascent_rate.add(time(), gps.climb_rate); -			if (gps.course != AltosLib.MISSING) +			} +			if (gps.course != AltosLib.MISSING) { +				if (gps_course == null) +					gps_course = add_series(gps_course_name, null);  				gps_course.add(time(), gps.course); -			if (gps.ground_speed != AltosLib.MISSING && gps.climb_rate != AltosLib.MISSING) +			} +			if (gps.ground_speed != AltosLib.MISSING && gps.climb_rate != AltosLib.MISSING) { +				if (gps_speed == null) +					gps_speed = add_series(gps_speed_name, null);  				gps_speed.add(time(), Math.sqrt(gps.ground_speed * gps.ground_speed +  								gps.climb_rate * gps.climb_rate)); +			}  		}  		if (gps.cc_gps_sat != null) {  			if (sats_in_view == null)  | 
