diff --git a/lib/determine-basal/determine-basal.js b/lib/determine-basal/determine-basal.js index c579b1c6f..13ba51da8 100644 --- a/lib/determine-basal/determine-basal.js +++ b/lib/determine-basal/determine-basal.js @@ -267,6 +267,9 @@ var determine_basal = function determine_basal(glucose_status, currenttemp, iob_ // disable SMB when a high temptarget is set if (profile.temptargetSet && target_bg > 100) { enableSMB=false; + // enable SMB/UAM if always-on (unless previously disabled for high temptarget) + } else if (profile.enableSMB_always) { + enableSMB=true; // enable SMB/UAM (if enabled in preferences) for DIA hours after bolus } else if (profile.enableSMB_with_bolus && bolusiob > 0.1) { enableSMB=true; @@ -602,6 +605,12 @@ var determine_basal = function determine_basal(glucose_status, currenttemp, iob_ if (enableSMB && minGuardBG < threshold) { console.error("minGuardBG",minGuardBG,"projected below",threshold,"- disabling SMB"); + //rT.reason += "minGuardBG "+minGuardBG+"<"+threshold+": SMB disabled; "; + enableSMB = false; + } + if ( glucose_status.delta > 0.1 * bg ) { + console.error("Delta",glucose_status.delta,"> 10% of BG",bg,"- disabling SMB"); + rT.reason += "Delta "+glucose_status.delta+" > 10% of BG "+bg+": SMB disabled; "; enableSMB = false; } diff --git a/lib/profile/index.js b/lib/profile/index.js index 1c2b06356..0880762b5 100644 --- a/lib/profile/index.js +++ b/lib/profile/index.js @@ -30,6 +30,7 @@ function defaults ( ) { , remainingCarbsCap: 90 // max carbs we'll assume will absorb over 4h if we don't yet see carb absorption // WARNING: the following are advanced oref1 features, and are not yet tested for general use , enableUAM: false // enable detection of unannounced meal carb absorption + , enableSMB_always: false // always enable supermicrobolus (unless disabled by high temptarget) , enableSMB_with_bolus: false // enable supermicrobolus for DIA hours after a manual bolus , enableSMB_with_COB: false // enable supermicrobolus while COB is positive , enableSMB_with_temptarget: false // enable supermicrobolus for eating soon temp targets