X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=altosui%2FAltosLog.java;h=6157a6567da03231d011e131da59a1690da04e5d;hb=e905042879147dd86241bf2dcc7437e5a6eb7578;hp=dd147d21adb960818ff3d26423f7c5e48816ba36;hpb=3fbefb3eea981d34a09496cf8abf0119de2e35bf;p=fw%2Faltos diff --git a/altosui/AltosLog.java b/altosui/AltosLog.java index dd147d21..6157a656 100644 --- a/altosui/AltosLog.java +++ b/altosui/AltosLog.java @@ -54,9 +54,10 @@ class AltosLog implements Runnable { } } - boolean open (AltosTelemetry telem) throws IOException { + boolean open (AltosRecord telem) throws IOException { AltosFile a = new AltosFile(telem); + System.out.printf("open %s\n", a.toString()); log_file = new FileWriter(a, true); if (log_file != null) { while (!pending_queue.isEmpty()) { @@ -74,18 +75,22 @@ class AltosLog implements Runnable { public void run () { try { + AltosRecord previous = null; for (;;) { AltosLine line = input_queue.take(); if (line.line == null) continue; try { - AltosTelemetry telem = new AltosTelemetry(line.line); - if (telem.serial != serial || telem.flight != flight || log_file == null) { + AltosRecord telem = AltosTelemetry.parse(line.line, previous); + if (telem.serial != 0 && telem.flight != 0 && + (telem.serial != serial || telem.flight != flight || log_file == null)) + { close_log_file(); serial = telem.serial; flight = telem.flight; open(telem); } + previous = telem; } catch (ParseException pe) { } catch (AltosCRCException ce) { }