From f33d55b092faa926d298f225ad2845b836b37673 Mon Sep 17 00:00:00 2001 From: Johannes Mockenhaupt Date: Tue, 17 Oct 2017 19:37:32 +0200 Subject: [PATCH] Trim combo prefs. --- .../plugins/PumpCombo/ComboPlugin.java | 47 +------------------ app/src/main/res/values/strings.xml | 11 ++--- app/src/main/res/xml/pref_combo.xml | 18 ++----- 3 files changed, 9 insertions(+), 67 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 32934f5284..fde3410c89 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 @@ -324,39 +324,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 (!(SP.getBoolean(R.string.key_combo_enable_experimental_features, false) - && SP.getBoolean(R.string.key_combo_enable_experimental_split_bolus, false))) { - return deliverBolus(detailedBolusInfo); - } else { - // split up bolus into 2 U parts - PumpEnactResult pumpEnactResult = new PumpEnactResult(); - pumpEnactResult.success = true; - pumpEnactResult.enacted = true; - pumpEnactResult.bolusDelivered = 0d; - pumpEnactResult.carbsDelivered = detailedBolusInfo.carbs; - - double remainingBolus = detailedBolusInfo.insulin; - int split = 1; - while (remainingBolus > 0.05) { - double bolus = remainingBolus > 2 ? 2 : remainingBolus; - DetailedBolusInfo bolusInfo = new DetailedBolusInfo(); - bolusInfo.insulin = bolus; - bolusInfo.isValid = false; - log.debug("Delivering split bolus #" + split + " with " + bolus + " U"); - PumpEnactResult bolusResult = deliverBolus(bolusInfo); - if (!bolusResult.success) { - return bolusResult; - } - 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; - } + return deliverBolus(detailedBolusInfo); } else { // no bolus required, carb only treatment @@ -438,19 +406,6 @@ public class ComboPlugin implements PluginBase, PumpInterface { log.debug("Rounded requested rate " + unroundedPercentage + "% -> " + roundedPercentage + "%"); } - TemporaryBasal activeTemp = MainApp.getConfigBuilder().getTempBasalFromHistory(System.currentTimeMillis()); - if (!force && activeTemp != null) { - int minRequiredDelta = SP.getInt(R.string.key_combo_experimental_skip_tbr_changes_below_delta, 0); - boolean deltaBelowThreshold = Math.abs(activeTemp.percentRate - roundedPercentage) < minRequiredDelta; - if (deltaBelowThreshold) { - log.debug("Skipping setting APS-requested TBR change, since the requested change from " - + activeTemp.percentRate + " -> " + roundedPercentage + " is below the delta threshold of " + minRequiredDelta); - PumpEnactResult pumpEnactResult = new PumpEnactResult(); - pumpEnactResult.success = true; - pumpEnactResult.enacted = false; - return pumpEnactResult; - } - } return setTempBasalPercent(roundedPercentage, durationInMinutes); } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 68b8e17aec..fb35599aa7 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -754,15 +754,12 @@ combo_enable_experimental_features Enable experimental features Unlocks experimental features which are in development and might be broken entirely. - combo_experimental_split_bolus - Experimental split bolus feature - Splits boluses into 2 U parts and waits around 45s after each to slow down bolus delivery (only active with non-experimental bolus). - combo_experimental_reject_tbr_changes_below_delta - Skip TBR changes below threshold (%). - Don\'t set a TBR if the difference between the new and a running TBR is below this threshold in percent. Specifying 0 disables this option. + combo_ignore_transient_tbr_errors + Ignore transient errors + Ignore a connect failure for a background operation untless the next attempt also fails. combo_disable_alerts Disable alerts - Ignore all errors encountered while communicating with the pump. Alerts raised by the pump (including those caused by AAPS) will still be raised. + Ignore all errors encountered while communicating with the pump. Alerts raised by the pump (including those caused by AndroidAPS) will still be raised on the pump. Programming pump for bolusing diff --git a/app/src/main/res/xml/pref_combo.xml b/app/src/main/res/xml/pref_combo.xml index 1a73dd3599..1ab6c38db9 100644 --- a/app/src/main/res/xml/pref_combo.xml +++ b/app/src/main/res/xml/pref_combo.xml @@ -12,25 +12,15 @@ - - - - + android:key="@string/key_combo_experimental_ignore_transient_errors" + android:summary="@string/combo_experimental_ignore_transient_errors_summary" + android:title="@string/combo_experimental_ignore_transient_errors" /> - \ No newline at end of file