- String log_line = String.format("%c %4x %4x %4x\n",
- r.cmd, r.tick, r.a, r.b);
- if (eeprom_file != null)
- eeprom_file.write(log_line);
- else
- eeprom_pending.add(log_line);
+ CheckFile(false);
+ }
+
+ void CaptureLog(AltosEepromLog log) throws IOException, InterruptedException, TimeoutException, ParseException {
+ int block, state_block = 0;
+ int log_format = flights.config_data.log_format;
+
+ state = new AltosState();
+
+ done = false;
+ start = true;
+
+ if (flights.config_data.serial < 0)
+ throw new IOException("no serial number found");
+
+ /* Reset per-capture variables */
+ want_file = false;
+ eeprom_file = null;
+ eeprom_pending = new LinkedList<String>();
+
+ /* Set serial number in the monitor dialog window */
+ /* Now scan the eeprom, reading blocks of data and converting to .eeprom file form */
+
+ state_block = log.start_block;
+ for (block = log.start_block; !done && block < log.end_block; block++) {
+ monitor.set_value(state.state_name(),
+ state.state,
+ block - state_block,
+ block - log.start_block);
+
+ AltosEepromChunk eechunk = new AltosEepromChunk(serial_line, block, block == log.start_block);
+
+ /*
+ * Guess what kind of data is there if the device
+ * didn't tell us
+ */
+
+ if (log_format == Altos.AO_LOG_FORMAT_UNKNOWN) {
+ if (block == log.start_block) {
+ if (eechunk.data(0) == Altos.AO_LOG_FLIGHT)
+ log_format = Altos.AO_LOG_FORMAT_FULL;
+ else
+ log_format = Altos.AO_LOG_FORMAT_TINY;
+ }