summaryrefslogtreecommitdiff
path: root/altoslib
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2015-02-07 20:22:19 -0800
committerKeith Packard <keithp@keithp.com>2015-02-07 20:22:19 -0800
commit426bacbbd6e0573b143e7c48d71db977e53181fc (patch)
tree57684750cac52d4b3fe4e24921a383a7a9f5e7a8 /altoslib
parentaea188e4227993c508c7045d02f2bc87abd4e428 (diff)
altosuilib: Get the Eeprom download progress bar working again
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>
Diffstat (limited to 'altoslib')
-rw-r--r--altoslib/AltosEepromDownload.java20
1 files changed, 13 insertions, 7 deletions
diff --git a/altoslib/AltosEepromDownload.java b/altoslib/AltosEepromDownload.java
index 78a1f4be..00b20272 100644
--- a/altoslib/AltosEepromDownload.java
+++ b/altoslib/AltosEepromDownload.java
@@ -75,7 +75,8 @@ public class AltosEepromDownload implements Runnable {
}
boolean done;
- boolean start;
+ int prev_state;
+ int state_block;
void LogEeprom(AltosEeprom r) throws IOException {
if (r.cmd != AltosLib.AO_LOG_INVALID) {
@@ -140,7 +141,6 @@ public class AltosEepromDownload implements Runnable {
state = new AltosState();
done = false;
- start = true;
if (flights.config_data.serial < 0)
throw new IOException("no serial number found");
@@ -154,12 +154,8 @@ public class AltosEepromDownload implements Runnable {
/* 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);
/*
@@ -177,6 +173,16 @@ public class AltosEepromDownload implements Runnable {
}
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) {