From ff2f6a8bfb352775c076113c3b7c88c825ca1ea3 Mon Sep 17 00:00:00 2001 From: Tim Gunn Date: Thu, 25 Oct 2018 16:33:29 +1300 Subject: [PATCH 01/10] Add UAMSMB Basal Minutes with Min Bolus Increment --- .../main/assets/OpenAPSSMB/determine-basal.js | 18 ++++++++++++------ .../OpenAPSSMB/DetermineBasalAdapterSMBJS.java | 3 +++ .../plugins/OpenAPSSMB/SMBDefaults.java | 2 ++ app/src/main/res/values/strings.xml | 2 ++ app/src/main/res/xml/pref_openapssmb.xml | 16 +++++++++++++++- 5 files changed, 34 insertions(+), 7 deletions(-) diff --git a/app/src/main/assets/OpenAPSSMB/determine-basal.js b/app/src/main/assets/OpenAPSSMB/determine-basal.js index c2db0f270b..bb620bf5c9 100644 --- a/app/src/main/assets/OpenAPSSMB/determine-basal.js +++ b/app/src/main/assets/OpenAPSSMB/determine-basal.js @@ -995,8 +995,7 @@ var determine_basal = function determine_basal(glucose_status, currenttemp, iob_ // eventual BG is at/above target // if iob is over max, just cancel any temps - // if we're not here because of SMB, eventual BG is at/above target - if (! (microBolusAllowed && rT.COB)) { + if ( eventualBG >= max_bg ) { rT.reason += "Eventual BG " + convert_bg(eventualBG, profile) + " >= " + convert_bg(max_bg, profile) + ", "; } if (iob_data.iob > max_iob) { @@ -1047,20 +1046,27 @@ var determine_basal = function determine_basal(glucose_status, currenttemp, iob_ // if IOB covers more than COB, limit maxBolus to 30m of basal } else if ( iob_data.iob > mealInsulinReq && iob_data.iob > 0 ) { console.error("IOB",iob_data.iob,"> COB",meal_data.mealCOB+"; mealInsulinReq =",mealInsulinReq); - maxBolus = round( profile.current_basal * 30 / 60 ,1); + if (profile.maxUAMSMBBasalMinutes) { + console.error("profile.maxUAMSMBBasalMinutes:",profile.maxUAMSMBBasalMinutes,"profile.current_basal:",profile.current_basal); + maxBolus = round( profile.current_basal * profile.maxUAMSMBBasalMinutes / 60 ,1); + } else { + console.error("profile.maxUAMSMBBasalMinutes undefined: defaulting to 30m"); + maxBolus = round( profile.current_basal * 30 / 60 ,1); + } } else { console.error("profile.maxSMBBasalMinutes:",profile.maxSMBBasalMinutes,"profile.current_basal:",profile.current_basal); maxBolus = round( profile.current_basal * profile.maxSMBBasalMinutes / 60 ,1); } - // bolus 1/2 the insulinReq, up to maxBolus, rounding down to nearest 0.1U - microBolus = Math.floor(Math.min(insulinReq/2,maxBolus)*10)/10; + // bolus 1/2 the insulinReq, up to maxBolus, rounding down to nearest bolus increment + var roundSMBTo = 1 / profile.bolus_increment; + microBolus = Math.floor(Math.min(insulinReq/2,maxBolus)*roundSMBTo)/roundSMBTo; // calculate a long enough zero temp to eventually correct back up to target var smbTarget = target_bg; var worstCaseInsulinReq = (smbTarget - (naive_eventualBG + minIOBPredBG)/2 ) / sens; var durationReq = round(60*worstCaseInsulinReq / profile.current_basal); // if insulinReq > 0 but not enough for a microBolus, don't set an SMB zero temp - if (insulinReq > 0 && microBolus < 0.1) { + if (insulinReq > 0 && microBolus < profile.bolus_increment) { durationReq = 0; } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSSMB/DetermineBasalAdapterSMBJS.java b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSSMB/DetermineBasalAdapterSMBJS.java index 7ede714c10..b284d258b0 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSSMB/DetermineBasalAdapterSMBJS.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSSMB/DetermineBasalAdapterSMBJS.java @@ -44,6 +44,7 @@ public class DetermineBasalAdapterSMBJS { private JSONObject mMealData; private JSONObject mCurrentTemp; private JSONObject mAutosensData = null; + private long mCurrentTime; private boolean mMicrobolusAllowed; private boolean mSMBAlwaysAllowed; @@ -255,6 +256,8 @@ public class DetermineBasalAdapterSMBJS { mProfile.put("enableSMB_always", SP.getBoolean(R.string.key_enableSMB_always, false) && advancedFiltering); mProfile.put("enableSMB_after_carbs", SP.getBoolean(R.string.key_enableSMB_after_carbs, false) && advancedFiltering); mProfile.put("maxSMBBasalMinutes", SP.getInt("key_smbmaxminutes", SMBDefaults.maxSMBBasalMinutes)); + mProfile.put("maxUAMSMBBasalMinutes", SP.getInt("key_uamsmbmaxminutes", SMBDefaults.maxUAMSMBBasalMinutes)); + mProfile.put("bolus_increment", SMBDefaults.bolus_increment); mProfile.put("carbsReqThreshold", SMBDefaults.carbsReqThreshold); mProfile.put("current_basal", basalrate); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSSMB/SMBDefaults.java b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSSMB/SMBDefaults.java index 0ce8d2bb94..234aa4e12a 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSSMB/SMBDefaults.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSSMB/SMBDefaults.java @@ -56,9 +56,11 @@ public class SMBDefaults { //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 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) // useCustomPeakTime:false // allows changing insulinPeakTime // insulinPeakTime:75 // number of minutes after a bolus activity peaks. defaults to 55m for Fiasp if useCustomPeakTime: false public final static int carbsReqThreshold = 1; // grams of carbsReq to trigger a pushover // offline_hotspot:false // enabled an offline-only local wifi hotspot if no Internet available + public final static double bolus_increment = 0.1; // minimum bolus that can be delivered as an SMB } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index ae4e572392..46c583c847 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -802,6 +802,8 @@ Show delta with one more decimal place 45 60 75 90 105 120 Max minutes of basal to limit SMB to + 45 60 75 90 105 120 + Max minutes of basal to limit SMB to when UAM is active Unsupported pump firmware Send BG data to xDrip+ dexcomg5_xdripupload diff --git a/app/src/main/res/xml/pref_openapssmb.xml b/app/src/main/res/xml/pref_openapssmb.xml index e23a364cb8..53e1deef17 100644 --- a/app/src/main/res/xml/pref_openapssmb.xml +++ b/app/src/main/res/xml/pref_openapssmb.xml @@ -79,6 +79,20 @@ validate:minNumber="15" validate:testType="numericRange" /> + + - \ No newline at end of file + From 4bc8025ad4f85391ce7e2453d4ee59fe6a144475 Mon Sep 17 00:00:00 2001 From: Tim Gunn Date: Thu, 25 Oct 2018 18:27:21 +1300 Subject: [PATCH 02/10] Make min SMB Bolus configurable --- .../OpenAPSSMB/DetermineBasalAdapterSMBJS.java | 2 +- app/src/main/res/values/strings.xml | 3 ++- app/src/main/res/xml/pref_openapssmb.xml | 14 ++++++++++++++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSSMB/DetermineBasalAdapterSMBJS.java b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSSMB/DetermineBasalAdapterSMBJS.java index b284d258b0..a05b5aae45 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSSMB/DetermineBasalAdapterSMBJS.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSSMB/DetermineBasalAdapterSMBJS.java @@ -257,7 +257,7 @@ public class DetermineBasalAdapterSMBJS { mProfile.put("enableSMB_after_carbs", SP.getBoolean(R.string.key_enableSMB_after_carbs, false) && advancedFiltering); mProfile.put("maxSMBBasalMinutes", SP.getInt("key_smbmaxminutes", SMBDefaults.maxSMBBasalMinutes)); mProfile.put("maxUAMSMBBasalMinutes", SP.getInt("key_uamsmbmaxminutes", SMBDefaults.maxUAMSMBBasalMinutes)); - mProfile.put("bolus_increment", SMBDefaults.bolus_increment); + mProfile.put("bolus_increment", SP.getDouble("key_bolus_increment", SMBDefaults.bolus_increment)); mProfile.put("carbsReqThreshold", SMBDefaults.carbsReqThreshold); mProfile.put("current_basal", basalrate); diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 46c583c847..f675c3b613 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -803,7 +803,8 @@ 45 60 75 90 105 120 Max minutes of basal to limit SMB to 45 60 75 90 105 120 - Max minutes of basal to limit SMB to when UAM is active + Max minutes of basal to limit SMB to for UAM + Minimum bolus that can be delivered as an SMB Unsupported pump firmware Send BG data to xDrip+ dexcomg5_xdripupload diff --git a/app/src/main/res/xml/pref_openapssmb.xml b/app/src/main/res/xml/pref_openapssmb.xml index 53e1deef17..cc09aa707d 100644 --- a/app/src/main/res/xml/pref_openapssmb.xml +++ b/app/src/main/res/xml/pref_openapssmb.xml @@ -93,6 +93,20 @@ validate:minNumber="15" validate:testType="numericRange" /> + + + Date: Thu, 25 Oct 2018 18:47:50 +1300 Subject: [PATCH 03/10] use number as numberDecimal does not apply restrictions --- app/src/main/res/xml/pref_openapssmb.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/xml/pref_openapssmb.xml b/app/src/main/res/xml/pref_openapssmb.xml index cc09aa707d..87bb5bb5ce 100644 --- a/app/src/main/res/xml/pref_openapssmb.xml +++ b/app/src/main/res/xml/pref_openapssmb.xml @@ -96,7 +96,7 @@ Date: Thu, 25 Oct 2018 20:02:02 +1300 Subject: [PATCH 04/10] get SMB bolus limits working --- .../plugins/OpenAPSSMB/DetermineBasalAdapterSMBJS.java | 2 +- app/src/main/res/values/strings.xml | 1 + app/src/main/res/xml/pref_openapssmb.xml | 9 ++++----- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSSMB/DetermineBasalAdapterSMBJS.java b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSSMB/DetermineBasalAdapterSMBJS.java index a05b5aae45..311aa12bd2 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSSMB/DetermineBasalAdapterSMBJS.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSSMB/DetermineBasalAdapterSMBJS.java @@ -257,7 +257,7 @@ public class DetermineBasalAdapterSMBJS { mProfile.put("enableSMB_after_carbs", SP.getBoolean(R.string.key_enableSMB_after_carbs, false) && advancedFiltering); mProfile.put("maxSMBBasalMinutes", SP.getInt("key_smbmaxminutes", SMBDefaults.maxSMBBasalMinutes)); mProfile.put("maxUAMSMBBasalMinutes", SP.getInt("key_uamsmbmaxminutes", SMBDefaults.maxUAMSMBBasalMinutes)); - mProfile.put("bolus_increment", SP.getDouble("key_bolus_increment", SMBDefaults.bolus_increment)); + mProfile.put("bolus_increment", SP.getDouble("bolus_increment", SMBDefaults.bolus_increment)); mProfile.put("carbsReqThreshold", SMBDefaults.carbsReqThreshold); mProfile.put("current_basal", basalrate); diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index f675c3b613..11960880b5 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -804,6 +804,7 @@ Max minutes of basal to limit SMB to 45 60 75 90 105 120 Max minutes of basal to limit SMB to for UAM + 0.1 Minimum bolus that can be delivered as an SMB Unsupported pump firmware Send BG data to xDrip+ diff --git a/app/src/main/res/xml/pref_openapssmb.xml b/app/src/main/res/xml/pref_openapssmb.xml index 87bb5bb5ce..d74c9ef9aa 100644 --- a/app/src/main/res/xml/pref_openapssmb.xml +++ b/app/src/main/res/xml/pref_openapssmb.xml @@ -95,15 +95,14 @@ From 4592f290db4097e017ca34ebe1c4b157ae7c88d0 Mon Sep 17 00:00:00 2001 From: Tim Gunn Date: Thu, 25 Oct 2018 20:13:19 +1300 Subject: [PATCH 05/10] remove stuff thats not needed --- .../plugins/OpenAPSSMB/DetermineBasalAdapterSMBJS.java | 1 - 1 file changed, 1 deletion(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSSMB/DetermineBasalAdapterSMBJS.java b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSSMB/DetermineBasalAdapterSMBJS.java index 311aa12bd2..7e17c387a0 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSSMB/DetermineBasalAdapterSMBJS.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSSMB/DetermineBasalAdapterSMBJS.java @@ -44,7 +44,6 @@ public class DetermineBasalAdapterSMBJS { private JSONObject mMealData; private JSONObject mCurrentTemp; private JSONObject mAutosensData = null; - private long mCurrentTime; private boolean mMicrobolusAllowed; private boolean mSMBAlwaysAllowed; From 84716eb7775f8cb4c1979ea9b3f5ffd7c1bb47ac Mon Sep 17 00:00:00 2001 From: Tim Gunn Date: Fri, 26 Oct 2018 18:49:18 +1300 Subject: [PATCH 06/10] change to using key convention --- .../plugins/OpenAPSSMB/DetermineBasalAdapterSMBJS.java | 2 +- app/src/main/res/values/strings.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSSMB/DetermineBasalAdapterSMBJS.java b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSSMB/DetermineBasalAdapterSMBJS.java index 7e17c387a0..ffa1954bad 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSSMB/DetermineBasalAdapterSMBJS.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSSMB/DetermineBasalAdapterSMBJS.java @@ -256,7 +256,7 @@ public class DetermineBasalAdapterSMBJS { mProfile.put("enableSMB_after_carbs", SP.getBoolean(R.string.key_enableSMB_after_carbs, false) && advancedFiltering); mProfile.put("maxSMBBasalMinutes", SP.getInt("key_smbmaxminutes", SMBDefaults.maxSMBBasalMinutes)); mProfile.put("maxUAMSMBBasalMinutes", SP.getInt("key_uamsmbmaxminutes", SMBDefaults.maxUAMSMBBasalMinutes)); - mProfile.put("bolus_increment", SP.getDouble("bolus_increment", SMBDefaults.bolus_increment)); + mProfile.put("bolus_increment", SP.getDouble("key_bolus_increment", SMBDefaults.bolus_increment)); mProfile.put("carbsReqThreshold", SMBDefaults.carbsReqThreshold); mProfile.put("current_basal", basalrate); diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 11960880b5..e640191b23 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -804,7 +804,7 @@ Max minutes of basal to limit SMB to 45 60 75 90 105 120 Max minutes of basal to limit SMB to for UAM - 0.1 + bolus_increment Minimum bolus that can be delivered as an SMB Unsupported pump firmware Send BG data to xDrip+ From 7c4c42669087a858c64503ba0631fe6e2d41bfa9 Mon Sep 17 00:00:00 2001 From: Tim Gunn Date: Fri, 26 Oct 2018 18:50:01 +1300 Subject: [PATCH 07/10] remove string --- app/src/main/res/xml/pref_openapssmb.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/xml/pref_openapssmb.xml b/app/src/main/res/xml/pref_openapssmb.xml index d74c9ef9aa..f26a58ffd0 100644 --- a/app/src/main/res/xml/pref_openapssmb.xml +++ b/app/src/main/res/xml/pref_openapssmb.xml @@ -96,7 +96,7 @@ Date: Sat, 27 Oct 2018 12:33:32 +1300 Subject: [PATCH 08/10] Find Bolus incrument on pump, make sure the pump can support the minSMB bolus setting --- .../plugins/OpenAPSSMB/DetermineBasalAdapterSMBJS.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSSMB/DetermineBasalAdapterSMBJS.java b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSSMB/DetermineBasalAdapterSMBJS.java index ffa1954bad..e307156223 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSSMB/DetermineBasalAdapterSMBJS.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSSMB/DetermineBasalAdapterSMBJS.java @@ -25,6 +25,7 @@ import info.nightscout.androidaps.data.IobTotal; import info.nightscout.androidaps.data.MealData; import info.nightscout.androidaps.data.Profile; import info.nightscout.androidaps.db.TemporaryBasal; +import info.nightscout.androidaps.interfaces.PumpInterface; import info.nightscout.androidaps.logging.L; import info.nightscout.androidaps.plugins.IobCobCalculator.IobCobCalculatorPlugin; import info.nightscout.androidaps.plugins.Loop.ScriptReader; @@ -215,7 +216,8 @@ public class DetermineBasalAdapterSMBJS { ) throws JSONException { String units = profile.getUnits(); - + Double bolusincrument = SP.getDouble("key_bolus_increment", SMBDefaults.bolus_increment); + Double pumpbolusstep = MainApp.getConfigBuilder().getActivePump().getPumpDescription().bolusStep; mProfile = new JSONObject(); mProfile.put("max_iob", maxIob); @@ -256,7 +258,11 @@ public class DetermineBasalAdapterSMBJS { mProfile.put("enableSMB_after_carbs", SP.getBoolean(R.string.key_enableSMB_after_carbs, false) && advancedFiltering); mProfile.put("maxSMBBasalMinutes", SP.getInt("key_smbmaxminutes", SMBDefaults.maxSMBBasalMinutes)); mProfile.put("maxUAMSMBBasalMinutes", SP.getInt("key_uamsmbmaxminutes", SMBDefaults.maxUAMSMBBasalMinutes)); - mProfile.put("bolus_increment", SP.getDouble("key_bolus_increment", SMBDefaults.bolus_increment)); + if (bolusincrument < 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 + bolusincrument = pumpbolusstep; + } + mProfile.put("bolus_increment", bolusincrument); mProfile.put("carbsReqThreshold", SMBDefaults.carbsReqThreshold); mProfile.put("current_basal", basalrate); From f24318c105812b54f213759dbae9e9a59db8b877 Mon Sep 17 00:00:00 2001 From: Tim Gunn Date: Thu, 1 Nov 2018 20:05:14 +1300 Subject: [PATCH 09/10] use diff plugin --- .../plugins/OpenAPSSMB/DetermineBasalAdapterSMBJS.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSSMB/DetermineBasalAdapterSMBJS.java b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSSMB/DetermineBasalAdapterSMBJS.java index e307156223..e8c7bc62cc 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSSMB/DetermineBasalAdapterSMBJS.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSSMB/DetermineBasalAdapterSMBJS.java @@ -27,6 +27,7 @@ import info.nightscout.androidaps.data.Profile; import info.nightscout.androidaps.db.TemporaryBasal; import info.nightscout.androidaps.interfaces.PumpInterface; import info.nightscout.androidaps.logging.L; +import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin; import info.nightscout.androidaps.plugins.IobCobCalculator.IobCobCalculatorPlugin; import info.nightscout.androidaps.plugins.Loop.ScriptReader; import info.nightscout.androidaps.plugins.OpenAPSMA.LoggerCallback; @@ -217,7 +218,7 @@ public class DetermineBasalAdapterSMBJS { String units = profile.getUnits(); Double bolusincrument = SP.getDouble("key_bolus_increment", SMBDefaults.bolus_increment); - Double pumpbolusstep = MainApp.getConfigBuilder().getActivePump().getPumpDescription().bolusStep; + Double pumpbolusstep = ConfigBuilderPlugin.getPlugin().getActivePump().getPumpDescription().bolusStep; mProfile = new JSONObject(); mProfile.put("max_iob", maxIob); From 0f3d9327475f4d1519daf8856d3e47a6ad9ac1df Mon Sep 17 00:00:00 2001 From: Tim Gunn Date: Thu, 1 Nov 2018 20:16:01 +1300 Subject: [PATCH 10/10] correct var spelling --- .../plugins/OpenAPSSMB/DetermineBasalAdapterSMBJS.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSSMB/DetermineBasalAdapterSMBJS.java b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSSMB/DetermineBasalAdapterSMBJS.java index e8c7bc62cc..477a8dba71 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSSMB/DetermineBasalAdapterSMBJS.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSSMB/DetermineBasalAdapterSMBJS.java @@ -217,7 +217,7 @@ public class DetermineBasalAdapterSMBJS { ) throws JSONException { String units = profile.getUnits(); - Double bolusincrument = SP.getDouble("key_bolus_increment", SMBDefaults.bolus_increment); + Double bolusincrement = SP.getDouble("key_bolus_increment", SMBDefaults.bolus_increment); Double pumpbolusstep = ConfigBuilderPlugin.getPlugin().getActivePump().getPumpDescription().bolusStep; mProfile = new JSONObject(); @@ -259,11 +259,11 @@ public class DetermineBasalAdapterSMBJS { mProfile.put("enableSMB_after_carbs", SP.getBoolean(R.string.key_enableSMB_after_carbs, false) && advancedFiltering); mProfile.put("maxSMBBasalMinutes", SP.getInt("key_smbmaxminutes", SMBDefaults.maxSMBBasalMinutes)); mProfile.put("maxUAMSMBBasalMinutes", SP.getInt("key_uamsmbmaxminutes", SMBDefaults.maxUAMSMBBasalMinutes)); - if (bolusincrument < pumpbolusstep){ + 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 - bolusincrument = pumpbolusstep; + bolusincrement = pumpbolusstep; } - mProfile.put("bolus_increment", bolusincrument); + mProfile.put("bolus_increment", bolusincrement); mProfile.put("carbsReqThreshold", SMBDefaults.carbsReqThreshold); mProfile.put("current_basal", basalrate);