Splitted boluses: add a wait, so that boluses are delivered with 40s between them.

This commit is contained in:
Johannes Mockenhaupt 2017-08-28 21:02:37 +02:00
parent e4454be5c1
commit 448f527525
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1
2 changed files with 9 additions and 9 deletions

View file

@ -51,7 +51,9 @@ public class Config {
// Combo specific // Combo specific
/** enable the UNFINISHED and currently BROKEN bolus cammand that reports progress and can be cancelled */ /** enable the UNFINISHED and currently BROKEN bolus cammand that reports progress and can be cancelled */
public static final boolean comboExperimentalBolus = false; 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 */ /** Very quick hack to split up bolus into 2 U parts, spaced roughly 45s apart.
public static final boolean comboSplitBoluses = false && !comboExperimentalBolus; * 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;
} }

View file

@ -51,11 +51,6 @@ import info.nightscout.androidaps.plugins.PumpCombo.events.EventComboPumpUpdateG
import info.nightscout.utils.DateUtil; import info.nightscout.utils.DateUtil;
import info.nightscout.utils.SP; 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. * 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 || detailedBolusInfo.carbs > 0) {
if (detailedBolusInfo.insulin > 0) { if (detailedBolusInfo.insulin > 0) {
// bolus needed, ask pump to deliver it // bolus needed, ask pump to deliver it
if (!Config.comboSplitBoluses) { if (!Config.comboExperimentalSplitBoluses) {
return deliverBolus(detailedBolusInfo); return deliverBolus(detailedBolusInfo);
} else { } else {
// split up bolus into 2 U parts // split up bolus into 2 U parts
@ -419,6 +414,9 @@ public class ComboPlugin implements PluginBase, PumpInterface {
pumpEnactResult.bolusDelivered += bolus; pumpEnactResult.bolusDelivered += bolus;
remainingBolus -= 2; remainingBolus -= 2;
split++; 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); MainApp.getConfigBuilder().addToHistoryTreatment(detailedBolusInfo);
return pumpEnactResult; return pumpEnactResult;