- started = 0;
- last_tick = 0;
- while (fgets(line, sizeof (line), file)) {
- union ao_telemetry_all telem;
-
- if (cc_telemetry_parse(line, &telem)) {
- /*
- * Skip packets with CRC errors.
- */
- if ((telem.generic.status & (1 << 7)) == 0)
- continue;
-
- if (started) {
- do_delay(telem.generic.tick, last_tick);
- last_tick = telem.generic.tick;
- send_telem(cc, &telem);
- } else {
- enum ao_flight_state state = packet_state(&telem);
- add_telem(&telem);
- if (ao_flight_pad < state && state < ao_flight_landed) {
- printf ("started\n");
- started = 1;
- last_tick = send_queued(cc, realtime);
+ } else {
+ for (i = optind; i < argc; i++) {
+ file = fopen(argv[i], "r");
+ if (!file) {
+ perror(argv[i]);
+ ret++;
+ continue;
+ }
+ started = 0;
+ last_tick = 0;
+ while (fgets(line, sizeof (line), file)) {
+ union ao_telemetry_all telem;
+
+ if (cc_telemetry_parse(line, &telem)) {
+ /*
+ * Skip packets with CRC errors.
+ */
+ if ((telem.generic.status & (1 << 7)) == 0)
+ continue;
+
+ if (verbose)
+ printf ("type %4d\n", telem.generic.type);
+
+ if (started || realtime) {
+ do_delay(telem.generic.tick, last_tick);
+ last_tick = telem.generic.tick;
+ send_telem(cc, &telem);
+ } else {
+ enum ao_flight_state state = packet_state(&telem);
+ printf ("\tstate %4d\n", state);
+ add_telem(&telem);
+ if (ao_flight_pad < state && state < ao_flight_landed) {
+ printf ("started\n");
+ started = 1;
+ last_tick = send_queued(cc, realtime);
+ }