temp targets to AMA
This commit is contained in:
parent
0e21b67a42
commit
f9ed2ed4b4
2 changed files with 18 additions and 2 deletions
|
@ -18,6 +18,7 @@ import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.data.GlucoseStatus;
|
import info.nightscout.androidaps.data.GlucoseStatus;
|
||||||
import info.nightscout.androidaps.data.MealData;
|
import info.nightscout.androidaps.data.MealData;
|
||||||
import info.nightscout.androidaps.db.BgReading;
|
import info.nightscout.androidaps.db.BgReading;
|
||||||
|
import info.nightscout.androidaps.db.TempTarget;
|
||||||
import info.nightscout.androidaps.interfaces.APSInterface;
|
import info.nightscout.androidaps.interfaces.APSInterface;
|
||||||
import info.nightscout.androidaps.interfaces.PluginBase;
|
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||||
|
@ -27,6 +28,7 @@ import info.nightscout.androidaps.plugins.Loop.ScriptReader;
|
||||||
import info.nightscout.androidaps.data.IobTotal;
|
import info.nightscout.androidaps.data.IobTotal;
|
||||||
import info.nightscout.androidaps.plugins.OpenAPSMA.events.EventOpenAPSUpdateGui;
|
import info.nightscout.androidaps.plugins.OpenAPSMA.events.EventOpenAPSUpdateGui;
|
||||||
import info.nightscout.androidaps.plugins.OpenAPSMA.events.EventOpenAPSUpdateResultGui;
|
import info.nightscout.androidaps.plugins.OpenAPSMA.events.EventOpenAPSUpdateResultGui;
|
||||||
|
import info.nightscout.androidaps.plugins.TempTargetRange.TempTargetRangePlugin;
|
||||||
import info.nightscout.client.data.NSProfile;
|
import info.nightscout.client.data.NSProfile;
|
||||||
import info.nightscout.utils.DateUtil;
|
import info.nightscout.utils.DateUtil;
|
||||||
import info.nightscout.utils.Round;
|
import info.nightscout.utils.Round;
|
||||||
|
@ -173,6 +175,20 @@ public class OpenAPSAMAPlugin implements PluginBase, APSInterface {
|
||||||
minBg = verifyHardLimits(minBg, "minBg", 72, 180);
|
minBg = verifyHardLimits(minBg, "minBg", 72, 180);
|
||||||
maxBg = verifyHardLimits(maxBg, "maxBg", 100, 270);
|
maxBg = verifyHardLimits(maxBg, "maxBg", 100, 270);
|
||||||
targetBg = verifyHardLimits(targetBg, "targetBg", 80, 200);
|
targetBg = verifyHardLimits(targetBg, "targetBg", 80, 200);
|
||||||
|
|
||||||
|
boolean isTempTarget = false;
|
||||||
|
TempTargetRangePlugin tempTargetRangePlugin = (TempTargetRangePlugin) MainApp.getSpecificPlugin(TempTargetRangePlugin.class);
|
||||||
|
if (tempTargetRangePlugin != null && tempTargetRangePlugin.isEnabled(PluginBase.GENERAL)) {
|
||||||
|
TempTarget tempTarget = tempTargetRangePlugin.getTempTargetInProgress(new Date().getTime());
|
||||||
|
if (tempTarget != null) {
|
||||||
|
isTempTarget = true;
|
||||||
|
minBg = verifyHardLimits(tempTarget.low, "minBg", 72, 180);
|
||||||
|
maxBg = verifyHardLimits(tempTarget.high, "maxBg", 72, 270);
|
||||||
|
targetBg = verifyHardLimits((tempTarget.low + tempTarget.high) / 2, "targetBg", 72, 200);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
maxIob = verifyHardLimits(maxIob, "maxIob", 0, 7);
|
maxIob = verifyHardLimits(maxIob, "maxIob", 0, 7);
|
||||||
maxBasal = verifyHardLimits(maxBasal, "max_basal", 0.1, 10);
|
maxBasal = verifyHardLimits(maxBasal, "max_basal", 0.1, 10);
|
||||||
|
|
||||||
|
@ -190,7 +206,7 @@ public class OpenAPSAMAPlugin implements PluginBase, APSInterface {
|
||||||
|
|
||||||
determineBasalAdapterAMAJS.setData(profile, maxIob, maxBasal, minBg, maxBg, targetBg, pump, iobArray, glucoseStatus, mealData,
|
determineBasalAdapterAMAJS.setData(profile, maxIob, maxBasal, minBg, maxBg, targetBg, pump, iobArray, glucoseStatus, mealData,
|
||||||
autosensResult.ratio, //autosensDataRatio
|
autosensResult.ratio, //autosensDataRatio
|
||||||
false, // isTempTargetSet TODO: add when we start handling temp targets
|
isTempTarget,
|
||||||
Constants.MIN_5M_CARBIMPACT //min_5m_carbimpact
|
Constants.MIN_5M_CARBIMPACT //min_5m_carbimpact
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -188,7 +188,7 @@ public class OpenAPSMAPlugin implements PluginBase, APSInterface {
|
||||||
if (tempTarget != null) {
|
if (tempTarget != null) {
|
||||||
minBg = verifyHardLimits(tempTarget.low, "minBg", 72, 180);
|
minBg = verifyHardLimits(tempTarget.low, "minBg", 72, 180);
|
||||||
maxBg = verifyHardLimits(tempTarget.high, "maxBg", 72, 270);
|
maxBg = verifyHardLimits(tempTarget.high, "maxBg", 72, 270);
|
||||||
targetBg = verifyHardLimits((tempTarget.low + tempTarget.high) / 2, "targetBg", 80, 200);
|
targetBg = verifyHardLimits((tempTarget.low + tempTarget.high) / 2, "targetBg", 72, 200);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue