X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=altosui%2FAltosUI.java;h=b0c6d33b843f7630be9b8364b3f787a56a6a1497;hb=e311cefae19d7dc71fb10e9a943daa8e2313c8f8;hp=fa259906769a9da7101c9bf1c064ce43a21bab93;hpb=383dec4449f8160c06804fba06290e7a07335934;p=fw%2Faltos diff --git a/altosui/AltosUI.java b/altosui/AltosUI.java index fa259906..b0c6d33b 100644 --- a/altosui/AltosUI.java +++ b/altosui/AltosUI.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 @@ -447,16 +448,23 @@ public class AltosUI extends AltosUIFrame { static AltosStateIterable record_iterable(File file) { FileInputStream in; - try { - in = new FileInputStream(file); - } catch (Exception e) { - System.out.printf("Failed to open file '%s'\n", file); - return null; + if (file.getName().endsWith("telem")) { + try { + in = new FileInputStream(file); + return new AltosTelemetryFile(in); + } catch (Exception e) { + System.out.printf("Failed to open file '%s'\n", file); + } + } else { + + try { + AltosEepromFile f = new AltosEepromFile(new FileReader(file)); + return f; + } catch (Exception e) { + System.out.printf("Failed to open file '%s'\n", file); + } } - if (file.getName().endsWith("telem")) - return new AltosTelemetryFile(in); - else - return new AltosEepromFile(in); + return null; } static AltosReplayReader replay_file(File file) { @@ -545,14 +553,22 @@ public class AltosUI extends AltosUIFrame { AltosStateIterable eef = record_iterable(file); for (AltosState state : eef) { - System.out.printf ("tick %d state %d height %g\n", - state.tick, state.state(), state.height()); - if ((state.set & AltosState.set_gps) != 0) - System.out.printf ("time %g lat %g lon %g alt %g\n", - state.time_since_boost(), + if ((state.set & AltosState.set_gps) != 0) { + System.out.printf ("time %d %d-%d-%d %d:%d:%d lat %g lon %g alt %g\n", + state.gps.seconds(), + state.gps.year, + state.gps.month, + state.gps.day, + state.gps.hour, + state.gps.minute, + state.gps.second, state.gps.lat, state.gps.lon, state.gps.alt); + } else { + System.out.printf ("tick %d state %d height %g\n", + state.tick, state.state(), state.height()); + } } } catch (Exception e) {