Skip to content

Commit

Permalink
require boolean true on enableSMB preferences (#812)
Browse files Browse the repository at this point in the history
  • Loading branch information
scottleibrand authored Nov 22, 2017
1 parent 0b4b561 commit 156bd10
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/determine-basal/determine-basal.js
Original file line number Diff line number Diff line change
Expand Up @@ -343,12 +343,12 @@ var determine_basal = function determine_basal(glucose_status, currenttemp, iob_
var enableSMB=false;
// disable SMB when a high temptarget is set
if (! microBolusAllowed) {
console.error("SMB disabled")
console.error("SMB disabled (!microBolusAllowed)")
} else if (! profile.allowSMB_with_high_temptarget && profile.temptargetSet && target_bg > 100) {
console.error("SMB disabled due to high temptarget of",target_bg);
enableSMB=false;
// enable SMB/UAM (if enabled in preferences) while we have COB
} else if (profile.enableSMB_with_COB && meal_data.mealCOB) {
} else if (profile.enableSMB_with_COB === true && meal_data.mealCOB) {
if (meal_data.bwCarbs) {
if (profile.A52_risk_enable) {
console.error("Warning: SMB enabled with Bolus Wizard carbs: be sure to easy bolus 30s before using Bolus Wizard")
Expand All @@ -362,7 +362,7 @@ var determine_basal = function determine_basal(glucose_status, currenttemp, iob_
}
// enable SMB/UAM (if enabled in preferences) for a full 6 hours after any carb entry
// (6 hours is defined in carbWindow in lib/meal/total.js)
} else if (profile.enableSMB_after_carbs && meal_data.carbs ) {
} else if (profile.enableSMB_after_carbs === true && meal_data.carbs ) {
if (meal_data.bwCarbs) {
if (profile.A52_risk_enable) {
console.error("Warning: SMB enabled with Bolus Wizard carbs: be sure to easy bolus 30s before using Bolus Wizard")
Expand All @@ -375,7 +375,7 @@ var determine_basal = function determine_basal(glucose_status, currenttemp, iob_
enableSMB=true;
}
// enable SMB/UAM (if enabled in preferences) if a low temptarget is set
} else if (profile.enableSMB_with_temptarget && (profile.temptargetSet && target_bg < 100)) {
} else if (profile.enableSMB_with_temptarget === true && (profile.temptargetSet && target_bg < 100)) {
if (meal_data.bwFound) {
if (profile.A52_risk_enable) {
console.error("Warning: SMB enabled within 6h of using Bolus Wizard: be sure to easy bolus 30s before using Bolus Wizard")
Expand All @@ -388,9 +388,9 @@ var determine_basal = function determine_basal(glucose_status, currenttemp, iob_
enableSMB=true;
}
// enable SMB/UAM if always-on (unless previously disabled for high temptarget)
} else if (profile.enableSMB_always) {
} else if (profile.enableSMB_always === true) {
if (meal_data.bwFound) {
if (profile.A52_risk_enable) {
if (profile.A52_risk_enable === true) {
console.error("Warning: SMB enabled within 6h of using Bolus Wizard: be sure to easy bolus 30s before using Bolus Wizard")
enableSMB=true;
} else {
Expand All @@ -401,7 +401,7 @@ var determine_basal = function determine_basal(glucose_status, currenttemp, iob_
enableSMB=true;
}
} else {
console.error("SMB disabled");
console.error("SMB disabled (no enableSMB preferences active)");
}
// enable UAM (if enabled in preferences) if SMB is enabled
var enableUAM=(profile.enableUAM && enableSMB);
Expand Down

0 comments on commit 156bd10

Please sign in to comment.