From 448f527525c88c06c60a7e9da365538a750a2d6c Mon Sep 17 00:00:00 2001 From: Johannes Mockenhaupt Date: Mon, 28 Aug 2017 21:02:37 +0200 Subject: [PATCH] Splitted boluses: add a wait, so that boluses are delivered with 40s between them. --- .../main/java/info/nightscout/androidaps/Config.java | 8 +++++--- .../androidaps/plugins/PumpCombo/ComboPlugin.java | 10 ++++------ 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/Config.java b/app/src/main/java/info/nightscout/androidaps/Config.java index cbc7c274df..b8ab7ed8dd 100644 --- a/app/src/main/java/info/nightscout/androidaps/Config.java +++ b/app/src/main/java/info/nightscout/androidaps/Config.java @@ -51,7 +51,9 @@ public class Config { // Combo specific /** enable the UNFINISHED and currently BROKEN bolus cammand that reports progress and can be cancelled */ public static final boolean comboExperimentalBolus = false; - /** very quick hack to split up bolus into 2 U parts, spaced roughly 45s apart. - * Don't combine with experimental bolus */ - public static final boolean comboSplitBoluses = false && !comboExperimentalBolus; + + /** Very quick hack to split up bolus into 2 U parts, spaced roughly 45s apart. + * If there's an error during bolusing, no record is created in AAPS. + * Don't combine with experimental bolus! */ + public static final boolean comboExperimentalSplitBoluses = false && !comboExperimentalBolus; } 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 9b2861ced0..ea8280ff41 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 @@ -51,11 +51,6 @@ import info.nightscout.androidaps.plugins.PumpCombo.events.EventComboPumpUpdateG import info.nightscout.utils.DateUtil; import info.nightscout.utils.SP; -import static de.jotomo.ruffyscripter.commands.CancellableBolusCommand.ProgressReportCallback.State.DELIVERED; -import static de.jotomo.ruffyscripter.commands.CancellableBolusCommand.ProgressReportCallback.State.DELIVERING; -import static de.jotomo.ruffyscripter.commands.CancellableBolusCommand.ProgressReportCallback.State.STOPPED; -import static de.jotomo.ruffyscripter.commands.CancellableBolusCommand.ProgressReportCallback.State.STOPPING; - /** * Created by mike on 05.08.2016. */ @@ -394,7 +389,7 @@ public class ComboPlugin implements PluginBase, PumpInterface { if (detailedBolusInfo.insulin > 0 || detailedBolusInfo.carbs > 0) { if (detailedBolusInfo.insulin > 0) { // bolus needed, ask pump to deliver it - if (!Config.comboSplitBoluses) { + if (!Config.comboExperimentalSplitBoluses) { return deliverBolus(detailedBolusInfo); } else { // split up bolus into 2 U parts @@ -419,6 +414,9 @@ public class ComboPlugin implements PluginBase, PumpInterface { pumpEnactResult.bolusDelivered += bolus; remainingBolus -= 2; split++; + // Programming the pump for 2 U takes ~20, so wait 20s more so the + // boluses are spaced 40s apart. + SystemClock.sleep(20 * 1000); } MainApp.getConfigBuilder().addToHistoryTreatment(detailedBolusInfo); return pumpEnactResult;