altoslib: Remove older eeprom handling code
authorKeith Packard <keithp@keithp.com>
Tue, 9 May 2017 09:31:04 +0000 (02:31 -0700)
committerKeith Packard <keithp@keithp.com>
Tue, 9 May 2017 09:31:04 +0000 (02:31 -0700)
The new code appears to work in minor testing; time to try it all the time.

Signed-off-by: Keith Packard <keithp@keithp.com>
17 files changed:
altoslib/AltosEepromFile.java
altoslib/AltosEepromFireTwo.java [deleted file]
altoslib/AltosEepromGPS.java [deleted file]
altoslib/AltosEepromHeader.java [deleted file]
altoslib/AltosEepromLog.java
altoslib/AltosEepromMega.java [deleted file]
altoslib/AltosEepromMetrum2.java [deleted file]
altoslib/AltosEepromMini.java [deleted file]
altoslib/AltosEepromRecordSet.java
altoslib/AltosEepromTM.java [deleted file]
altoslib/AltosEepromTMini.java [deleted file]
altoslib/AltosStateIterable.java
altoslib/Makefile.am
altosui/AltosLanded.java
altosui/AltosUI.java
altosuilib/AltosDataChooser.java
altosuilib/AltosEepromSelect.java

index bb8abf87fa334cfa3be713ba271a464f7804a780..4606e78091946b84911fd0d0be7777c5b2800986 100644 (file)
@@ -22,130 +22,26 @@ import java.io.*;
 import java.util.*;
 import java.text.*;
 
-class AltosEepromIterator implements Iterator<AltosState> {
-       AltosState              state;
-       Iterator<AltosEeprom>   body;
-       AltosEeprom             next;
-       boolean                 seen;
-
-       public boolean hasNext() {
-               return !seen || body.hasNext();
-       }
-
-       public AltosState next() {
-               if (seen) {
-                       AltosState      n = state.clone();
-                       AltosEeprom     e = body.next();
-
-                       e.update_state(n);
-                       state = n;
-               }
-               seen = true;
-               return state;
-       }
-
-       public void remove () {
-       }
-
-       public AltosEepromIterator(AltosState start, Iterator<AltosEeprom> body) {
-               this.state = start;
-               this.body = body;
-               this.seen = false;
-       }
-}
-
 public class AltosEepromFile extends AltosStateIterable {
 
-       AltosEepromIterable     headers;
-       AltosEepromIterable     body;
        AltosEepromRecordSet    set;
-       AltosState              start;
+
+       public AltosConfigData config_data() {
+               return set.eeprom.config_data();
+       }
 
        public void write_comments(PrintStream out) {
-               headers.write(out);
        }
 
        public void write(PrintStream out) {
-               headers.write(out);
-               body.write(out);
+               out.printf("%s\n", set.eeprom.toString());
        }
 
        public AltosEepromFile(Reader input) throws IOException {
                set = new AltosEepromRecordSet(input);
-
-       }
-
-       public AltosEepromFile(FileInputStream input) {
-               headers = new AltosEepromIterable(AltosEepromHeader.read(input));
-
-               start = headers.state();
-               if (start.state() != AltosLib.ao_flight_stateless)
-                       start.set_state(AltosLib.ao_flight_pad);
-
-               if (start.log_format == AltosLib.MISSING) {
-                       if (start.product != null) {
-                               if (start.product.startsWith("TeleMetrum"))
-                                       start.log_format = AltosLib.AO_LOG_FORMAT_FULL;
-                               else if (start.product.startsWith("TeleMini"))
-                                       start.log_format = AltosLib.AO_LOG_FORMAT_TINY;
-                       }
-               }
-
-               switch (start.log_format) {
-               case AltosLib.AO_LOG_FORMAT_FULL:
-                       body = new AltosEepromIterable(AltosEepromTM.read(input));
-                       break;
-               case AltosLib.AO_LOG_FORMAT_TINY:
-                       body = new AltosEepromIterable(AltosEepromTMini.read(input));
-                       break;
-               case AltosLib.AO_LOG_FORMAT_TELEMETRY:
-               case AltosLib.AO_LOG_FORMAT_TELESCIENCE:
-               case AltosLib.AO_LOG_FORMAT_TELEMEGA:
-               case AltosLib.AO_LOG_FORMAT_TELEMEGA_OLD:
-                       body = new AltosEepromIterable(AltosEepromMega.read(input, start.log_format));
-                       break;
-               case AltosLib.AO_LOG_FORMAT_TELEMETRUM:
-                       body = new AltosEepromIterable(AltosEepromMetrum2.read(input));
-                       break;
-               case AltosLib.AO_LOG_FORMAT_TELEMINI2:
-               case AltosLib.AO_LOG_FORMAT_TELEMINI3:
-               case AltosLib.AO_LOG_FORMAT_EASYMINI:
-                       body = new AltosEepromIterable(AltosEepromMini.read(input));
-                       break;
-               case AltosLib.AO_LOG_FORMAT_TELEGPS:
-                       body = new AltosEepromIterable(AltosEepromGPS.read(input));
-                       break;
-               case AltosLib.AO_LOG_FORMAT_TELEFIRETWO:
-                       body = new AltosEepromIterable(AltosEepromFireTwo.read(input));
-                       break;
-               default:
-                       body = new AltosEepromIterable(new LinkedList<AltosEeprom>());
-                       break;
-               }
-
-               /* Find boost tick */
-               AltosState      state = start.clone();
-               for (AltosEeprom eeprom : body) {
-                       eeprom.update_state(state);
-                       state.finish_update();
-                       if (state.state() >= AltosLib.ao_flight_boost) {
-                               start.set_boost_tick(state.tick);
-                               break;
-                       }
-               }
        }
 
        public Iterator<AltosState> iterator() {
-               if (set != null)
-                       return set.iterator();
-
-               AltosState              state = start.clone();
-               Iterator<AltosEeprom>   i = body.iterator();
-
-               while (i.hasNext() && !state.valid()) {
-                       i.next().update_state(state);
-                       state.finish_update();
-               }
-               return new AltosEepromIterator(state, i);
+               return set.iterator();
        }
 }
