diff options
| author | Keith Packard <keithp@keithp.com> | 2017-05-25 17:24:14 -0700 | 
|---|---|---|
| committer | Keith Packard <keithp@keithp.com> | 2017-05-25 17:24:14 -0700 | 
| commit | f26cfe417c6977cf1e7e75a4f050e25f64d41859 (patch) | |
| tree | 2f19ca9c93c3246b3eeadafee250f9dd3ee222d6 /altoslib/AltosIdleMonitor.java | |
| parent | 7600116a191b3ac252a0f716d200d0e0b3500987 (diff) | |
altoslib: Do data analysis on raw values rather than AltosState
Use AltosFlightSeries instead of a sequence of AltosState records when
processing saved data. This provides a better way of doing filtering
and plotting.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'altoslib/AltosIdleMonitor.java')
| -rw-r--r-- | altoslib/AltosIdleMonitor.java | 13 | 
1 files changed, 8 insertions, 5 deletions
| diff --git a/altoslib/AltosIdleMonitor.java b/altoslib/AltosIdleMonitor.java index c374b601..3d73dce6 100644 --- a/altoslib/AltosIdleMonitor.java +++ b/altoslib/AltosIdleMonitor.java @@ -52,20 +52,21 @@ public class AltosIdleMonitor extends Thread {  		return link.reply_abort;  	} -	boolean update_state(AltosState state) throws InterruptedException, TimeoutException, AltosUnknownProduct { +	boolean provide_data(AltosDataListener listener) throws InterruptedException, TimeoutException, AltosUnknownProduct {  		boolean		worked = false;  		boolean		aborted = false; +		AltosCalData	cal_data = new AltosCalData(link.config_data());  		try {  			start_link(); -			fetch.update_state(state); +			fetch.provide_data(listener, cal_data);  			if (!link.has_error && !link.reply_abort)  				worked = true;  		} finally {  			aborted = stop_link();  			if (worked) {  				if (remote) -					state.set_rssi(link.rssi(), 0); +					listener.set_rssi(link.rssi(), 0);  				listener_state.battery = link.monitor_battery();  			}  		} @@ -92,12 +93,14 @@ public class AltosIdleMonitor extends Thread {  	}  	public void run() { -		AltosState state = new AltosState(); +		AltosState state = null;  		try {  			for (;;) {  				try {  					link.config_data(); -					update_state(state); +					if (state == null) +						state = new AltosState(new AltosCalData(link.config_data())); +					provide_data(state);  					listener.update(state, listener_state);  				} catch (TimeoutException te) {  				} catch (AltosUnknownProduct ae) { | 
