Allow flat BGs for DexcomPlugin
This commit is contained in:
parent
02b94e9109
commit
3442e29e5c
|
@ -110,7 +110,7 @@ function enable_smb(
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var determine_basal = function determine_basal(glucose_status, currenttemp, iob_data, profile, autosens_data, meal_data, tempBasalFunctions, microBolusAllowed, reservoir_data, currentTime) {
|
var determine_basal = function determine_basal(glucose_status, currenttemp, iob_data, profile, autosens_data, meal_data, tempBasalFunctions, microBolusAllowed, reservoir_data, currentTime, isSaveCgmSource) {
|
||||||
var rT = {}; //short for requestedTemp
|
var rT = {}; //short for requestedTemp
|
||||||
|
|
||||||
var deliverAt = new Date();
|
var deliverAt = new Date();
|
||||||
|
@ -143,7 +143,7 @@ var determine_basal = function determine_basal(glucose_status, currenttemp, iob_
|
||||||
rT.reason = "If current system time "+systemTime+" is correct, then BG data is too old. The last BG data was read "+minAgo+"m ago at "+bgTime;
|
rT.reason = "If current system time "+systemTime+" is correct, then BG data is too old. The last BG data was read "+minAgo+"m ago at "+bgTime;
|
||||||
// if BG is too old/noisy, or is changing less than 1 mg/dL/5m for 45m, cancel any high temps and shorten any long zero temps
|
// if BG is too old/noisy, or is changing less than 1 mg/dL/5m for 45m, cancel any high temps and shorten any long zero temps
|
||||||
//cherry pick from oref upstream dev cb8e94990301277fb1016c778b4e9efa55a6edbc
|
//cherry pick from oref upstream dev cb8e94990301277fb1016c778b4e9efa55a6edbc
|
||||||
} else if ( bg > 60 && glucose_status.delta == 0 && glucose_status.short_avgdelta > -1 && glucose_status.short_avgdelta < 1 && glucose_status.long_avgdelta > -1 && glucose_status.long_avgdelta < 1 ) {
|
} else if ( bg > 60 && glucose_status.delta == 0 && glucose_status.short_avgdelta > -1 && glucose_status.short_avgdelta < 1 && glucose_status.long_avgdelta > -1 && glucose_status.long_avgdelta < 1 && !isSaveCgmSource) {
|
||||||
if ( glucose_status.last_cal && glucose_status.last_cal < 3 ) {
|
if ( glucose_status.last_cal && glucose_status.last_cal < 3 ) {
|
||||||
rT.reason = "CGM was just calibrated";
|
rT.reason = "CGM was just calibrated";
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -65,6 +65,7 @@ public class DetermineBasalAdapterSMBJS {
|
||||||
private boolean mMicrobolusAllowed;
|
private boolean mMicrobolusAllowed;
|
||||||
private boolean mSMBAlwaysAllowed;
|
private boolean mSMBAlwaysAllowed;
|
||||||
private long mCurrentTime;
|
private long mCurrentTime;
|
||||||
|
private boolean mIsSaveCgmSource;
|
||||||
|
|
||||||
private String storedCurrentTemp = null;
|
private String storedCurrentTemp = null;
|
||||||
private String storedIobData = null;
|
private String storedIobData = null;
|
||||||
|
@ -108,6 +109,7 @@ public class DetermineBasalAdapterSMBJS {
|
||||||
aapsLogger.debug(LTag.APS, "MicroBolusAllowed: " + (storedMicroBolusAllowed = "" + mMicrobolusAllowed));
|
aapsLogger.debug(LTag.APS, "MicroBolusAllowed: " + (storedMicroBolusAllowed = "" + mMicrobolusAllowed));
|
||||||
aapsLogger.debug(LTag.APS, "SMBAlwaysAllowed: " + (storedSMBAlwaysAllowed = "" + mSMBAlwaysAllowed));
|
aapsLogger.debug(LTag.APS, "SMBAlwaysAllowed: " + (storedSMBAlwaysAllowed = "" + mSMBAlwaysAllowed));
|
||||||
aapsLogger.debug(LTag.APS, "CurrentTime: " + (storedCurrentTime = "" + mCurrentTime));
|
aapsLogger.debug(LTag.APS, "CurrentTime: " + (storedCurrentTime = "" + mCurrentTime));
|
||||||
|
aapsLogger.debug(LTag.APS, "isSaveCgmSource: " + mIsSaveCgmSource);
|
||||||
|
|
||||||
|
|
||||||
DetermineBasalResultSMB determineBasalResultSMB = null;
|
DetermineBasalResultSMB determineBasalResultSMB = null;
|
||||||
|
@ -237,7 +239,8 @@ public class DetermineBasalAdapterSMBJS {
|
||||||
boolean tempTargetSet,
|
boolean tempTargetSet,
|
||||||
boolean microBolusAllowed,
|
boolean microBolusAllowed,
|
||||||
boolean uamAllowed,
|
boolean uamAllowed,
|
||||||
boolean advancedFiltering
|
boolean advancedFiltering,
|
||||||
|
boolean isSaveCgmSource
|
||||||
) throws JSONException {
|
) throws JSONException {
|
||||||
|
|
||||||
String units = profile.getUnits();
|
String units = profile.getUnits();
|
||||||
|
@ -354,6 +357,7 @@ public class DetermineBasalAdapterSMBJS {
|
||||||
|
|
||||||
mCurrentTime = now;
|
mCurrentTime = now;
|
||||||
|
|
||||||
|
mIsSaveCgmSource = isSaveCgmSource;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Object makeParam(JSONObject jsonObject, Context rhino, Scriptable scope) {
|
private Object makeParam(JSONObject jsonObject, Context rhino, Scriptable scope) {
|
||||||
|
|
|
@ -270,7 +270,8 @@ public class OpenAPSSMBPlugin extends PluginBase implements APSInterface, Constr
|
||||||
isTempTarget,
|
isTempTarget,
|
||||||
smbAllowed.value(),
|
smbAllowed.value(),
|
||||||
uam.value(),
|
uam.value(),
|
||||||
advancedFiltering.value()
|
advancedFiltering.value(),
|
||||||
|
activePlugin.getActiveBgSource().getClass().getSimpleName().equals("DexcomPlugin")
|
||||||
);
|
);
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
fabricPrivacy.logException(e);
|
fabricPrivacy.logException(e);
|
||||||
|
|
Loading…
Reference in a new issue