From 8bc4cd255a9a1f7a2d1872f225d2544663a928d5 Mon Sep 17 00:00:00 2001 From: Johannes Mockenhaupt Date: Sat, 15 Jul 2017 14:19:54 +0200 Subject: [PATCH] Don't close connection when other cmds are about to be run. --- .../androidaps/plugins/PumpCombo/ComboPlugin.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboPlugin.java index 96b3630fb2..86272be29e 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboPlugin.java @@ -118,8 +118,12 @@ public class ComboPlugin implements PluginBase, PumpInterface { private CommandResult readPumpState(boolean keepConnectionOpen) { CommandResult commandResult = runCommand(new ReadStateCommand(), keepConnectionOpen); - pumpState = commandResult.state; - log.debug("Pump state: " + commandResult.state); + if (commandResult.success) { + pumpState = commandResult.state; + log.debug("Pump state: " + commandResult.state); + } else { + log.warn("Reading pump status failed: " + commandResult.message); + } return commandResult; } @@ -376,7 +380,7 @@ public class ComboPlugin implements PluginBase, PumpInterface { percent = rounded; } MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.settingtempbasal))); - CommandResult commandResult = runCommand(new SetTbrCommand(percent, durationInMinutes), false); + CommandResult commandResult = runCommand(new SetTbrCommand(percent, durationInMinutes), true); if (commandResult.enacted) { TemporaryBasal tempStart = new TemporaryBasal(System.currentTimeMillis()); tempStart.durationInMinutes = durationInMinutes;