summaryrefslogtreecommitdiff
path: root/altosuilib/AltosEepromMonitorUI.java
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 /altosuilib/AltosEepromMonitorUI.java
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 'altosuilib/AltosEepromMonitorUI.java')
-rw-r--r--altosuilib/AltosEepromMonitorUI.java10
1 files changed, 8 insertions, 2 deletions
diff --git a/altosuilib/AltosEepromMonitorUI.java b/altosuilib/AltosEepromMonitorUI.java
index b72dfdf4..d2d95678 100644
--- a/altosuilib/AltosEepromMonitorUI.java
+++ b/altosuilib/AltosEepromMonitorUI.java
@@ -167,15 +167,21 @@ public class AltosEepromMonitorUI extends AltosUIDialog implements AltosEepromMo
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 >= 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;
- double spos = (double) (state - min_state) / (double) nstate;
+ double spos = (double) state / (double) nstate;
double bpos = state_block / 100.0;
pos = spos + bpos / nstate;