From 1f5c03b64e7a487deede381c87fb0fcb3a8c4bef Mon Sep 17 00:00:00 2001 From: Johannes Mockenhaupt Date: Thu, 13 Jul 2017 20:19:22 +0200 Subject: [PATCH] Cleanups. --- .../main/java/de/jotomo/ruffyscripter/RuffyScripter.java | 6 ++---- .../java/de/jotomo/ruffyscripter/commands/BolusCommand.java | 3 +-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/de/jotomo/ruffyscripter/RuffyScripter.java b/app/src/main/java/de/jotomo/ruffyscripter/RuffyScripter.java index 3c25f325cf..5b1c9b2ff8 100644 --- a/app/src/main/java/de/jotomo/ruffyscripter/RuffyScripter.java +++ b/app/src/main/java/de/jotomo/ruffyscripter/RuffyScripter.java @@ -104,10 +104,8 @@ public class RuffyScripter { private volatile Command activeCmd = null; - // TODO take a callback to call when command finishes? - // TODO sometimes hangs ... we should timeout and raise an alert to check the pump and ruffy - // TODO not getting a menu update in a while is a good cue ... - // fire up a monitoring thread for that? + // TODO fire up a monitoring thread to intervene when we're stuck? re-bind service + // in case ruffy app went away public CommandResult runCommand(final Command cmd) { try { if (isPumpBusy()) { diff --git a/app/src/main/java/de/jotomo/ruffyscripter/commands/BolusCommand.java b/app/src/main/java/de/jotomo/ruffyscripter/commands/BolusCommand.java index 2550c121e5..9a13180855 100644 --- a/app/src/main/java/de/jotomo/ruffyscripter/commands/BolusCommand.java +++ b/app/src/main/java/de/jotomo/ruffyscripter/commands/BolusCommand.java @@ -81,8 +81,7 @@ public class BolusCommand implements Command { private void verifyDisplayedBolusAmount(RuffyScripter scripter) { double displayedBolus = (double) scripter.currentMenu.getAttribute(MenuAttribute.BOLUS); log.debug("Final bolus: " + displayedBolus); - // TODO can't we just use BigDecimal? doubles aren't precise ... - if (Math.abs(displayedBolus - bolus) > 0.001) { + if (Math.abs(displayedBolus - bolus) > 0.05) { throw new CommandException().message("Failed to set correct bolus. Expected: " + bolus + ", actual: " + displayedBolus); } }