BolusCommand: deal with blinking values.
How did this not trigger with all the boluses I've issued so far?
This commit is contained in:
parent
7fe9ad7910
commit
ebe14fb0cf
|
@ -110,14 +110,23 @@ public class BolusCommand implements Command {
|
|||
}
|
||||
|
||||
private void verifyDisplayedBolusAmount(RuffyScripter scripter) {
|
||||
scripter.verifyMenuIsDisplayed(MenuType.BOLUS_ENTER);
|
||||
double displayedBolus = (double) scripter.currentMenu.getAttribute(MenuAttribute.BOLUS);
|
||||
double displayedBolus = readDisplayedBolusAmount(scripter);
|
||||
log.debug("Final bolus: " + displayedBolus);
|
||||
if (Math.abs(displayedBolus - bolus) > 0.05) {
|
||||
throw new CommandException().message("Failed to set correct bolus. Expected: " + bolus + ", actual: " + displayedBolus);
|
||||
}
|
||||
}
|
||||
|
||||
private double readDisplayedBolusAmount(RuffyScripter scripter) {
|
||||
scripter.verifyMenuIsDisplayed(MenuType.BOLUS_ENTER);
|
||||
Object amountObj = scripter.currentMenu.getAttribute(MenuAttribute.BOLUS);
|
||||
while (!(amountObj instanceof Double)) {
|
||||
scripter.waitForMenuUpdate();
|
||||
amountObj = scripter.currentMenu.getAttribute(MenuAttribute.BOLUS);
|
||||
}
|
||||
return (double) amountObj;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "BolusCommand{" +
|
||||
|
|
Loading…
Reference in a new issue