diff --git a/altoslib/AltosEepromFireTwo.java b/altoslib/AltosEepromFireTwo.java
deleted file mode 100644 (file)
index 16019c8..0000000
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Copyright © 2017 Keith Packard <keithp@keithp.com>
- *
- * 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; 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
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-package org.altusmetrum.altoslib_11;
-
-import java.io.*;
-import java.util.*;
-import java.text.*;
-
-public class AltosEepromFireTwo extends AltosEeprom {
-       public static final int record_length = 32;
-
-       public int record_length() { return record_length; }
-
-       /* AO_LOG_FLIGHT elements */
-       public int flight() { return data16(0); }
-       public int idle_pres() { return data16(2); }
-       public int idle_thrust() { return data16(4); }
-
-       /* AO_LOG_STATE elements */
-       public int state() { return data16(0); }
-       public int reason() { return data16(2); }
-
-       /* AO_LOG_SENSOR elements */
-       public int pres() { return data16(0); }
-       public int thrust() { return data16(2); }
-       public int temp(int i) { return data16(4+i*2); }
-
-       public AltosEepromFireTwo (AltosEepromChunk chunk, int start) throws ParseException {
-               parse_chunk(chunk, start);
-       }
-
-       private static final double r_above = 5600.0;
-       private static final double r_below = 10000.0;
-       private static final double v_adc = 3.3;
-
-       private static double firetwo_adc(int raw) {
-               return raw / 4095.0;
-       }
-
-       public static double adc_to_pa(int adc) {
-
-               /* raw adc to processor voltage, then back through the
-                * voltage divider to the sensor voltage
-                */
-
-               double  v = firetwo_adc(adc) * v_adc * (r_above + r_below) / r_below;
-
-               /* Bound to ranges provided in sensor */
-               if (v < 0.5) v = 0.5;
-               if (v > 4.5) v = 4.5;
-
-               double  psi = (v - 0.5) / 4.0 * 1600.0;
-               return AltosConvert.psi_to_pa(psi);
-       }
-
-       public static double adc_to_n(int adc) {
-               double v = firetwo_adc(adc);
-
-               /* this is a total guess */
-               return AltosConvert.lb_to_n(v * 298 * 9.807);
-       }
-
-       public void update_state(AltosState state) {
-               super.update_state(state);
-
-               switch (cmd) {
-               case AltosLib.AO_LOG_FLIGHT:
-                       state.set_flight(flight());
-                       state.set_ground_pressure(adc_to_pa(idle_pres()));
-                       state.set_accel_g(0, -1);
-                       break;
-               case AltosLib.AO_LOG_STATE:
-                       state.set_state(state());
-                       break;
-               case AltosLib.AO_LOG_SENSOR:
-                       state.set_pressure(adc_to_pa(pres()));
-                       state.set_accel(firetwo_adc(thrust()) * 100);
-                       break;
-               }
-       }
-
-       public AltosEepromFireTwo (String line) {
-               parse_string(line);
-       }
-
-       static public LinkedList<AltosEeprom> read(FileInputStream input) {
-               LinkedList<AltosEeprom> firetwos = new LinkedList<AltosEeprom>();
-
-               for (;;) {
-                       try {
-                               String line = AltosLib.gets(input);
-                               if (line == null)
-                                       break;
-                               try {
-                                       AltosEepromFireTwo firetwo = new AltosEepromFireTwo(line);
-
-                                       if (firetwo.cmd != AltosLib.AO_LOG_INVALID)
-                                               firetwos.add(firetwo);
-                               } catch (Exception e) {
-                                       System.out.printf ("exception\n");
-                               }
-                       } catch (IOException ie) {
-                               break;
-                       }
-               }
-
-               return firetwos;
-       }
-}
diff --git a/altoslib/AltosEepromGPS.java b/altoslib/AltosEepromGPS.java
deleted file mode 100644 (file)
index e76b36d..0000000
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * Copyright © 2014 Keith Packard <keithp@keithp.com>
- *
- * 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; 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
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-package org.altusmetrum.altoslib_11;
-
-import java.io.*;
-import java.util.*;
-import java.text.*;
-
-public class AltosEepromGPS extends AltosEeprom {
-       public static final int record_length = 32;
-
-       public static final int max_sat = 12;
-
-       public int record_length() { return record_length; }
-
-       /* AO_LOG_FLIGHT elements */
-       public int flight() { return data16(0); }
-       public int start_altitude() { return data16(2); }
-       public int start_latitude() { return data32(4); }
-       public int start_longitude() { return data32(8); }
-
-       /* AO_LOG_GPS_TIME elements */
-       public int latitude() { return data32(0); }
-       public int longitude() { return data32(4); }
-       public int altitude_low() { return data16(8); }
-       public int hour() { return data8(10); }
-       public int minute() { return data8(11); }
-       public int second() { return data8(12); }
-       public int flags() { return data8(13); }
-       public int year() { return data8(14); }
-       public int month() { return data8(15); }
-       public int day() { return data8(16); }
-       public int course() { return data8(17); }
-       public int ground_speed() { return data16(18); }
-       public int climb_rate() { return data16(20); }
-       public int pdop() { return data8(22); }
-       public int hdop() { return data8(23); }
-       public int vdop() { return data8(24); }
-       public int mode() { return data8(25); }
-       public int altitude_high() { return data16(26); }
-
-       public boolean has_seconds() { return cmd == AltosLib.AO_LOG_GPS_TIME; }
-
-       public int seconds() {
-               switch (cmd) {
-               case AltosLib.AO_LOG_GPS_TIME:
-                       return second() + 60 * (minute() + 60 * (hour() + 24 * (day() + 31 * month())));
-               default:
-                       return 0;
-               }
-       }
-
-       public AltosEepromGPS (AltosEepromChunk chunk, int start) throws ParseException {
-               parse_chunk(chunk, start);
-       }
-
-       public void update_state(AltosState state) {
-               super.update_state(state);
-
-               AltosGPS        gps;
-
-               /* Flush any pending GPS changes */
-               if (state.gps_pending) {
-                       switch (cmd) {
-                       case AltosLib.AO_LOG_GPS_LAT:
-                       case AltosLib.AO_LOG_GPS_LON:
-                       case AltosLib.AO_LOG_GPS_ALT:
-                       case AltosLib.AO_LOG_GPS_SAT:
-                       case AltosLib.AO_LOG_GPS_DATE:
-                               break;
-                       default:
-                               state.set_temp_gps();
-                               break;
-                       }
-               }
-
-               switch (cmd) {
-               case AltosLib.AO_LOG_FLIGHT:
-                       if (state.flight == AltosLib.MISSING) {
-                               state.set_boost_tick(tick);
-                               state.set_flight(flight());
-                       }
-                       /* no place to log start lat/lon yet */
-                       break;
-               case AltosLib.AO_LOG_GPS_TIME:
-                       state.set_tick(tick);
-                       gps = state.make_temp_gps(false);
-                       gps.lat = latitude() / 1e7;
-                       gps.lon = longitude() / 1e7;
-                       if (state.altitude_32())
-                               gps.alt = (altitude_low() & 0xffff) | (altitude_high() << 16);
-                       else
-                               gps.alt = altitude_low();
-
-                       gps.hour = hour();
-                       gps.minute = minute();
-                       gps.second = second();
-
-                       int flags = flags();
-
-                       gps.connected = (flags & AltosLib.AO_GPS_RUNNING) != 0;
-                       gps.locked = (flags & AltosLib.AO_GPS_VALID) != 0;
-                       gps.nsat = (flags & AltosLib.AO_GPS_NUM_SAT_MASK) >>
-                               AltosLib.AO_GPS_NUM_SAT_SHIFT;
-
-                       gps.year = 2000 + year();
-                       gps.month = month();
-                       gps.day = day();
-                       gps.ground_speed = ground_speed() * 1.0e-2;
-                       gps.course = course() * 2;
-                       gps.climb_rate = climb_rate() * 1.0e-2;
-                       if (state.compare_version("1.4.9") >= 0) {
-                               gps.pdop = pdop() / 10.0;
-                               gps.hdop = hdop() / 10.0;
-                               gps.vdop = vdop() / 10.0;
-                       } else {
-                               gps.pdop = pdop() / 100.0;
-                               if (gps.pdop < 0.8)
-                                       gps.pdop += 2.56;
-                               gps.hdop = hdop() / 100.0;
-                               if (gps.hdop < 0.8)
-                                       gps.hdop += 2.56;
-                               gps.vdop = vdop() / 100.0;
-                               if (gps.vdop < 0.8)
-                                       gps.vdop += 2.56;
-                       }
-                       break;
-               }
-       }
-
-       public AltosEepromGPS (String line) {
-               parse_string(line);
-       }
-
-       static public LinkedList<AltosEeprom> read(FileInputStream input) {
-               LinkedList<AltosEeprom> tgpss = new LinkedList<AltosEeprom>();
-
-               for (;;) {
-                       try {
-                               String line = AltosLib.gets(input);
-                               if (line == null)
-                                       break;
-                               try {
-                                       AltosEepromGPS tgps = new AltosEepromGPS(line);
-                                       if (tgps.cmd != AltosLib.AO_LOG_INVALID)
-                                               tgpss.add(tgps);
-                               } catch (Exception e) {
-                                       System.out.printf ("exception\n");
-                               }
-                       } catch (IOException ie) {
-                               break;
-                       }
-               }
-
-               return tgpss;
-       }
-}
diff --git a/altoslib/AltosEepromHeader.java b/altoslib/AltosEepromHeader.java
deleted file mode 100644 (file)
index 37b666b..0000000
+++ /dev/null
@@ -1,335 +0,0 @@
-/*
- * Copyright © 2013 Keith Packard <keithp@keithp.com>
- *
- * 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; 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
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-package org.altusmetrum.altoslib_11;
-
-import java.io.*;
-import java.util.*;
-import java.text.*;
-
-public class AltosEepromHeader extends AltosEeprom {
-
-       public int      cmd;
-       public String   data;
-       public int      config_a, config_b, config_c;
-       public boolean  last;
-       public boolean  valid;
-
-       public int record_length () { return 0; }
-
-       /* XXX pull rest of config data to state */
-       public void update_state(AltosState state) {
-               switch (cmd) {
-               case AltosLib.AO_LOG_CONFIG_VERSION:
-                       break;
-               case AltosLib.AO_LOG_MAIN_DEPLOY:
-                       break;
-               case AltosLib.AO_LOG_APOGEE_DELAY:
-                       break;
-               case AltosLib.AO_LOG_RADIO_CHANNEL:
-                       break;
-               case AltosLib.AO_LOG_CALLSIGN:
-                       state.set_callsign(data);
-                       break;
-               case AltosLib.AO_LOG_ACCEL_CAL:
-                       state.set_accel_g(config_a, config_b);
-                       break;
-               case AltosLib.AO_LOG_RADIO_CAL:
-                       break;
-               case AltosLib.AO_LOG_MANUFACTURER:
-                       break;
-               case AltosLib.AO_LOG_PRODUCT:
-                       state.product = data;
-                       break;
-               case AltosLib.AO_LOG_LOG_FORMAT:
-                       state.set_log_format(config_a);
-                       break;
-               case AltosLib.AO_LOG_SERIAL_NUMBER:
-                       state.set_serial(config_a);
-                       break;
-               case AltosLib.AO_LOG_BARO_RESERVED:
-                       state.make_baro();
-                       state.baro.reserved = config_a;
-                       break;
-               case AltosLib.AO_LOG_BARO_SENS:
-                       state.make_baro();
-                       state.baro.sens = config_a;
-                       break;
-               case AltosLib.AO_LOG_BARO_OFF:
-                       state.make_baro();
-                       state.baro.off = config_a;
-                       break;
-               case AltosLib.AO_LOG_BARO_TCS:
-                       state.make_baro();
-                       state.baro.tcs = config_a;
-                       break;
-               case AltosLib.AO_LOG_BARO_TCO:
-                       state.make_baro();
-                       state.baro.tco = config_a;
-                       break;
-               case AltosLib.AO_LOG_BARO_TREF:
-                       state.make_baro();
-                       state.baro.tref = config_a;
-                       break;
-               case AltosLib.AO_LOG_BARO_TEMPSENS:
-                       state.make_baro();
-                       state.baro.tempsens = config_a;
-                       break;
-               case AltosLib.AO_LOG_BARO_CRC:
-                       state.make_baro();
-                       state.baro.crc = config_a;
-                       break;
-               case AltosLib.AO_LOG_IMU_CAL:
-                       state.set_accel_zero(config_a, config_b, config_c);
-                       break;
-               case AltosLib.AO_LOG_SOFTWARE_VERSION:
-                       state.set_firmware_version(data);
-                       break;
-               case AltosLib.AO_LOG_FREQUENCY:
-               case AltosLib.AO_LOG_APOGEE_LOCKOUT:
-               case AltosLib.AO_LOG_RADIO_RATE:
-               case AltosLib.AO_LOG_IGNITE_MODE:
-                       break;
-               case AltosLib.AO_LOG_PAD_ORIENTATION:
-                       state.set_pad_orientation(config_a);
-                       break;
-               case AltosLib.AO_LOG_RADIO_ENABLE:
-               case AltosLib.AO_LOG_AES_KEY:
-               case AltosLib.AO_LOG_APRS:
-               case AltosLib.AO_LOG_BEEP_SETTING:
-               case AltosLib.AO_LOG_TRACKER_SETTING:
-               case AltosLib.AO_LOG_PYRO_TIME:
-               case AltosLib.AO_LOG_APRS_ID:
-                       break;
-               case AltosLib.AO_LOG_ALTITUDE_32:
-                       state.set_altitude_32(config_a);
-                       break;
-               }
-       }
-
-       public void write(PrintStream out) {
-               switch (cmd) {
-               case AltosLib.AO_LOG_CONFIG_VERSION:
-                       out.printf("# Config version: %s\n", data);
-                       break;
-               case AltosLib.AO_LOG_MAIN_DEPLOY:
-                       out.printf("# Main deploy: %s\n", config_a);
-                       break;
-               case AltosLib.AO_LOG_APOGEE_DELAY:
-                       out.printf("# Apogee delay: %s\n", config_a);
-                       break;
-               case AltosLib.AO_LOG_RADIO_CHANNEL:
-                       out.printf("# Radio channel: %s\n", config_a);
-                       break;
-               case AltosLib.AO_LOG_CALLSIGN:
-                       out.printf("# Callsign: %s\n", data);
-                       break;
-               case AltosLib.AO_LOG_ACCEL_CAL:
-                       out.printf ("# Accel cal: %d %d\n", config_a, config_b);
-                       break;
-               case AltosLib.AO_LOG_RADIO_CAL:
-                       out.printf ("# Radio cal: %d\n", config_a);
-                       break;
-               case AltosLib.AO_LOG_MAX_FLIGHT_LOG:
-                       out.printf ("# Max flight log: %d\n", config_a);
-                       break;
-               case AltosLib.AO_LOG_MANUFACTURER:
-                       out.printf ("# Manufacturer: %s\n", data);
-                       break;
-               case AltosLib.AO_LOG_PRODUCT:
-                       out.printf ("# Product: %s\n", data);
-                       break;
-               case AltosLib.AO_LOG_SERIAL_NUMBER:
-                       out.printf ("# Serial number: %d\n", config_a);
-                       break;
-               case AltosLib.AO_LOG_SOFTWARE_VERSION:
-                       out.printf ("# Software version: %s\n", data);
-                       break;
-               case AltosLib.AO_LOG_BARO_RESERVED:
-                       out.printf ("# Baro reserved: %d\n", config_a);
-                       break;
-               case AltosLib.AO_LOG_BARO_SENS:
-                       out.printf ("# Baro sens: %d\n", config_a);
-                       break;
-               case AltosLib.AO_LOG_BARO_OFF:
-                       out.printf ("# Baro off: %d\n", config_a);
-                       break;
-               case AltosLib.AO_LOG_BARO_TCS:
-                       out.printf ("# Baro tcs: %d\n", config_a);
-                       break;
-               case AltosLib.AO_LOG_BARO_TCO:
-                       out.printf ("# Baro tco: %d\n", config_a);
-                       break;
-               case AltosLib.AO_LOG_BARO_TREF:
-                       out.printf ("# Baro tref: %d\n", config_a);
-                       break;
-               case AltosLib.AO_LOG_BARO_TEMPSENS:
-                       out.printf ("# Baro tempsens: %d\n", config_a);
-                       break;
-               case AltosLib.AO_LOG_BARO_CRC:
-                       out.printf ("# Baro crc: %d\n", config_a);
-                       break;
-               case AltosLib.AO_LOG_IMU_CAL:
-                       out.printf ("# IMU cal: %d %d %d\n", config_a, config_b, config_c);
-                       break;
-               case AltosLib.AO_LOG_FREQUENCY:
-               case AltosLib.AO_LOG_APOGEE_LOCKOUT:
-               case AltosLib.AO_LOG_RADIO_RATE:
-               case AltosLib.AO_LOG_IGNITE_MODE:
-                       break;
-               case AltosLib.AO_LOG_PAD_ORIENTATION:
-                       out.printf("# Pad orientation: %d\n", config_a);
-                       break;
-               case AltosLib.AO_LOG_RADIO_ENABLE:
-               case AltosLib.AO_LOG_AES_KEY:
-               case AltosLib.AO_LOG_APRS:
-               case AltosLib.AO_LOG_BEEP_SETTING:
-               case AltosLib.AO_LOG_TRACKER_SETTING:
-               case AltosLib.AO_LOG_PYRO_TIME:
-               case AltosLib.AO_LOG_APRS_ID:
-                       break;
-               case AltosLib.AO_LOG_ALTITUDE_32:
-                       out.printf("# Altitude-32: %d\n", config_a);
-                       break;
-               }
-       }
-
-       public AltosEepromHeader (String[] tokens) {
-               last = false;
-               valid = true;
-               try {
-                       if (tokens[0].equals("Config") && tokens[1].equals("version:")) {
-                               cmd = AltosLib.AO_LOG_CONFIG_VERSION;
-                               data = tokens[2];
-                       } else if (tokens[0].equals("Main") && tokens[1].equals("deploy:")) {
-                               cmd = AltosLib.AO_LOG_MAIN_DEPLOY;
-                               config_a = Integer.parseInt(tokens[2]);
-                       } else if (tokens[0].equals("Apogee") && tokens[1].equals("delay:")) {
-                               cmd = AltosLib.AO_LOG_APOGEE_DELAY;
-                               config_a = Integer.parseInt(tokens[2]);
-                       } else if (tokens[0].equals("Radio") && tokens[1].equals("channel:")) {
-                               cmd = AltosLib.AO_LOG_RADIO_CHANNEL;
-                               config_a = Integer.parseInt(tokens[2]);
-                       } else if (tokens[0].equals("Callsign:")) {
-                               cmd = AltosLib.AO_LOG_CALLSIGN;
-                               data = tokens[1].replaceAll("\"","");
-                       } else if (tokens[0].equals("Accel") && tokens[1].equals("cal")) {
-                               cmd = AltosLib.AO_LOG_ACCEL_CAL;
-                               config_a = Integer.parseInt(tokens[3]);
-                               config_b = Integer.parseInt(tokens[5]);
-                       } else if (tokens[0].equals("Radio") && tokens[1].equals("cal:")) {
-                               cmd = AltosLib.AO_LOG_RADIO_CAL;
-                               config_a = Integer.parseInt(tokens[2]);
-                       } else if (tokens[0].equals("Max") && tokens[1].equals("flight") && tokens[2].equals("log:")) {
-                               cmd = AltosLib.AO_LOG_MAX_FLIGHT_LOG;
-                               config_a = Integer.parseInt(tokens[3]);
-                       } else if (tokens[0].equals("manufacturer")) {
-                               cmd = AltosLib.AO_LOG_MANUFACTURER;
-                               data = tokens[1];
-                       } else if (tokens[0].equals("product")) {
-                               cmd = AltosLib.AO_LOG_PRODUCT;
-                               data = tokens[1];
-                       } else if (tokens[0].equals("serial-number")) {
-                               cmd = AltosLib.AO_LOG_SERIAL_NUMBER;
-                               config_a = Integer.parseInt(tokens[1]);
-                       } else if (tokens[0].equals("log-format")) {
-                               cmd = AltosLib.AO_LOG_LOG_FORMAT;
-                               config_a = Integer.parseInt(tokens[1]);
-                       } else if (tokens[0].equals("altitude-32")) {
-                               cmd = AltosLib.AO_LOG_ALTITUDE_32;
-                               config_a = Integer.parseInt(tokens[1]);
-                       } else if (tokens[0].equals("software-version")) {
-                               cmd = AltosLib.AO_LOG_SOFTWARE_VERSION;
-                               data = tokens[1];
-                               last = true;
-                       } else if (tokens[0].equals("ms5607")) {
-                               if (tokens[1].equals("reserved:")) {
-                                       cmd = AltosLib.AO_LOG_BARO_RESERVED;
-                                       config_a = Integer.parseInt(tokens[2]);
-                               } else if (tokens[1].equals("sens:")) {
-                                       cmd = AltosLib.AO_LOG_BARO_SENS;
-                                       config_a = Integer.parseInt(tokens[2]);
-                               } else if (tokens[1].equals("off:")) {
-                                       cmd = AltosLib.AO_LOG_BARO_OFF;
-                                       config_a = Integer.parseInt(tokens[2]);
-                               } else if (tokens[1].equals("tcs:")) {
-                                       cmd = AltosLib.AO_LOG_BARO_TCS;
-                                       config_a = Integer.parseInt(tokens[2]);
-                               } else if (tokens[1].equals("tco:")) {
-                                       cmd = AltosLib.AO_LOG_BARO_TCO;
-                                       config_a = Integer.parseInt(tokens[2]);
-                               } else if (tokens[1].equals("tref:")) {
-                                       cmd = AltosLib.AO_LOG_BARO_TREF;
-                                       config_a = Integer.parseInt(tokens[2]);
-                               } else if (tokens[1].equals("tempsens:")) {
-                                       cmd = AltosLib.AO_LOG_BARO_TEMPSENS;
-                                       config_a = Integer.parseInt(tokens[2]);
-                               } else if (tokens[1].equals("crc:")) {
-                                       cmd = AltosLib.AO_LOG_BARO_CRC;
-                                       config_a = Integer.parseInt(tokens[2]);
-                               } else {
-                                       cmd = AltosLib.AO_LOG_INVALID;
-                                       data = tokens[2];
-                               }
-                       } else if (tokens[0].equals("IMU") && tokens[1].equals("cal")) {
-                               cmd = AltosLib.AO_LOG_IMU_CAL;
-                               config_a = Integer.parseInt(tokens[3]);
-                               config_b = Integer.parseInt(tokens[5]);
-                               config_c = Integer.parseInt(tokens[7]);
-                       } else if (tokens[0].equals("Pad") && tokens[1].equals("orientation:")) {
-                               cmd = AltosLib.AO_LOG_PAD_ORIENTATION;
-                               config_a = Integer.parseInt(tokens[2]);
-                       } else
-                               valid = false;
-               } catch (Exception e) {
-                       valid = false;
-               }
-       }
-
-       static public LinkedList<AltosEeprom> read(FileInputStream input) {
-               LinkedList<AltosEeprom> headers = new LinkedList<AltosEeprom>();
-
-               for (;;) {
-                       try {
-                               String line = AltosLib.gets(input);
-                               if (line == null)
-                                       break;
-                               AltosEepromHeader header = new AltosEepromHeader(line);
-                               headers.add(header);
-                               if (header.last)
-                                       break;
-                       } catch (IOException ie) {
-                               break;
-                       }
-               }
-
-               return headers;
-       }
-
-       static public void write (PrintStream out, LinkedList<AltosEepromHeader> headers) {
-               out.printf("# Comments\n");
-               for (AltosEepromHeader header : headers) {
-                       header.write(out);
-               }
-
-       }
-
-       public AltosEepromHeader (String line) {
-               this(line.split("\\s+"));
-       }
-}
index 1bca65630d8509c075876d33dc842ebea807c4b8..63e4a1f8a238dd81b6efca8ef5fbebe5cd1c471b 100644 (file)
@@ -32,8 +32,6 @@ public class AltosEepromLog {
        public int              start_block;
        public int              end_block;
 
-       public int              year, month, day;
-
        public boolean          selected;
 
        public AltosEepromLog(AltosConfigData config_data,
@@ -43,7 +41,6 @@ public class AltosEepromLog {
                throws InterruptedException, TimeoutException {
 
                int             block;
-               boolean         has_date = false;
 
                flight = in_flight;
                if (flight != 0)
@@ -56,43 +53,5 @@ public class AltosEepromLog {
                 * Select all flights for download
                 */
                selected = true;
-
-               /*
-                * Look in TeleMetrum log data for date
-                */
-               if (config_data.log_format == AltosLib.AO_LOG_FORMAT_UNKNOWN ||
-                   config_data.log_format == AltosLib.AO_LOG_FORMAT_FULL)
-               {
-                       /*
-                        * Only look in the first two blocks so that this
-                        * process doesn't take a long time
-                        */
-                       if (in_end_block > in_start_block + 2)
-                               in_end_block = in_start_block + 2;
-
-                       for (block = in_start_block; block < in_end_block; block++) {
-                               AltosEepromChunk eechunk = new AltosEepromChunk(link, block, block == in_start_block);
-
-                               for (int i = 0; i < AltosEepromChunk.chunk_size; i += AltosEepromTM.record_length) {
-                                       try {
-                                               AltosEepromTM r = new AltosEepromTM(eechunk, i);
-
-                                               if (r.cmd == AltosLib.AO_LOG_FLIGHT) {
-                                                       flight = r.b;
-                                                       has_flight = true;
-                                               }
-                                               if (r.cmd == AltosLib.AO_LOG_GPS_DATE) {
-                                                       year = 2000 + (r.a & 0xff);
-                                                       month = (r.a >> 8) & 0xff;
-                                                       day = (r.b & 0xff);
-                                                       has_date = true;
-                                               }
-                                       } catch (ParseException pe) {
-                                       }
-                               }
-                               if (has_date && has_flight)
-                                       break;
-                       }
-               }
        }
 }
diff --git a/altoslib/AltosEepromMega.java b/altoslib/AltosEepromMega.java
deleted file mode 100644 (file)
index 082d605..0000000
+++ /dev/null
@@ -1,287 +0,0 @@
-/*
- * Copyright © 2011 Keith Packard <keithp@keithp.com>
- *
- * 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; 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
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-package org.altusmetrum.altoslib_11;
-
-import java.io.*;
-import java.util.*;
-import java.text.*;
-
-public class AltosEepromMega extends AltosEeprom {
-       public static final int record_length = 32;
-
-       public static final int max_sat = 12;
-
-       private int log_format;
-
-       public int record_length() { return record_length; }
-
-       /* AO_LOG_FLIGHT elements */
-       public int flight() { return data16(0); }
-       public int ground_accel() { return data16(2); }
-       public int ground_pres() { return data32(4); }
-       public int ground_accel_along() { return data16(8); }
-       public int ground_accel_across() { return data16(10); }
-       public int ground_accel_through() { return data16(12); }
-       public int ground_roll() {
-               switch (log_format) {
-               case AltosLib.AO_LOG_FORMAT_TELEMEGA:
-                       return data32(16);
-               case AltosLib.AO_LOG_FORMAT_TELEMEGA_OLD:
-                       return data16(14);
-               default:
-                       return AltosLib.MISSING;
-               }
-       }
-       public int ground_pitch() {
-               switch (log_format) {
-               case AltosLib.AO_LOG_FORMAT_TELEMEGA:
-                       return data32(20);
-               case AltosLib.AO_LOG_FORMAT_TELEMEGA_OLD:
-                       return data16(16);
-               default:
-                       return AltosLib.MISSING;
-               }
-       }
-       public int ground_yaw() {
-               switch (log_format) {
-               case AltosLib.AO_LOG_FORMAT_TELEMEGA:
-                       return data32(24);
-               case AltosLib.AO_LOG_FORMAT_TELEMEGA_OLD:
-                       return data16(18);
-               default:
-                       return AltosLib.MISSING;
-               }
-       }
-
-       /* AO_LOG_STATE elements */
-       public int state() { return data16(0); }
-       public int reason() { return data16(2); }
-
-       /* AO_LOG_SENSOR elements */
-       public int pres() { return data32(0); }
-       public int temp() { return data32(4); }
-       public int accel_x() { return data16(8); }
-       public int accel_y() { return data16(10); }
-       public int accel_z() { return data16(12); }
-       public int gyro_x() { return data16(14); }
-       public int gyro_y() { return data16(16); }
-       public int gyro_z() { return data16(18); }
-       public int mag_x() { return data16(20); }
-       public int mag_y() { return data16(22); }
-       public int mag_z() { return data16(24); }
-       public int accel() { return data16(26); }
-
-       /* AO_LOG_TEMP_VOLT elements */
-       public int v_batt() { return data16(0); }
-       public int v_pbatt() { return data16(2); }
-       public int nsense() { return data16(4); }
-       public int sense(int i) { return data16(6 + i * 2); }
-       public int pyro() { return data16(26); }
-
-       /* AO_LOG_GPS_TIME elements */
-       public int latitude() { return data32(0); }
-       public int longitude() { return data32(4); }
-       public int altitude_low() { return data16(8); }
-       public int hour() { return data8(10); }
-       public int minute() { return data8(11); }
-       public int second() { return data8(12); }
-       public int flags() { return data8(13); }
-       public int year() { return data8(14); }
-       public int month() { return data8(15); }
-       public int day() { return data8(16); }
-       public int course() { return data8(17); }
-       public int ground_speed() { return data16(18); }
-       public int climb_rate() { return data16(20); }
-       public int pdop() { return data8(22); }
-       public int hdop() { return data8(23); }
-       public int vdop() { return data8(24); }
-       public int mode() { return data8(25); }
-       public int altitude_high() { return data16(26); }
-
-       /* AO_LOG_GPS_SAT elements */
-       public int nsat() { return data16(0); }
-       public int svid(int n) { return data8(2 + n * 2); }
-       public int c_n(int n) { return data8(2 + n * 2 + 1); }
-
-       public AltosEepromMega (AltosEepromChunk chunk, int start, int log_format) throws ParseException {
-               this.log_format = log_format;
-               parse_chunk(chunk, start);
-       }
-
-       public void update_state(AltosState state) {
-               super.update_state(state);
-
-               AltosGPS        gps;
-
-               /* Flush any pending GPS changes */
-               if (state.gps_pending) {
-                       switch (cmd) {
-                       case AltosLib.AO_LOG_GPS_LAT:
-                       case AltosLib.AO_LOG_GPS_LON:
-                       case AltosLib.AO_LOG_GPS_ALT:
-                       case AltosLib.AO_LOG_GPS_SAT:
-                       case AltosLib.AO_LOG_GPS_DATE:
-                               break;
-                       default:
-                               state.set_temp_gps();
-                               break;
-                       }
-               }
-
-               switch (cmd) {
-               case AltosLib.AO_LOG_FLIGHT:
-                       state.set_boost_tick(tick);
-                       state.set_flight(flight());
-                       state.set_ground_accel(ground_accel());
-                       state.set_ground_pressure(ground_pres());
-                       state.set_accel_ground(ground_accel_along(),
-                                              ground_accel_across(),
-                                              ground_accel_through());
-                       state.set_gyro_zero(ground_roll() / 512.0,
-                                           ground_pitch() / 512.0,
-                                           ground_yaw() / 512.0);
-                       break;
-               case AltosLib.AO_LOG_STATE:
-                       state.set_tick(tick);
-                       state.set_state(state());
-                       break;
-               case AltosLib.AO_LOG_SENSOR:
-                       state.set_tick(tick);
-                       state.set_ms5607(pres(), temp());
-
-                       AltosIMU        imu = new AltosIMU(accel_y(),   /* along */
-                                                          accel_x(),   /* across */
-                                                          accel_z(),   /* through */
-                                                          gyro_y(),    /* roll */
-                                                          gyro_x(),    /* pitch */
-                                                          gyro_z());   /* yaw */
-
-                       if (log_format == AltosLib.AO_LOG_FORMAT_TELEMEGA_OLD)
-                               state.check_imu_wrap(imu);
-
-                       state.set_imu(imu);
-
-                       state.set_mag(new AltosMag(mag_x(),
-                                                  mag_y(),
-                                                  mag_z()));
-
-                       state.set_accel(accel());
-
-                       break;
-               case AltosLib.AO_LOG_TEMP_VOLT:
-                       state.set_battery_voltage(AltosConvert.mega_battery_voltage(v_batt()));
-                       state.set_pyro_voltage(AltosConvert.mega_pyro_voltage(v_pbatt()));
-
-                       int nsense = nsense();
-
-                       state.set_apogee_voltage(AltosConvert.mega_pyro_voltage(sense(nsense-2)));
-                       state.set_main_voltage(AltosConvert.mega_pyro_voltage(sense(nsense-1)));
-
-                       double voltages[] = new double[nsense-2];
-                       for (int i = 0; i < nsense-2; i++)
-                               voltages[i] = AltosConvert.mega_pyro_voltage(sense(i));
-
-                       state.set_ignitor_voltage(voltages);
-                       state.set_pyro_fired(pyro());
-                       break;
-               case AltosLib.AO_LOG_GPS_TIME:
-                       state.set_tick(tick);
-                       gps = state.make_temp_gps(false);
-                       gps.lat = latitude() / 1e7;
-                       gps.lon = longitude() / 1e7;
-
-                       if (state.altitude_32())
-                               gps.alt = (altitude_low() & 0xffff) | (altitude_high() << 16);
-                       else
-                               gps.alt = altitude_low();
-
-                       gps.hour = hour();
-                       gps.minute = minute();
-                       gps.second = second();
-
-                       int flags = flags();
-
-                       gps.connected = (flags & AltosLib.AO_GPS_RUNNING) != 0;
-                       gps.locked = (flags & AltosLib.AO_GPS_VALID) != 0;
-                       gps.nsat = (flags & AltosLib.AO_GPS_NUM_SAT_MASK) >>
-                               AltosLib.AO_GPS_NUM_SAT_SHIFT;
-
-                       gps.year = 2000 + year();
-                       gps.month = month();
-                       gps.day = day();
-                       gps.ground_speed = ground_speed() * 1.0e-2;
-                       gps.course = course() * 2;
-                       gps.climb_rate = climb_rate() * 1.0e-2;
-                       if (state.compare_version("1.4.9") >= 0) {
-                               gps.pdop = pdop() / 10.0;
-                               gps.hdop = hdop() / 10.0;
-                               gps.vdop = vdop() / 10.0;
-                       } else {
-                               gps.pdop = pdop() / 100.0;
-                               if (gps.pdop < 0.8)
-                                       gps.pdop += 2.56;
-                               gps.hdop = hdop() / 100.0;
-                               if (gps.hdop < 0.8)
-                                       gps.hdop += 2.56;
-                               gps.vdop = vdop() / 100.0;
-                               if (gps.vdop < 0.8)
-                                       gps.vdop += 2.56;
-                       }
-                       break;
-               case AltosLib.AO_LOG_GPS_SAT:
-                       state.set_tick(tick);
-                       gps = state.make_temp_gps(true);
-
-                       int n = nsat();
-                       if (n > max_sat)
-                               n = max_sat;
-                       for (int i = 0; i < n; i++)
-                               gps.add_sat(svid(i), c_n(i));
-                       break;
-               }
-       }
-
-       public AltosEepromMega (String line, int log_format) {
-               this.log_format = log_format;
-               parse_string(line);
-       }
-
-       static public LinkedList<AltosEeprom> read(FileInputStream input, int log_format) {
-               LinkedList<AltosEeprom> megas = new LinkedList<AltosEeprom>();
-
-               for (;;) {
-                       try {
-                               String line = AltosLib.gets(input);
-                               if (line == null)
-                                       break;
-                               try {
-                                       AltosEepromMega mega = new AltosEepromMega(line, log_format);
-                                       if (mega.cmd != AltosLib.AO_LOG_INVALID)
-                                               megas.add(mega);
-                               } catch (Exception e) {
-                                       System.out.printf ("exception\n");
-                               }
-                       } catch (IOException ie) {
-                               break;
-                       }
-               }
-
-               return megas;
-       }
-}
diff --git a/altoslib/AltosEepromMetrum2.java b/altoslib/AltosEepromMetrum2.java
deleted file mode 100644 (file)
index f685b3c..0000000
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- * Copyright © 2011 Keith Packard <keithp@keithp.com>
- *
- * 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; 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
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-package org.altusmetrum.altoslib_11;
-
-import java.io.*;
-import java.util.*;
-import java.text.*;
-
-public class AltosEepromMetrum2 extends AltosEeprom {
-       public static final int record_length = 16;
-
-       public int record_length() { return record_length; }
-
-       /* AO_LOG_FLIGHT elements */
-       public int flight() { return data16(0); }
-       public int ground_accel() { return data16(2); }
-       public int ground_pres() { return data32(4); }
-       public int ground_temp() { return data32(8); }
-
-       /* AO_LOG_STATE elements */
-       public int state() { return data16(0); }
-       public int reason() { return data16(2); }
-
-       /* AO_LOG_SENSOR elements */
-       public int pres() { return data32(0); }
-       public int temp() { return data32(4); }
-       public int accel() { return data16(8); }
-
-       /* AO_LOG_TEMP_VOLT elements */
-       public int v_batt() { return data16(0); }
-       public int sense_a() { return data16(2); }
-       public int sense_m() { return data16(4); }
-
-       /* AO_LOG_GPS_POS elements */
-       public int latitude() { return data32(0); }
-       public int longitude() { return data32(4); }
-       public int altitude_low() { return data16(8); }
-       public int altitude_high() { return data16(10); }
-
-       /* AO_LOG_GPS_TIME elements */
-       public int hour() { return data8(0); }
-       public int minute() { return data8(1); }
-       public int second() { return data8(2); }
-       public int flags() { return data8(3); }
-       public int year() { return data8(4); }
-       public int month() { return data8(5); }
-       public int day() { return data8(6); }
-       public int pdop() { return data8(7); }
-
-       /* AO_LOG_GPS_SAT elements */
-       public int nsat() { return data8(0); }
-       public int more() { return data8(1); }
-       public int svid(int n) { return data8(2 + n * 2); }
-       public int c_n(int n) { return data8(2 + n * 2 + 1); }
-
-       public AltosEepromMetrum2 (AltosEepromChunk chunk, int start) throws ParseException {
-               parse_chunk(chunk, start);
-       }
-
-       public void update_state(AltosState state) {
-               super.update_state(state);
-
-               AltosGPS        gps;
-
-               /* Flush any pending GPS changes */
-               if (state.gps_pending) {
-                       switch (cmd) {
-                       case AltosLib.AO_LOG_GPS_POS:
-                       case AltosLib.AO_LOG_GPS_LAT:
-                       case AltosLib.AO_LOG_GPS_LON:
-                       case AltosLib.AO_LOG_GPS_ALT:
-                       case AltosLib.AO_LOG_GPS_SAT:
-                       case AltosLib.AO_LOG_GPS_DATE:
-                               break;
-                       default:
-                               state.set_temp_gps();
-                               break;
-                       }
-               }
-
-               switch (cmd) {
-               case AltosLib.AO_LOG_FLIGHT:
-                       state.set_flight(flight());
-                       state.set_ground_accel(ground_accel());
-                       state.set_ground_pressure(ground_pres());
-//                     state.set_temperature(ground_temp() / 100.0);
-                       break;
-               case AltosLib.AO_LOG_STATE:
-                       state.set_state(state());
-                       break;
-               case AltosLib.AO_LOG_SENSOR:
-                       state.set_ms5607(pres(), temp());
-                       state.set_accel(accel());
-
-                       break;
-               case AltosLib.AO_LOG_TEMP_VOLT:
-                       state.set_battery_voltage(AltosConvert.mega_battery_voltage(v_batt()));
-
-                       state.set_apogee_voltage(AltosConvert.mega_pyro_voltage(sense_a()));
-                       state.set_main_voltage(AltosConvert.mega_pyro_voltage(sense_m()));
-
-                       break;
-               case AltosLib.AO_LOG_GPS_POS:
-                       gps = state.make_temp_gps(false);
-                       gps.lat = latitude() / 1e7;
-                       gps.lon = longitude() / 1e7;
-                       if (state.altitude_32())
-                               gps.alt = (altitude_low() & 0xffff) | (altitude_high() << 16);
-                       else
-                               gps.alt = altitude_low();
-                       break;
-               case AltosLib.AO_LOG_GPS_TIME:
-                       gps = state.make_temp_gps(false);
-
-                       gps.hour = hour();
-                       gps.minute = minute();
-                       gps.second = second();
-
-                       int flags = flags();
-
-                       gps.connected = (flags & AltosLib.AO_GPS_RUNNING) != 0;
-                       gps.locked = (flags & AltosLib.AO_GPS_VALID) != 0;
-                       gps.nsat = (flags & AltosLib.AO_GPS_NUM_SAT_MASK) >>
-                               AltosLib.AO_GPS_NUM_SAT_SHIFT;
-
-                       gps.year = 2000 + year();
-                       gps.month = month();
-                       gps.day = day();
-                       gps.pdop = pdop() / 10.0;
-                       break;
-               case AltosLib.AO_LOG_GPS_SAT:
-                       gps = state.make_temp_gps(true);
-
-                       int n = nsat();
-                       for (int i = 0; i < n; i++)
-                               gps.add_sat(svid(i), c_n(i));
-                       break;
-               }
-       }
-
-       public AltosEepromMetrum2 (String line) {
-               parse_string(line);
-       }
-
-       static public LinkedList<AltosEeprom> read(FileInputStream input) {
-               LinkedList<AltosEeprom> metrums = new LinkedList<AltosEeprom>();
-
-               for (;;) {
-                       try {
-                               String line = AltosLib.gets(input);
-                               if (line == null)
-                                       break;
-                               try {
-                                       AltosEepromMetrum2 metrum = new AltosEepromMetrum2(line);
-
-                                       if (metrum.cmd != AltosLib.AO_LOG_INVALID)
-                                               metrums.add(metrum);
-                               } catch (Exception e) {
-                                       System.out.printf ("exception\n");
-                               }
-                       } catch (IOException ie) {
-                               break;
-                       }
-               }
-
-               return metrums;
-       }
-}
diff --git a/altoslib/AltosEepromMini.java b/altoslib/AltosEepromMini.java
deleted file mode 100644 (file)
index 0415507..0000000
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * Copyright © 2011 Keith Packard <keithp@keithp.com>
- *
- * 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; 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
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-package org.altusmetrum.altoslib_11;
-
-import java.io.*;
-import java.util.*;
-import java.text.*;
-
-public class AltosEepromMini extends AltosEeprom {
-       public static final int record_length = 16;
-
-       public int record_length() { return record_length; }
-
-       /* AO_LOG_FLIGHT elements */
-       public int flight() { return data16(0); }
-       public int ground_pres() { return data32(4); }
-
-       /* AO_LOG_STATE elements */
-       public int state() { return data16(0); }
-       public int reason() { return data16(2); }
-
-       /* AO_LOG_SENSOR elements */
-       public int pres() { return data24(0); }
-       public int temp() { return data24(3); }
-       public int sense_a() { return data16(6); }
-       public int sense_m() { return data16(8); }
-       public int v_batt() { return data16(10); }
-
-       private double battery_voltage(AltosState state, int sensor) {
-               if (state.log_format == AltosLib.AO_LOG_FORMAT_EASYMINI)
-                       return AltosConvert.easy_mini_voltage(sensor, state.serial);
-               if (state.log_format == AltosLib.AO_LOG_FORMAT_TELEMINI2)
-                       return AltosConvert.tele_mini_2_voltage(sensor);
-               if (state.log_format == AltosLib.AO_LOG_FORMAT_TELEMINI3)
-                       return AltosConvert.tele_mini_3_battery_voltage(sensor);
-               return -1;
-       }
-
-       private double pyro_voltage(AltosState state, int sensor) {
-               if (state.log_format == AltosLib.AO_LOG_FORMAT_EASYMINI)
-                       return AltosConvert.easy_mini_voltage(sensor, state.serial);
-               if (state.log_format == AltosLib.AO_LOG_FORMAT_TELEMINI2)
-                       return AltosConvert.tele_mini_2_voltage(sensor);
-               if (state.log_format == AltosLib.AO_LOG_FORMAT_TELEMINI3)
-                       return AltosConvert.tele_mini_3_pyro_voltage(sensor);
-               return -1;
-       }
-
-       public void update_state(AltosState state) {
-               super.update_state(state);
-
-               switch (cmd) {
-               case AltosLib.AO_LOG_FLIGHT:
-                       state.set_flight(flight());
-                       state.set_ground_pressure(ground_pres());
-                       break;
-               case AltosLib.AO_LOG_STATE:
-                       state.set_state(state());
-                       break;
-               case AltosLib.AO_LOG_SENSOR:
-                       state.set_ms5607(pres(), temp());
-                       state.set_apogee_voltage(pyro_voltage(state, sense_a()));
-                       state.set_main_voltage(pyro_voltage(state, sense_m()));
-                       state.set_battery_voltage(battery_voltage(state, v_batt()));
-                       break;
-               }
-       }
-
-       public AltosEepromMini (AltosEepromChunk chunk, int start) throws ParseException {
-               parse_chunk(chunk, start);
-       }
-
-       public AltosEepromMini (String line) {
-               parse_string(line);
-       }
-
-       public AltosEepromMini(int in_cmd, int in_tick) {
-               cmd = in_cmd;
-               tick = in_tick;
-               valid = true;
-       }
-
-       static public LinkedList<AltosEeprom> read(FileInputStream input) {
-               LinkedList<AltosEeprom> minis = new LinkedList<AltosEeprom>();
-
-               for (;;) {
-                       try {
-                               String line = AltosLib.gets(input);
-                               if (line == null)
-                                       break;
-                               AltosEepromMini mini = new AltosEepromMini(line);
-                               minis.add(mini);
-                       } catch (IOException ie) {
-                               break;
-                       }
-               }
-
-               return minis;
-       }
-}
index 000d9c02a848d03b3a793ba5c9426e3341e44e56..911b90b9f9f471f5c26167eeb8ad93a7cc347629 100644 (file)
@@ -18,6 +18,7 @@ import java.io.*;
 import java.util.*;
 
 public class AltosEepromRecordSet implements Iterable<AltosState> {
+       AltosEepromNew                  eeprom;
        TreeSet<AltosEepromRecord>      ordered;
        AltosState                      start_state;
 
@@ -52,6 +53,8 @@ public class AltosEepromRecordSet implements Iterable<AltosState> {
        }
 
        public AltosEepromRecordSet(AltosEepromNew eeprom) {
+               this.eeprom = eeprom;
+
                AltosConfigData         config_data = eeprom.config_data();
 
                AltosEepromRecord       record = null;
diff --git a/altoslib/AltosEepromTM.java b/altoslib/AltosEepromTM.java
deleted file mode 100644 (file)
index 9a09f92..0000000
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * Copyright © 2010 Keith Packard <keithp@keithp.com>
- *
- * 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; 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
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-package org.altusmetrum.altoslib_11;
-
-import java.io.*;
-import java.util.*;
-import java.text.*;
-
-public class AltosEepromTM extends AltosEeprom {
-       public int      a;
-       public int      b;
-
-       public static final int record_length = 8;
-
-       public void write(PrintStream out) {
-               out.printf("%c %4x %4x %4x\n", cmd, tick, a, b);
-       }
-
-       public int record_length() { return record_length; }
-
-       public String string() {
-               return String.format("%c %4x %4x %4x\n", cmd, tick, a, b);
-       }
-
-       public void update_state(AltosState state) {
-               super.update_state(state);
-
-               AltosGPS        gps;
-
-               /* Flush any pending GPS changes */
-               if (state.gps_pending) {
-                       switch (cmd) {
-                       case AltosLib.AO_LOG_GPS_LAT:
-                       case AltosLib.AO_LOG_GPS_LON:
-                       case AltosLib.AO_LOG_GPS_ALT:
-                       case AltosLib.AO_LOG_GPS_SAT:
-                       case AltosLib.AO_LOG_GPS_DATE:
-                               break;
-                       default:
-                               state.set_temp_gps();
-                               break;
-                       }
-               }
-
-               switch (cmd) {
-               case AltosLib.AO_LOG_FLIGHT:
-                       state.set_state(AltosLib.ao_flight_pad);
-                       state.set_ground_accel(a);
-                       state.set_flight(b);
-                       state.set_boost_tick(tick);
-                       break;
-               case AltosLib.AO_LOG_SENSOR:
-                       state.set_accel(a);
-                       state.set_pressure(AltosConvert.barometer_to_pressure(b));
-                       break;
-               case AltosLib.AO_LOG_PRESSURE:
-                       state.set_pressure(AltosConvert.barometer_to_pressure(b));
-                       break;
-               case AltosLib.AO_LOG_TEMP_VOLT:
-                       state.set_temperature(AltosConvert.thermometer_to_temperature(a));
-                       state.set_battery_voltage(AltosConvert.cc_battery_to_voltage(b));
-                       break;
-               case AltosLib.AO_LOG_DEPLOY:
-                       state.set_apogee_voltage(AltosConvert.cc_ignitor_to_voltage(a));
-                       state.set_main_voltage(AltosConvert.cc_ignitor_to_voltage(b));
-                       break;
-               case AltosLib.AO_LOG_STATE:
-                       state.set_state(a);
-                       break;
-               case AltosLib.AO_LOG_GPS_TIME:
-                       gps = state.make_temp_gps(false);
-
-                       gps.hour = (a & 0xff);
-                       gps.minute = (a >> 8);
-                       gps.second = (b & 0xff);
-
-                       int flags = (b >> 8);
-
-                       gps.connected = (flags & AltosLib.AO_GPS_RUNNING) != 0;
-                       gps.locked = (flags & AltosLib.AO_GPS_VALID) != 0;
-                       gps.nsat = (flags & AltosLib.AO_GPS_NUM_SAT_MASK) >>
-                               AltosLib.AO_GPS_NUM_SAT_SHIFT;
-                       break;
-               case AltosLib.AO_LOG_GPS_LAT:
-                       gps = state.make_temp_gps(false);
-
-                       int lat32 = a | (b << 16);
-                       gps.lat = (double) lat32 / 1e7;
-                       break;
-               case AltosLib.AO_LOG_GPS_LON:
-                       gps = state.make_temp_gps(false);
-
-                       int lon32 = a | (b << 16);
-                       gps.lon = (double) lon32 / 1e7;
-                       break;
-               case AltosLib.AO_LOG_GPS_ALT:
-                       gps = state.make_temp_gps(false);
-                       gps.alt = a;
-                       break;
-               case AltosLib.AO_LOG_GPS_SAT:
-                       gps = state.make_temp_gps(true);
-                       int svid = a;
-                       int c_n0 = b >> 8;
-                       gps.add_sat(svid, c_n0);
-                       break;
-               case AltosLib.AO_LOG_GPS_DATE:
-                       gps = state.make_temp_gps(false);
-                       gps.year = (a & 0xff) + 2000;
-                       gps.month = a >> 8;
-                       gps.day = b & 0xff;
-                       break;
-               }
-       }
-
-       public AltosEepromTM (AltosEepromChunk chunk, int start) throws ParseException {
-
-               cmd = chunk.data(start);
-               valid = true;
-
-               valid = !chunk.erased(start, record_length);
-               if (valid) {
-                       if (AltosConvert.checksum(chunk.data, start, record_length) != 0)
-                               throw new ParseException(String.format("invalid checksum at 0x%x",
-                                                                      chunk.address + start), 0);
-               } else {
-                       cmd = AltosLib.AO_LOG_INVALID;
-               }
-
-               tick = chunk.data16(start + 2);
-               a = chunk.data16(start + 4);
-               b = chunk.data16(start + 6);
-       }
-
-       public AltosEepromTM (String line) {
-               valid = false;
-               tick = 0;
-               a = 0;
-               b = 0;
-               if (line == null) {
-                       cmd = AltosLib.AO_LOG_INVALID;
-               } else {
-                       try {
-                               String[] tokens = line.split("\\s+");
-
-                               if (tokens[0].length() == 1) {
-                                       if (tokens.length != 4) {
-                                               cmd = AltosLib.AO_LOG_INVALID;
-                                       } else {
-                                               cmd = tokens[0].codePointAt(0);
-                                               tick = Integer.parseInt(tokens[1],16);
-                                               valid = true;
-                                               a = Integer.parseInt(tokens[2],16);
-                                               b = Integer.parseInt(tokens[3],16);
-                                       }
-                               } else {
-                                       cmd = AltosLib.AO_LOG_INVALID;
-                               }
-                       } catch (NumberFormatException ne) {
-                               cmd = AltosLib.AO_LOG_INVALID;
-                       }
-               }
-       }
-
-       public AltosEepromTM(int in_cmd, int in_tick, int in_a, int in_b) {
-               valid = true;
-               cmd = in_cmd;
-               tick = in_tick;
-               a = in_a;
-               b = in_b;
-       }
-
-       static public LinkedList<AltosEeprom> read(FileInputStream input) {
-               LinkedList<AltosEeprom> tms = new LinkedList<AltosEeprom>();
-
-               for (;;) {
-                       try {
-                               String line = AltosLib.gets(input);
-                               if (line == null)
-                                       break;
-                               AltosEepromTM tm = new AltosEepromTM(line);
-                               tms.add(tm);
-                       } catch (IOException ie) {
-                               break;
-                       }
-               }
-
-               return tms;
-       }
-
-}
diff --git a/altoslib/AltosEepromTMini.java b/altoslib/AltosEepromTMini.java
deleted file mode 100644 (file)
index 2557f43..0000000
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * Copyright © 2010 Keith Packard <keithp@keithp.com>
- *
- * 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; 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
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-package org.altusmetrum.altoslib_11;
-
-import java.io.*;
-import java.util.*;
-import java.text.*;
-
-public class AltosEepromTMini extends AltosEeprom {
-       public int      i;
-       public int      a;
-       public int      b;
-
-       public static final int record_length = 2;
-
-       public void write(PrintStream out) {
-               out.printf("%c %4x %4x %4x\n", cmd, tick, a, b);
-       }
-
-       public int record_length() { return record_length; }
-
-       public String string() {
-               return String.format("%c %4x %4x %4x\n", cmd, tick, a, b);
-       }
-
-       public void update_state(AltosState state) {
-               super.update_state(state);
-
-               switch (cmd) {
-               case AltosLib.AO_LOG_FLIGHT:
-                       state.set_state(AltosLib.ao_flight_boost);
-                       state.set_flight(b);
-                       break;
-               case AltosLib.AO_LOG_PRESSURE:
-                       if (tick == 0)
-                               state.set_ground_pressure(AltosConvert.barometer_to_pressure(b));
-                       else
-                               state.set_pressure(AltosConvert.barometer_to_pressure(b));
-                       break;
-               case AltosLib.AO_LOG_STATE:
-                       state.set_state(a);
-                       break;
-               }
-       }
-
-       public AltosEepromTMini (AltosEepromChunk chunk, int start, AltosState state) throws ParseException {
-               int     value = chunk.data16(start);
-
-               int     i = (chunk.address + start) / record_length;
-
-               cmd = chunk.data(start);
-               valid = true;
-
-               valid = !chunk.erased(start, record_length);
-
-               switch (i) {
-               case 0:
-                       cmd = AltosLib.AO_LOG_FLIGHT;
-                       tick = 0;
-                       a = 0;
-                       b = value;
-                       break;
-               case 1:
-                       cmd = AltosLib.AO_LOG_PRESSURE;
-                       tick = 0;
-                       a = 0;
-                       b = value;
-                       break;
-               default:
-                       if ((value & 0x8000) != 0) {
-                               cmd = AltosLib.AO_LOG_STATE;
-                               tick = state.tick;
-                               a = value & 0x7fff;
-                               b = 0;
-                       } else {
-                               if (state.ascent)
-                                       tick = state.tick + 10;
-                               else
-                                       tick = state.tick + 100;
-                               cmd = AltosLib.AO_LOG_PRESSURE;
-                               a = 0;
-                               b = value;
-                       }
-                       break;
-               }
-       }
-
-       public AltosEepromTMini (String line) {
-               valid = false;
-               tick = 0;
-               a = 0;
-               b = 0;
-               if (line == null) {
-                       cmd = AltosLib.AO_LOG_INVALID;
-               } else {
-                       try {
-                               String[] tokens = line.split("\\s+");
-
-                               if (tokens[0].length() == 1) {
-                                       if (tokens.length != 4) {
-                                               cmd = AltosLib.AO_LOG_INVALID;
-                                       } else {
-                                               cmd = tokens[0].codePointAt(0);
-                                               tick = Integer.parseInt(tokens[1],16);
-                                               valid = true;
-                                               a = Integer.parseInt(tokens[2],16);
-                                               b = Integer.parseInt(tokens[3],16);
-                                       }
-                               } else {
-                                       cmd = AltosLib.AO_LOG_INVALID;
-                               }
-                       } catch (NumberFormatException ne) {
-                               cmd = AltosLib.AO_LOG_INVALID;
-                       }
-               }
-       }
-
-       public AltosEepromTMini(int in_cmd, int in_tick, int in_a, int in_b) {
-               valid = true;
-               cmd = in_cmd;
-               tick = in_tick;
-               a = in_a;
-               b = in_b;
-       }
-
-       static public LinkedList<AltosEeprom> read(FileInputStream input) {
-               LinkedList<AltosEeprom> tms = new LinkedList<AltosEeprom>();
-
-               for (;;) {
-                       try {
-                               String line = AltosLib.gets(input);
-                               if (line == null)
-                                       break;
-                               AltosEepromTMini tm = new AltosEepromTMini(line);
-                               tms.add(tm);
-                       } catch (IOException ie) {
-                               break;
-                       }
-               }
-
-               return tms;
-       }
-
-}
index 5332aecd04822a33cd25eb7ac93b522afd6eaee2..ec3d944d92843f90dd35852a62c8fb2997976629 100644 (file)
@@ -29,15 +29,13 @@ public abstract class AltosStateIterable implements Iterable<AltosState> {
        public abstract void write(PrintStream out);
 
        public static AltosStateIterable iterable(File file) {
-               FileInputStream in;
                try {
-                       in = new FileInputStream(file);
+                       if (file.getName().endsWith("telem"))
+                               return new AltosTelemetryFile(new FileInputStream(file));
+                       else
+                               return new AltosEepromFile(new FileReader(file));
                } catch (Exception e) {
                        return null;
                }
-               if (file.getName().endsWith("telem"))
-                       return new AltosTelemetryFile(in);
-               else
-                       return new AltosEepromFile(in);
        }
 }
index 2bcd934f2747d433aa116a2b1d9dc099ede40f70..ad3fc68227cd2d3f7a7e0ab4df63a4a8c63dc452 100644 (file)
@@ -47,19 +47,11 @@ altoslib_JAVA = \
        AltosEeprom.java \
        AltosEepromChunk.java \
        AltosEepromDownload.java \
+       AltosEepromMonitor.java \
        AltosEepromFile.java \
-       AltosEepromTM.java \
-       AltosEepromTMini.java \
-       AltosEepromHeader.java \
        AltosEepromIterable.java \
        AltosEepromList.java \
        AltosEepromLog.java \
-       AltosEepromMega.java \
-       AltosEepromMetrum2.java \
-       AltosEepromMini.java \
-       AltosEepromGPS.java \
-       AltosEepromMonitor.java \
-       AltosEepromFireTwo.java \
        AltosFile.java \
        AltosFlash.java \
        AltosFlashListener.java \
index ded085376fa3fb8ff35c302eaa17ba5b2e93b735..25d4fcc80ea796ae88c63fabfdd426f90fef3e7d 100644 (file)
@@ -125,7 +125,7 @@ public class AltosLanded extends AltosUIFlightTab implements ActionListener {
                                try {
                                        AltosStateIterable states = null;
                                        if (filename.endsWith("eeprom")) {
-                                               FileInputStream in = new FileInputStream(file);
+                                               FileReader in = new FileReader(file);
                                                states = new AltosEepromFile(in);
                                        } else if (filename.endsWith("telem")) {
                                                FileInputStream in = new FileInputStream(file);
@@ -143,6 +143,11 @@ public class AltosLanded extends AltosUIFlightTab implements ActionListener {
                                                                      fe.getMessage(),
                                                                      "Cannot open file",
                                                                      JOptionPane.ERROR_MESSAGE);
+                               } catch (IOException ie) {
+                                       JOptionPane.showMessageDialog(null,
+                                                                     ie.getMessage(),
+                                                                     "Error reading file file",
+                                                                     JOptionPane.ERROR_MESSAGE);
                                }
                        }
                }
index b0c6d33b843f7630be9b8364b3f787a56a6a1497..72c3c161b4809042423330098ed5307ea1cf4e93 100644 (file)
@@ -367,16 +367,16 @@ public class AltosUI extends AltosUIFrame {
 
        static AltosStateIterable open_logfile(File file) {
                try {
-                       FileInputStream in;
-
-                       in = new FileInputStream(file);
                        if (file.getName().endsWith("telem"))
-                               return new AltosTelemetryFile(in);
+                               return new AltosTelemetryFile(new FileInputStream(file));
                        else
-                               return new AltosEepromFile(in);
+                               return new AltosEepromFile(new FileReader(file));
                } catch (FileNotFoundException fe) {
                        System.out.printf("%s\n", fe.getMessage());
                        return null;
+               } catch (IOException ie) {
+                       System.out.printf("%s\n", ie.getMessage());
+                       return null;
                }
        }
 
index 8758fc34df213d000f3e770fd7499b5679f15e9a..a8c74926381482d0b108575377253c1e5994484c 100644 (file)
@@ -47,7 +47,7 @@ public class AltosDataChooser extends JFileChooser {
                        filename = file.getName();
                        try {
                                if (filename.endsWith("eeprom")) {
-                                       FileInputStream in = new FileInputStream(file);
+                                       FileReader in = new FileReader(file);
                                        return new AltosEepromFile(in);
                                } else if (filename.endsWith("telem")) {
                                        FileInputStream in = new FileInputStream(file);
@@ -60,6 +60,11 @@ public class AltosDataChooser extends JFileChooser {
                                                              fe.getMessage(),
                                                              "Cannot open file",
                                                              JOptionPane.ERROR_MESSAGE);
+                       } catch (IOException ie) {
+                               JOptionPane.showMessageDialog(frame,
+                                                             ie.getMessage(),
+                                                             "Error reading file",
+                                                             JOptionPane.ERROR_MESSAGE);
                        }
                }
                return null;
index 0b4b7a85f19ae74b563f20fb97ee8d7224216b12..2c6ee6d7aaeca45a0daff82bb7f04cb8eb59af7e 100644 (file)
@@ -38,11 +38,7 @@ class AltosEepromItem implements ActionListener {
                log = in_log;
 
                String  text;
-               if (log.year != 0)
-                       text = String.format("Flight #%02d - %04d-%02d-%02d",
-                                            log.flight, log.year, log.month, log.day);
-               else
-                       text = String.format("Flight #%02d", log.flight);
+               text = String.format("Flight #%02d", log.flight);
 
                label = new JLabel(text);