split MaxIOB for SMB

This commit is contained in:
Milos Kozak 2018-04-08 20:17:15 +02:00
parent 7a74364af6
commit d9279eed2a
3 changed files with 13 additions and 6 deletions

View file

@ -169,7 +169,11 @@ public class SafetyPlugin extends PluginBase implements ConstraintsInterface {
@Override @Override
public Constraint<Double> applyMaxIOBConstraints(Constraint<Double> maxIob) { public Constraint<Double> applyMaxIOBConstraints(Constraint<Double> maxIob) {
double maxIobPref = SP.getDouble(R.string.key_openapsma_max_iob, 1.5d); double maxIobPref;
if (OpenAPSSMBPlugin.getPlugin().isEnabled(PluginType.APS))
maxIobPref = SP.getDouble(R.string.key_openapssmb_max_iob, 3d);
else
maxIobPref = SP.getDouble(R.string.key_openapsma_max_iob, 1.5d);
maxIob.setIfSmaller(maxIobPref, String.format(MainApp.gs(R.string.limitingiob), maxIobPref, MainApp.gs(R.string.maxvalueinpreferences)), this); maxIob.setIfSmaller(maxIobPref, String.format(MainApp.gs(R.string.limitingiob), maxIobPref, MainApp.gs(R.string.maxvalueinpreferences)), this);
if (OpenAPSMAPlugin.getPlugin().isEnabled(PluginType.APS)) if (OpenAPSMAPlugin.getPlugin().isEnabled(PluginType.APS))

View file

@ -203,7 +203,7 @@
<string name="openapsma_maxbasal_title">Max U/hr a Temp Basal can be set to</string> <string name="openapsma_maxbasal_title">Max U/hr a Temp Basal can be set to</string>
<string name="openapsma_maxbasal_summary">This value is called max basal in OpenAPS context</string> <string name="openapsma_maxbasal_summary">This value is called max basal in OpenAPS context</string>
<string name="openapsma_maxiob_title">Maximum basal IOB OpenAPS can deliver [U]</string> <string name="openapsma_maxiob_title">Maximum basal IOB OpenAPS can deliver [U]</string>
<string name="openapsma_maxiob_summary">This value is called Max IOB in OpenAPS context\nThis will default to zero. After several days or weeks, depending on your comfort level, you may choose to adjust this number.</string> <string name="openapsma_maxiob_summary">This value is called Max IOB in OpenAPS context\nThis is maximal insulin in [U] APS can deliver at once.</string>
<string name="bg_lang">Bulgarian</string> <string name="bg_lang">Bulgarian</string>
<string name="dismiss">DISMISS</string> <string name="dismiss">DISMISS</string>
<string name="language">Language</string> <string name="language">Language</string>
@ -989,4 +989,7 @@
<string name="iobcobcalculator" translatable="false">IobCobCalculator</string> <string name="iobcobcalculator" translatable="false">IobCobCalculator</string>
<string name="waitingfortimesynchronization">Waiting for time synchronization (%d sec)</string> <string name="waitingfortimesynchronization">Waiting for time synchronization (%d sec)</string>
<string name="loopdisconnectedfor">Disconnected (%d m)</string> <string name="loopdisconnectedfor">Disconnected (%d m)</string>
<string name="key_openapssmb_max_iob" translatable="false">openapsmb_max_iob</string>
<string name="openapssmb_maxiob_title">Maximum total IOB OpenAPS can\'t go over [U]</string>
<string name="openapssmb_maxiob_summary">This value is called Max IOB in OpenAPS context\nOpenAPS will not add more insulin if current IOB is greater than this value</string>
</resources> </resources>

View file

@ -11,11 +11,11 @@
android:dialogMessage="@string/openapsma_maxbasal_summary" android:dialogMessage="@string/openapsma_maxbasal_summary"
android:title="@string/openapsma_maxbasal_title" /> android:title="@string/openapsma_maxbasal_title" />
<EditTextPreference <EditTextPreference
android:defaultValue="1.5" android:defaultValue="3"
android:key="@string/key_openapsma_max_iob" android:key="@string/key_openapssmb_max_iob"
android:numeric="decimal" android:numeric="decimal"
android:dialogMessage="@string/openapsma_maxiob_summary" android:dialogMessage="@string/openapssmb_maxiob_summary"
android:title="@string/openapsma_maxiob_title" /> android:title="@string/openapssmb_maxiob_title" />
<SwitchPreference <SwitchPreference
android:defaultValue="false" android:defaultValue="false"
android:key="openapsama_useautosens" android:key="openapsama_useautosens"