From 34f3428d99c23775151a6279e1bea7178af9e4ff Mon Sep 17 00:00:00 2001 From: Johannes Mockenhaupt Date: Sun, 17 Dec 2017 15:28:55 +0100 Subject: [PATCH] ComboPlugin.setTempBasal: clean up, fix potential bug. (cherry picked from commit 41c45a1) --- .../androidaps/plugins/PumpCombo/ComboPlugin.java | 8 +++----- 1 file changed, 3 insertions(+), 5 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 5965dd4cc9..9f737d39d0 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 @@ -610,12 +610,12 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf } PumpState state = commandResult.state; - if (state.tbrActive && state.tbrPercent == percent + if (state.tbrActive && state.tbrPercent == adjustedPercent && (state.tbrRemainingDuration == durationInMinutes || state.tbrRemainingDuration == durationInMinutes - 1)) { TemporaryBasal tempStart = new TemporaryBasal(); tempStart.date = state.timestamp; - tempStart.durationInMinutes = durationInMinutes; - tempStart.percentRate = adjustedPercent; + tempStart.durationInMinutes = state.tbrRemainingDuration; + tempStart.percentRate = state.tbrPercent; tempStart.isAbsolute = false; tempStart.source = Source.USER; MainApp.getConfigBuilder().addToHistoryTempBasal(tempStart); @@ -694,8 +694,6 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf } } - // Pass this to qeueue?? - // hm, now that each PumpInterface method is basically one RuffyCommand again .... commandResult = commandExecution.execute(); if (!commandResult.success && retries > 0) {