altosui: Correctly show/hide receiver battery value
authorKeith Packard <keithp@keithp.com>
Fri, 26 Jun 2015 01:35:07 +0000 (18:35 -0700)
committerKeith Packard <keithp@keithp.com>
Fri, 26 Jun 2015 01:43:13 +0000 (18:43 -0700)
Override the hide() test function which has the listener_state

Signed-off-by: Keith Packard <keithp@keithp.com>
altosui/AltosPad.java

index 687fe6f79832e8a5133fd1e35bb0f2be9020e5a9..4f3ea13789b8d3bc7e0aa2c1f28f80cd24c6a511 100644 (file)
@@ -103,9 +103,12 @@ public class AltosPad extends AltosUIFlightTab {
 
                public double voltage(AltosState state) { return AltosLib.MISSING; }
 
 
                public double voltage(AltosState state) { return AltosLib.MISSING; }
 
-               public boolean hide(double v) { return v == AltosLib.MISSING; }
                public double good() { return AltosLib.ao_battery_good; }
 
                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;
                public double value(AltosState state, AltosListenerState listener_state, int i) {
                        if (listener_state == null)
                                return AltosLib.MISSING;
@@ -243,12 +246,12 @@ public class AltosPad extends AltosUIFlightTab {
        public AltosPad() {
                int y = 0;
                add(new Battery(this, y++));
        public AltosPad() {
                int y = 0;
                add(new Battery(this, y++));
+               add(new ReceiverBattery(this, y++));
                add(new Apogee(this, y++));
                add(new Main(this, y++));
                add(new LoggingReady(this, y++));
                add(new GPSLocked(this, y++));
                add(new GPSReady(this, y++));
                add(new Apogee(this, y++));
                add(new Main(this, y++));
                add(new LoggingReady(this, y++));
                add(new GPSLocked(this, y++));
                add(new GPSReady(this, y++));
-               add(new ReceiverBattery(this, y++));
                add(new PadLat(this, y++));
                add(new PadLon(this, y++));
                add(new PadAlt(this, y++));
                add(new PadLat(this, y++));
                add(new PadLon(this, y++));
                add(new PadAlt(this, y++));