X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=altosuilib%2FAltosEepromMonitorUI.java;h=d708ae96aaca11891fd9a5ccdff1df16ca88289e;hb=e3b30d4bd6faf68c885791fb87229558cc1157a6;hp=b72dfdf49757ae65dce59cf64b6d6a974e91e6ae;hpb=35ad1833b10595564de84c88f44a214b1c134ccf;p=fw%2Faltos diff --git a/altosuilib/AltosEepromMonitorUI.java b/altosuilib/AltosEepromMonitorUI.java index b72dfdf4..d708ae96 100644 --- a/altosuilib/AltosEepromMonitorUI.java +++ b/altosuilib/AltosEepromMonitorUI.java @@ -3,7 +3,8 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; version 2 of the License. + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of @@ -15,12 +16,12 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.altosuilib_3; +package org.altusmetrum.altosuilib_11; import java.awt.*; import java.awt.event.*; import javax.swing.*; -import org.altusmetrum.altoslib_5.*; +import org.altusmetrum.altoslib_11.*; public class AltosEepromMonitorUI extends AltosUIDialog implements AltosEepromMonitor { JFrame owner; @@ -167,15 +168,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;