Cleanups.

This commit is contained in:
Johannes Mockenhaupt 2017-07-13 20:19:22 +02:00
parent 7cb0268afc
commit 1f5c03b64e
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1
2 changed files with 3 additions and 6 deletions

View file

@ -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()) {

View file

@ -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);
} }
} }