ComboPlugin.setTempBasal: clean up, fix potential bug.

(cherry picked from commit 41c45a1)
This commit is contained in:
Johannes Mockenhaupt 2017-12-17 15:28:55 +01:00
parent 5f4a90d068
commit 34f3428d99
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1

View file

@ -610,12 +610,12 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf
} }
PumpState state = commandResult.state; PumpState state = commandResult.state;
if (state.tbrActive && state.tbrPercent == percent if (state.tbrActive && state.tbrPercent == adjustedPercent
&& (state.tbrRemainingDuration == durationInMinutes || state.tbrRemainingDuration == durationInMinutes - 1)) { && (state.tbrRemainingDuration == durationInMinutes || state.tbrRemainingDuration == durationInMinutes - 1)) {
TemporaryBasal tempStart = new TemporaryBasal(); TemporaryBasal tempStart = new TemporaryBasal();
tempStart.date = state.timestamp; tempStart.date = state.timestamp;
tempStart.durationInMinutes = durationInMinutes; tempStart.durationInMinutes = state.tbrRemainingDuration;
tempStart.percentRate = adjustedPercent; tempStart.percentRate = state.tbrPercent;
tempStart.isAbsolute = false; tempStart.isAbsolute = false;
tempStart.source = Source.USER; tempStart.source = Source.USER;
MainApp.getConfigBuilder().addToHistoryTempBasal(tempStart); 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(); commandResult = commandExecution.execute();
if (!commandResult.success && retries > 0) { if (!commandResult.success && retries > 0) {