altoslib: Only open log file when both flight and serial are known
authorKeith Packard <keithp@keithp.com>
Fri, 6 Sep 2013 05:52:22 +0000 (22:52 -0700)
committerKeith Packard <keithp@keithp.com>
Fri, 6 Sep 2013 05:52:22 +0000 (22:52 -0700)
Some telemetry formats include serial and flight in different packets,
so wait for both before creating the file

Signed-off-by: Keith Packard <keithp@keithp.com>
altoslib/AltosLog.java

index 850b0437ebca932dffab808c593435ecb83f4607..ed59ef713eb44cd1a27c58e9cbbdefe5157a81b2 100644 (file)
@@ -95,7 +95,8 @@ public class AltosLog implements Runnable {
                                                close_log_file();
                                                serial = state.serial;
                                                flight = state.flight;
                                                close_log_file();
                                                serial = state.serial;
                                                flight = state.flight;
-                                               open(state);
+                                               if (state.serial != AltosLib.MISSING && state.flight != AltosLib.MISSING)
+                                                       open(state);
                                        }
                                } catch (ParseException pe) {
                                } catch (AltosCRCException ce) {
                                        }
                                } catch (ParseException pe) {
                                } catch (AltosCRCException ce) {