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 /telegps/TeleGPSState.java | |
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>
Diffstat (limited to 'telegps/TeleGPSState.java')
-rw-r--r-- | telegps/TeleGPSState.java | 21 |
1 files changed, 21 insertions, 0 deletions
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++)); } } |