The eeprom download code wasn't computing the start of each state
transition correctly, so the progress bar was snapping to the end of
the chunk for each state.
Invalid state values would snap the bar to the right side.
Landed state wasn't ever seen, so the bar would not ever fill.
Signed-off-by: Keith Packard <keithp@keithp.com>
+ int prev_state;
+ int state_block;
void LogEeprom(AltosEeprom r) throws IOException {
if (r.cmd != AltosLib.AO_LOG_INVALID) {
void LogEeprom(AltosEeprom r) throws IOException {
if (r.cmd != AltosLib.AO_LOG_INVALID) {
state = new AltosState();
done = false;
state = new AltosState();
done = false;
if (flights.config_data.serial < 0)
throw new IOException("no serial number found");
if (flights.config_data.serial < 0)
throw new IOException("no serial number found");
/* Now scan the eeprom, reading blocks of data and converting to .eeprom file form */
state_block = log.start_block;
/* 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++) {
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);
/*
AltosEepromChunk eechunk = new AltosEepromChunk(link, block, block == log.start_block);
/*
}
CaptureEeprom (eechunk, log_format);
}
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) {
}
CheckFile(true);
if (eeprom_file != null) {
pos = lblock / 1000.0;
s = String.format("block %d", block);
} else {
pos = lblock / 1000.0;
s = String.format("block %d", block);
} else {
+ if (state == AltosLib.ao_flight_invalid)
+ state = 0;
if (state_block > 100)
state_block = 100;
if (state < min_state) state = min_state;
if (state_block > 100)
state_block = 100;
if (state < min_state) state = min_state;
- if (state >= max_state) state = max_state - 1;
+ if (state > max_state) state = max_state;
+
+ if (state == max_state)
+ state_block = 0;
+
state -= min_state;
int nstate = max_state - min_state;
state -= min_state;
int nstate = max_state - min_state;
- double spos = (double) (state - min_state) / (double) nstate;
+ double spos = (double) state / (double) nstate;
double bpos = state_block / 100.0;
pos = spos + bpos / nstate;
double bpos = state_block / 100.0;
pos = spos + bpos / nstate;