+ boolean done;
+ boolean start;
+
+ void LogEeprom(AltosEeprom r) throws IOException {
+ if (r.cmd != Altos.AO_LOG_INVALID) {
+ String line = r.string();
+ if (eeprom_file != null)
+ eeprom_file.write(line);
+ else
+ eeprom_pending.add(line);
+ }
+ }
+
+ void CaptureEeprom(AltosEepromChunk eechunk, int log_format) throws IOException {
+ boolean any_valid = false;
+
+ int record_length = 8;
+
+ state.set_serial(flights.config_data.serial);
+
+ for (int i = 0; i < AltosEepromChunk.chunk_size && !done; i += record_length) {
+ AltosEeprom r = eechunk.eeprom(i, log_format);
+
+ record_length = r.record_length();
+
+ r.update_state(state);
+
+ /* Monitor state transitions to update display */
+ if (state.state != AltosLib.ao_flight_invalid &&
+ state.state <= AltosLib.ao_flight_landed)
+ {
+ if (state.state > Altos.ao_flight_pad)
+ want_file = true;
+ if (state.state == AltosLib.ao_flight_landed)
+ done = true;
+ }
+
+ if (state.gps != null)
+ want_file = true;
+
+ if (r.valid) {
+ any_valid = true;
+ LogEeprom(r);
+ }
+ }
+ if (!any_valid)
+ done = true;
+
+ CheckFile(false);
+ }
+