altosuilib: Don't display pad, last location in flight stats without gps
[fw/altos] / altosuilib / AltosFlightStatsTable.java
index 47bdb75f06527ba84cd14958207ff0c30f9c1ac6..d88383b8da78824b83a52a2f7184120c7ab9e1da 100644 (file)
@@ -89,8 +89,15 @@ public class AltosFlightStatsTable extends JComponent implements AltosFontListen
 
        public void set_stats(AltosFlightStats stats) {
                int y = 0;
-               if (stats.serial != AltosLib.MISSING)
-                       new FlightStat(layout, y++, "Serial", String.format("%d", stats.serial));
+               if (stats.serial != AltosLib.MISSING) {
+                       if (stats.product != null && stats.firmware_version != null)
+                               new FlightStat(layout, y++, "Device",
+                                              stats.product,
+                                              String.format("version %s", stats.firmware_version),
+                                              String.format("serial %d", stats.serial));
+                       else
+                               new FlightStat(layout, y++, "Serial", String.format("%d", stats.serial));
+               }
                if (stats.flight != AltosLib.MISSING)
                        new FlightStat(layout, y++, "Flight", String.format("%d", stats.flight));
                if (stats.year != AltosLib.MISSING && stats.hour != AltosLib.MISSING)
@@ -187,10 +194,12 @@ public class AltosFlightStatsTable extends JComponent implements AltosFontListen
                if (stats.state_start[AltosLib.ao_flight_boost] < stats.state_start[AltosLib.ao_flight_landed])
                        new FlightStat(layout, y++, "Flight time",
                                       String.format("%6.1f s", stats.landed_time - stats.boost_time));
-               if (stats.has_gps) {
+               if (stats.has_gps && stats.pad_lat != AltosLib.MISSING) {
                        new FlightStat(layout, y++, "Pad location",
                                       pos(stats.pad_lat,"N","S"),
                                       pos(stats.pad_lon,"E","W"));
+               }
+               if (stats.has_gps && stats.lat != AltosLib.MISSING) {
                        new FlightStat(layout, y++, "Last reported location",
                                       pos(stats.lat,"N","S"),
                                       pos(stats.lon,"E","W"));