X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=telegps%2FTeleGPSState.java;h=2e39037c529f4e15d16111d70047025b6ff41ab8;hb=3fa1eadb91eea001342d2d357d7aaf661e8a2a5d;hp=6fbd0b5ecc7e4290329e17952383aab3adcab9ed;hpb=cb23b992be8ba40c97d8988c134a814a13ccd58c;p=fw%2Faltos diff --git a/telegps/TeleGPSState.java b/telegps/TeleGPSState.java index 6fbd0b5e..2e39037c 100644 --- a/telegps/TeleGPSState.java +++ b/telegps/TeleGPSState.java @@ -3,7 +3,8 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of @@ -21,8 +22,8 @@ import java.util.*; import java.awt.*; import java.awt.event.*; import javax.swing.*; -import org.altusmetrum.altoslib_7.*; -import org.altusmetrum.altosuilib_7.*; +import org.altusmetrum.altoslib_11.*; +import org.altusmetrum.altosuilib_11.*; public class TeleGPSState extends AltosUIFlightTab { @@ -123,10 +124,10 @@ public class TeleGPSState extends AltosUIFlightTab { class FirmwareVersion extends AltosUIIndicator { public void show(AltosState state, AltosListenerState listener_state) { - if (state.firmware_version == null) + if (state.cal_data.firmware_version == null) show("Missing"); else - show(state.firmware_version); + show(state.cal_data.firmware_version); } public FirmwareVersion(Container container, int y) { @@ -136,10 +137,11 @@ public class TeleGPSState extends AltosUIFlightTab { class FlightLogMax extends AltosUIIndicator { public void show(AltosState state, AltosListenerState listener_state) { - if (state.flight_log_max == AltosLib.MISSING) + int storage = state.cal_data.flight_log_max; + if (storage == AltosLib.MISSING) show("Missing"); else - show(String.format("%dkB", state.flight_log_max)); + show(String.format("%dkB", storage)); } public FlightLogMax(Container container, int y) { @@ -161,6 +163,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 +225,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++)); } }