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
/** 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;
}

View file

@ -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;