* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
-package org.altusmetrum.altoslib_5;
+package org.altusmetrum.altoslib_8;
import java.io.*;
import java.util.*;
}
boolean done;
- boolean start;
+ int prev_state;
+ int state_block;
void LogEeprom(AltosEeprom r) throws IOException {
if (r.cmd != AltosLib.AO_LOG_INVALID) {
monitor.set_flight(state.flight);
/* Monitor state transitions to update display */
- if (state.state != AltosLib.ao_flight_invalid &&
- state.state <= AltosLib.ao_flight_landed)
+ if (state.state() != AltosLib.ao_flight_invalid &&
+ state.state() <= AltosLib.ao_flight_landed)
{
- if (state.state > AltosLib.ao_flight_pad)
+ if (state.state() > AltosLib.ao_flight_pad)
want_file = true;
- if (state.state == AltosLib.ao_flight_landed)
+ if (state.state() == AltosLib.ao_flight_landed)
done = true;
}
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;
+ prev_state = AltosLib.ao_flight_startup;
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(link, block, block == log.start_block);
/*
}
CaptureEeprom (eechunk, log_format);
+
+ if (state.state() != prev_state && state.state() != AltosLib.ao_flight_invalid) {
+ state_block = block;
+ prev_state = state.state();
+ }
+
+ monitor.set_value(state.state_name(),
+ state.state(),
+ block - state_block,
+ block - log.start_block);
}
CheckFile(true);
- if (eeprom_file != null) {
- eeprom_file.flush();
- eeprom_file.close();
- }
}
public void run () {
parse_exception = null;
if (log.selected) {
monitor.reset();
+ eeprom_file = null;
try {
CaptureLog(log);
} catch (ParseException e) {
parse_exception = e;
}
+ if (eeprom_file != null) {
+ eeprom_file.flush();
+ eeprom_file.close();
+ }
}
if (parse_exception != null) {
failed = true;