diff options
| author | Keith Packard <keithp@keithp.com> | 2015-06-25 18:40:21 -0700 | 
|---|---|---|
| committer | Keith Packard <keithp@keithp.com> | 2015-06-25 18:43:13 -0700 | 
| commit | 002c523fae9369f0261c28f33152289d965d406b (patch) | |
| tree | 3f5d835498d108a81daae3a62983c492e9eb66e3 | |
| parent | 3d508b66c2a15286bb9af88e4d92209463e0725d (diff) | |
telegps: Add receiver battery to Status display
Makes it a bit cramped, but it's useful to have if you're using TeleBT.
Signed-off-by: Keith Packard <keithp@keithp.com>
| -rw-r--r-- | telegps/TeleGPS.java | 1 | ||||
| -rw-r--r-- | telegps/TeleGPSState.java | 21 | 
2 files changed, 21 insertions, 1 deletions
| diff --git a/telegps/TeleGPS.java b/telegps/TeleGPS.java index 078f4061..4f83e8e5 100644 --- a/telegps/TeleGPS.java +++ b/telegps/TeleGPS.java @@ -373,7 +373,6 @@ public class TeleGPS  				public void actionPerformed(ActionEvent e) {  					int rate = rates.rate();  					try { -						System.out.printf("set rate %d\n", rate);  						reader.set_telemetry_rate(rate);  					} catch (TimeoutException te) {  					} catch (InterruptedException ie) { diff --git a/telegps/TeleGPSState.java b/telegps/TeleGPSState.java index 6fbd0b5e..7c410e98 100644 --- a/telegps/TeleGPSState.java +++ b/telegps/TeleGPSState.java @@ -161,6 +161,26 @@ public class TeleGPSState extends AltosUIFlightTab {  		}  	} +	class ReceiverBattery extends AltosUIVoltageIndicator { + +		public double voltage(AltosState state) { return AltosLib.MISSING; } + +		public double good() { return AltosLib.ao_battery_good; } + +		public boolean hide(AltosState state, AltosListenerState listener_state, int i) { +			return value(state, listener_state, i) == AltosLib.MISSING; +		} + +		public double value(AltosState state, AltosListenerState listener_state, int i) { +			if (listener_state == null) +				return AltosLib.MISSING; +			return listener_state.battery; +		} + +		public ReceiverBattery (AltosUIFlightTab container, int y) { +			super(container, y, "Receiver Battery", 2); +		} +	}  	public void labels(Container container, int y) {  		GridBagLayout		layout = (GridBagLayout)(container.getLayout()); @@ -203,5 +223,6 @@ public class TeleGPSState extends AltosUIFlightTab {  		add(new FirmwareVersion(this, y++));  		add(new FlightLogMax(this, y++));  		add(new BatteryVoltage(this, y++)); +		add(new ReceiverBattery(this, y++));  	}  } | 
