Cleanups.
This commit is contained in:
parent
7cb0268afc
commit
1f5c03b64e
2 changed files with 3 additions and 6 deletions
|
@ -104,10 +104,8 @@ public class RuffyScripter {
|
||||||
|
|
||||||
private volatile Command activeCmd = null;
|
private volatile Command activeCmd = null;
|
||||||
|
|
||||||
// TODO take a callback to call when command finishes?
|
// TODO fire up a monitoring thread to intervene when we're stuck? re-bind service
|
||||||
// TODO sometimes hangs ... we should timeout and raise an alert to check the pump and ruffy
|
// in case ruffy app went away
|
||||||
// TODO not getting a menu update in a while is a good cue ...
|
|
||||||
// fire up a monitoring thread for that?
|
|
||||||
public CommandResult runCommand(final Command cmd) {
|
public CommandResult runCommand(final Command cmd) {
|
||||||
try {
|
try {
|
||||||
if (isPumpBusy()) {
|
if (isPumpBusy()) {
|
||||||
|
|
|
@ -81,8 +81,7 @@ public class BolusCommand implements Command {
|
||||||
private void verifyDisplayedBolusAmount(RuffyScripter scripter) {
|
private void verifyDisplayedBolusAmount(RuffyScripter scripter) {
|
||||||
double displayedBolus = (double) scripter.currentMenu.getAttribute(MenuAttribute.BOLUS);
|
double displayedBolus = (double) scripter.currentMenu.getAttribute(MenuAttribute.BOLUS);
|
||||||
log.debug("Final bolus: " + displayedBolus);
|
log.debug("Final bolus: " + displayedBolus);
|
||||||
// TODO can't we just use BigDecimal? doubles aren't precise ...
|
if (Math.abs(displayedBolus - bolus) > 0.05) {
|
||||||
if (Math.abs(displayedBolus - bolus) > 0.001) {
|
|
||||||
throw new CommandException().message("Failed to set correct bolus. Expected: " + bolus + ", actual: " + displayedBolus);
|
throw new CommandException().message("Failed to set correct bolus. Expected: " + bolus + ", actual: " + displayedBolus);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue