Add option to skip small TBR changes, add summaries to prefs.
(cherry picked from commit a76b03a)
This commit is contained in:
parent
58757735f8
commit
c8c445c608
3 changed files with 45 additions and 8 deletions
|
@ -141,7 +141,8 @@ public class ComboPlugin implements PluginBase, PumpInterface {
|
||||||
long now = System.currentTimeMillis();
|
long now = System.currentTimeMillis();
|
||||||
long fiveMinutesSinceLastAlarm = lastAlarmTime + (5 * 60 * 1000) + (15 * 1000);
|
long fiveMinutesSinceLastAlarm = lastAlarmTime + (5 * 60 * 1000) + (15 * 1000);
|
||||||
boolean loopEnabled = ConfigBuilderPlugin.getActiveLoop() != null;
|
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;
|
&& localLastCmd instanceof SetTbrCommand && ignoreLastSetTbrFailure;
|
||||||
if (now > fiveMinutesSinceLastAlarm && loopEnabled && !ignoreLastFailedTbrCmd) {
|
if (now > fiveMinutesSinceLastAlarm && loopEnabled && !ignoreLastFailedTbrCmd) {
|
||||||
log.error("Command failed: " + localLastCmd);
|
log.error("Command failed: " + localLastCmd);
|
||||||
|
@ -554,6 +555,20 @@ public class ComboPlugin implements PluginBase, PumpInterface {
|
||||||
if (unroundedPercentage != roundedPercentage) {
|
if (unroundedPercentage != roundedPercentage) {
|
||||||
log.debug("Rounded requested rate " + 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);
|
return setTempBasalPercent(roundedPercentage, durationInMinutes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -718,7 +718,14 @@
|
||||||
<string name="combo_enable_experimental_bolus">Experimental bolus</string>
|
<string name="combo_enable_experimental_bolus">Experimental bolus</string>
|
||||||
<string name="key_combo_enable_experimental_split_bolus">combo_experimental_split_bolus</string>
|
<string name="key_combo_enable_experimental_split_bolus">combo_experimental_split_bolus</string>
|
||||||
<string name="combo_enable_experimental_split_bolus">Experimental split bolus feature</string>
|
<string name="combo_enable_experimental_split_bolus">Experimental split bolus feature</string>
|
||||||
<string name="key_combo_ignore_transient_tbr_errors">combo_ignore_transient_tbr_errors</string>
|
<string name="key_combo_experimental_ignore_transient_tbr_errors">combo_ignore_transient_tbr_errors</string>
|
||||||
<string name="combo_ignore_transient_tbr_errors">Ignore transient TBR errors</string>
|
<string name="combo_experimental_ignore_transient_tbr_errors">Ignore transient TBR errors</string>
|
||||||
|
<string name="key_combo_experimental_reject_tbr_changes_below_delta">combo_experimental_reject_tbr_changes_below_delta</string>
|
||||||
|
<string name="combo_experimental_reject_tbr_changes_below_delta">Reject TBR changes below threshold (%)</string>
|
||||||
|
<string name="combo_experimental_reject_tbr_changes_below_delta_summary">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.</string>
|
||||||
|
<string name="combo_experimental_ignore_transient_tbr_errors_summary">Ignore failures when setting a TBR, unless setting the next TBR also fails.</string>
|
||||||
|
<string name="combo_enable_experimental_split_bolus_summary">Splits boluses into 2 U parts and waits around 45 after each to slow down bolus delivery.</string>
|
||||||
|
<string name="combo_enable_experimental_bolus_summary">Enables the in-development bolus with progress report and cancel option.</string>
|
||||||
|
<string name="combo_enable_experimental_features_summary">Unlocks experimental features which are in development and might be broken entirely.</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
||||||
|
|
|
@ -7,21 +7,36 @@
|
||||||
<SwitchPreference
|
<SwitchPreference
|
||||||
android:defaultValue="false"
|
android:defaultValue="false"
|
||||||
android:key="@string/key_combo_enable_experimental_features"
|
android:key="@string/key_combo_enable_experimental_features"
|
||||||
android:title="@string/combo_enable_experimental_features" />
|
android:title="@string/combo_enable_experimental_features"
|
||||||
|
android:summary="@string/combo_enable_experimental_features_summary" />
|
||||||
<SwitchPreference
|
<SwitchPreference
|
||||||
android:dependency="@string/key_combo_enable_experimental_features"
|
android:dependency="@string/key_combo_enable_experimental_features"
|
||||||
android:defaultValue="false"
|
android:defaultValue="false"
|
||||||
android:key="@string/key_combo_enable_experimental_bolus"
|
android:key="@string/key_combo_enable_experimental_bolus"
|
||||||
android:title="@string/combo_enable_experimental_bolus" />
|
android:title="@string/combo_enable_experimental_bolus"
|
||||||
|
android:summary="@string/combo_enable_experimental_bolus_summary" />
|
||||||
<SwitchPreference
|
<SwitchPreference
|
||||||
android:dependency="@string/key_combo_enable_experimental_features"
|
android:dependency="@string/key_combo_enable_experimental_features"
|
||||||
android:defaultValue="false"
|
android:defaultValue="false"
|
||||||
android:key="@string/key_combo_enable_experimental_split_bolus"
|
android:key="@string/key_combo_enable_experimental_split_bolus"
|
||||||
android:title="@string/combo_enable_experimental_split_bolus" />
|
android:title="@string/combo_enable_experimental_split_bolus"
|
||||||
|
android:summary="@string/combo_enable_experimental_split_bolus_summary"/>
|
||||||
|
|
||||||
<SwitchPreference
|
<SwitchPreference
|
||||||
|
android:dependency="@string/key_combo_enable_experimental_features"
|
||||||
android:defaultValue="false"
|
android:defaultValue="false"
|
||||||
android:key="@string/key_combo_ignore_transient_tbr_errors"
|
android:key="@string/key_combo_experimental_ignore_transient_tbr_errors"
|
||||||
android:title="@string/combo_ignore_transient_tbr_errors" />
|
android:title="@string/combo_experimental_ignore_transient_tbr_errors"
|
||||||
|
android:summary="@string/combo_experimental_ignore_transient_tbr_errors_summary"/>
|
||||||
|
|
||||||
|
<!-- TODO add validation, to restrict values to rang 0-100, see pref_absorption_oref0.xml -->
|
||||||
|
<EditTextPreference
|
||||||
|
android:dependency="@string/key_combo_enable_experimental_features"
|
||||||
|
android:key="@string/key_combo_experimental_reject_tbr_changes_below_delta"
|
||||||
|
android:title="@string/combo_experimental_reject_tbr_changes_below_delta"
|
||||||
|
android:defaultValue="0"
|
||||||
|
android:numeric="decimal"
|
||||||
|
android:dialogMessage="@string/combo_experimental_reject_tbr_changes_below_delta_summary"/>
|
||||||
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue