telegps: Use log_space when flight_log_max is missing
authorKeith Packard <keithp@keithp.com>
Sun, 15 May 2016 20:58:41 +0000 (13:58 -0700)
committerKeith Packard <keithp@keithp.com>
Sun, 15 May 2016 20:58:41 +0000 (13:58 -0700)
TeleGPS has this, but not flight_log_max

Signed-off-by: Keith Packard <keithp@keithp.com>
telegps/TeleGPSState.java

index a0ff572761ad4c023e1b3c2cf8f0d3e6b27b9f76..e01ef47e46e64d12bb32e14051adba8b91908d6e 100644 (file)
@@ -136,10 +136,13 @@ 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.flight_log_max;
+                       if (storage == AltosLib.MISSING)
+                               storage = state.log_space >> 10;
+                       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) {