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 96b5b2f4d0..0fe788d72e 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
@@ -141,7 +141,8 @@ public class ComboPlugin implements PluginBase, PumpInterface {
long now = System.currentTimeMillis();
long fiveMinutesSinceLastAlarm = lastAlarmTime + (5 * 60 * 1000) + (15 * 1000);
boolean loopEnabled = ConfigBuilderPlugin.getActiveLoop() != null;
- boolean ignoreLastFailedTbrCmd = SP.getBoolean(R.string.key_combo_ignore_transient_tbr_errors, false)
+ boolean ignoreLastFailedTbrCmd = SP.getBoolean(R.string.key_combo_enable_experimental_features, false)
+ && SP.getBoolean(R.string.key_combo_experimental_ignore_transient_tbr_errors, false)
&& localLastCmd instanceof SetTbrCommand && ignoreLastSetTbrFailure;
if (now > fiveMinutesSinceLastAlarm && loopEnabled && !ignoreLastFailedTbrCmd) {
log.error("Command failed: " + localLastCmd);
@@ -554,6 +555,20 @@ public class ComboPlugin implements PluginBase, PumpInterface {
if (unroundedPercentage != roundedPercentage) {
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_reject_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 4d0ea04beb..4f95d46808 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -718,7 +718,14 @@
Experimental bolus
combo_experimental_split_bolus
Experimental split bolus feature
- combo_ignore_transient_tbr_errors
- Ignore transient TBR errors
+ combo_ignore_transient_tbr_errors
+ Ignore transient TBR errors
+ combo_experimental_reject_tbr_changes_below_delta
+ Reject 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.
+ Ignore failures when setting a TBR, unless setting the next TBR also fails.
+ Splits boluses into 2 U parts and waits around 45 after each to slow down bolus delivery.
+ Enables the in-development bolus with progress report and cancel option.
+ Unlocks experimental features which are in development and might be broken entirely.
diff --git a/app/src/main/res/xml/pref_combo.xml b/app/src/main/res/xml/pref_combo.xml
index 857281b097..d1d1cd5a6b 100644
--- a/app/src/main/res/xml/pref_combo.xml
+++ b/app/src/main/res/xml/pref_combo.xml
@@ -7,21 +7,36 @@
+ android:title="@string/combo_enable_experimental_features"
+ android:summary="@string/combo_enable_experimental_features_summary" />
+ android:title="@string/combo_enable_experimental_bolus"
+ android:summary="@string/combo_enable_experimental_bolus_summary" />
+ android:title="@string/combo_enable_experimental_split_bolus"
+ android:summary="@string/combo_enable_experimental_split_bolus_summary"/>
+
+ android:key="@string/key_combo_experimental_ignore_transient_tbr_errors"
+ android:title="@string/combo_experimental_ignore_transient_tbr_errors"
+ android:summary="@string/combo_experimental_ignore_transient_tbr_errors_summary"/>
+
+
+