merge in SMBInterval

This commit is contained in:
Tim Gunn 2019-08-10 16:18:58 +12:00
commit 585f4e2bc2
5 changed files with 27 additions and 4 deletions

View file

@ -1091,17 +1091,23 @@ var determine_basal = function determine_basal(glucose_status, currenttemp, iob_
}
rT.reason += ". ";
//allow SMBs every 3 minutes
var nextBolusMins = round(3-lastBolusAge,1);
//allow SMBs every 3 minutes by default
var SMBInterval = 3;
if (profile.SMBInterval) {
// allow SMBIntervals between 1 and 10 minutes
SMBInterval = Math.min(10,Math.max(1,profile.SMBInterval));
}
var nextBolusMins = round(SMBInterval-lastBolusAge,0);
var nextBolusSeconds = round((SMBInterval - lastBolusAge) * 60, 0) % 60;
//console.error(naive_eventualBG, insulinReq, worstCaseInsulinReq, durationReq);
console.error("naive_eventualBG",naive_eventualBG+",",durationReq+"m "+smbLowTempReq+"U/h temp needed; last bolus",lastBolusAge+"m ago; maxBolus: "+maxBolus);
if (lastBolusAge > 3) {
if (lastBolusAge > SMBInterval) {
if (microBolus > 0) {
rT.units = microBolus;
rT.reason += "Microbolusing " + microBolus + "U. ";
}
} else {
rT.reason += "Waiting " + nextBolusMins + "m to microbolus again. ";
rT.reason += "Waiting " + nextBolusMins + "m " + nextBolusSeconds + "s to microbolus again. ";
}
//rT.reason += ". ";

View file

@ -267,6 +267,7 @@ public class DetermineBasalAdapterSMBJS {
mProfile.put("enableSMB_after_carbs", smbEnabled && SP.getBoolean(R.string.key_enableSMB_after_carbs, false) && advancedFiltering);
mProfile.put("maxSMBBasalMinutes", SP.getInt(R.string.key_smbmaxminutes, SMBDefaults.maxSMBBasalMinutes));
mProfile.put("maxUAMSMBBasalMinutes", SP.getInt("key_uamsmbmaxminutes", SMBDefaults.maxUAMSMBBasalMinutes));
mProfile.put("SMBInterval", SP.getInt("key_smbinterval", SMBDefaults.SMBInterval));
if (bolusincrement < pumpbolusstep){
//the bolus incrument is less than what the pump can support (by pump settings or pump restriction), set to value supported by the pump
bolusincrement = pumpbolusstep;

View file

@ -55,6 +55,7 @@ public class SMBDefaults {
// *** WARNING *** DO NOT USE enableSMB_always or enableSMB_after_carbs with xDrip+, Libre, or similar
//public final static boolean enableSMB_after_carbs = false; // enable supermicrobolus for 6h after carbs, even with 0 COB
//public final static boolean allowSMB_with_high_temptarget = false; // allow supermicrobolus (if otherwise enabled) even with high temp targets
public final static int SMBInterval = 3; // minimum interval between SMBs, in minutes. (limited between 1 and 10 min)
public final static int maxSMBBasalMinutes = 30; // maximum minutes of basal that can be delivered as a single SMB with uncovered COB
public final static int maxUAMSMBBasalMinutes = 30; // maximum minutes of basal that can be delivered as a single SMB when IOB exceeds COB
// curve:"rapid-acting" // Supported curves: "bilinear", "rapid-acting" (Novolog, Novorapid, Humalog, Apidra) and "ultra-rapid" (Fiasp)

View file

@ -838,6 +838,8 @@
<string name="bgsource_upload">BG upload settings</string>
<string name="wear_detailed_delta_title">Show detailed delta</string>
<string name="wear_detailed_delta_summary">Show delta with one more decimal place</string>
<string name="key_smbinterval" translatable="false">key_smbinterval</string>
<string name="smbinterval_summary">How frequently SMBs will be given in min</string>
<string name="smbmaxminutes" translatable="false">45 60 75 90 105 120</string>
<string name="smbmaxminutes_summary">Max minutes of basal to limit SMB to</string>
<string name="uamsmbmaxminutes" translatable="false">45 60 75 90 105 120</string>

View file

@ -65,6 +65,19 @@
android:summary="@string/enablesmbaftercarbs_summary"
android:title="@string/enablesmbaftercarbs" />
<com.andreabaccega.widget.ValidatingEditTextPreference
android:defaultValue="3"
android:digits="0123456789"
android:inputType="number"
android:key="key_smbinterval"
android:maxLines="20"
android:selectAllOnFocus="true"
android:singleLine="true"
android:title="@string/smbinterval_summary"
validate:maxNumber="10"
validate:minNumber="1"
validate:testType="numericRange" />
<com.andreabaccega.widget.ValidatingEditTextPreference
android:defaultValue="30"
android:dialogMessage="@string/smbmaxminutes"