Don't close connection when other cmds are about to be run.

This commit is contained in:
Johannes Mockenhaupt 2017-07-15 14:19:54 +02:00
parent f5ef666061
commit 8bc4cd255a
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1

View file

@ -118,8 +118,12 @@ public class ComboPlugin implements PluginBase, PumpInterface {
private CommandResult readPumpState(boolean keepConnectionOpen) { private CommandResult readPumpState(boolean keepConnectionOpen) {
CommandResult commandResult = runCommand(new ReadStateCommand(), keepConnectionOpen); CommandResult commandResult = runCommand(new ReadStateCommand(), keepConnectionOpen);
if (commandResult.success) {
pumpState = commandResult.state; pumpState = commandResult.state;
log.debug("Pump state: " + commandResult.state); log.debug("Pump state: " + commandResult.state);
} else {
log.warn("Reading pump status failed: " + commandResult.message);
}
return commandResult; return commandResult;
} }
@ -376,7 +380,7 @@ public class ComboPlugin implements PluginBase, PumpInterface {
percent = rounded; percent = rounded;
} }
MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.settingtempbasal))); 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) { if (commandResult.enacted) {
TemporaryBasal tempStart = new TemporaryBasal(System.currentTimeMillis()); TemporaryBasal tempStart = new TemporaryBasal(System.currentTimeMillis());
tempStart.durationInMinutes = durationInMinutes; tempStart.durationInMinutes = durationInMinutes;