Merge branch 'dev' of https://github.com/MilosKozak/AndroidAPS into dev
This commit is contained in:
commit
13933e6bb7
7 changed files with 20 additions and 8 deletions
|
@ -442,6 +442,14 @@ public class Profile {
|
|||
return ret;
|
||||
}
|
||||
|
||||
public double getTarget(){
|
||||
return getTarget(secondsFromMidnight(System.currentTimeMillis()));
|
||||
}
|
||||
|
||||
private double getTarget(Integer time) {
|
||||
return (getTargetLow(time) + getTargetHigh(time))/2;
|
||||
}
|
||||
|
||||
public Double getTargetLow() {
|
||||
return getTargetLow(secondsFromMidnight(System.currentTimeMillis()));
|
||||
}
|
||||
|
|
|
@ -41,6 +41,10 @@ public class TempTarget implements Interval {
|
|||
@DatabaseField
|
||||
public int durationInMinutes;
|
||||
|
||||
public double target() {
|
||||
return (low + high) / 2;
|
||||
}
|
||||
|
||||
public boolean isEqual(TempTarget other) {
|
||||
if (date != other.date) {
|
||||
return false;
|
||||
|
|
|
@ -176,7 +176,7 @@ public class OpenAPSAMAPlugin implements PluginBase, APSInterface {
|
|||
double maxBasal = SP.getDouble("openapsma_max_basal", 1d);
|
||||
double minBg = Profile.toMgdl(profile.getTargetLow(), units);
|
||||
double maxBg = Profile.toMgdl(profile.getTargetHigh(), units);
|
||||
double targetBg = (minBg + maxBg) / 2;
|
||||
double targetBg = Profile.toMgdl(profile.getTarget(), units);
|
||||
|
||||
minBg = Round.roundTo(minBg, 0.1d);
|
||||
maxBg = Round.roundTo(maxBg, 0.1d);
|
||||
|
@ -202,7 +202,7 @@ public class OpenAPSAMAPlugin implements PluginBase, APSInterface {
|
|||
isTempTarget = true;
|
||||
minBg = HardLimits.verifyHardLimits(tempTarget.low, "minBg", HardLimits.VERY_HARD_LIMIT_TEMP_MIN_BG[0], HardLimits.VERY_HARD_LIMIT_TEMP_MIN_BG[1]);
|
||||
maxBg = HardLimits.verifyHardLimits(tempTarget.high, "maxBg", HardLimits.VERY_HARD_LIMIT_TEMP_MAX_BG[0], HardLimits.VERY_HARD_LIMIT_TEMP_MAX_BG[1]);
|
||||
targetBg = HardLimits.verifyHardLimits((tempTarget.low + tempTarget.high) / 2, "targetBg", HardLimits.VERY_HARD_LIMIT_TEMP_TARGET_BG[0], HardLimits.VERY_HARD_LIMIT_TEMP_TARGET_BG[1]);
|
||||
targetBg = HardLimits.verifyHardLimits(tempTarget.target(), "targetBg", HardLimits.VERY_HARD_LIMIT_TEMP_TARGET_BG[0], HardLimits.VERY_HARD_LIMIT_TEMP_TARGET_BG[1]);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -179,7 +179,7 @@ public class OpenAPSMAPlugin implements PluginBase, APSInterface {
|
|||
double maxBasal = SafeParse.stringToDouble(SP.getString("openapsma_max_basal", "1"));
|
||||
double minBg = Profile.toMgdl(profile.getTargetLow(), units);
|
||||
double maxBg = Profile.toMgdl(profile.getTargetHigh(), units);
|
||||
double targetBg = (minBg + maxBg) / 2;
|
||||
double targetBg = Profile.toMgdl(profile.getTarget(), units);
|
||||
|
||||
minBg = Round.roundTo(minBg, 0.1d);
|
||||
maxBg = Round.roundTo(maxBg, 0.1d);
|
||||
|
@ -205,7 +205,7 @@ public class OpenAPSMAPlugin implements PluginBase, APSInterface {
|
|||
if (tempTarget != null) {
|
||||
minBg = verifyHardLimits(tempTarget.low, "minBg", HardLimits.VERY_HARD_LIMIT_TEMP_MIN_BG[0], HardLimits.VERY_HARD_LIMIT_TEMP_MIN_BG[1]);
|
||||
maxBg = verifyHardLimits(tempTarget.high, "maxBg", HardLimits.VERY_HARD_LIMIT_TEMP_MAX_BG[0], HardLimits.VERY_HARD_LIMIT_TEMP_MAX_BG[1]);
|
||||
targetBg = verifyHardLimits((tempTarget.low + tempTarget.high) / 2, "targetBg", HardLimits.VERY_HARD_LIMIT_TEMP_TARGET_BG[0], HardLimits.VERY_HARD_LIMIT_TEMP_TARGET_BG[1]);
|
||||
targetBg = verifyHardLimits(tempTarget.target(), "targetBg", HardLimits.VERY_HARD_LIMIT_TEMP_TARGET_BG[0], HardLimits.VERY_HARD_LIMIT_TEMP_TARGET_BG[1]);
|
||||
}
|
||||
|
||||
maxIob = verifyHardLimits(maxIob, "maxIob", 0, HardLimits.maxIobAMA());
|
||||
|
|
|
@ -181,7 +181,7 @@ public class OpenAPSSMBPlugin implements PluginBase, APSInterface {
|
|||
double maxBasal = SP.getDouble("openapsma_max_basal", 1d);
|
||||
double minBg = Profile.toMgdl(profile.getTargetLow(), units);
|
||||
double maxBg = Profile.toMgdl(profile.getTargetHigh(), units);
|
||||
double targetBg = (minBg + maxBg) / 2;
|
||||
double targetBg = Profile.toMgdl(profile.getTarget(), units);
|
||||
|
||||
minBg = Round.roundTo(minBg, 0.1d);
|
||||
maxBg = Round.roundTo(maxBg, 0.1d);
|
||||
|
@ -207,7 +207,7 @@ public class OpenAPSSMBPlugin implements PluginBase, APSInterface {
|
|||
isTempTarget = true;
|
||||
minBg = verifyHardLimits(tempTarget.low, "minBg", HardLimits.VERY_HARD_LIMIT_TEMP_MIN_BG[0], HardLimits.VERY_HARD_LIMIT_TEMP_MIN_BG[1]);
|
||||
maxBg = verifyHardLimits(tempTarget.high, "maxBg", HardLimits.VERY_HARD_LIMIT_TEMP_MAX_BG[0], HardLimits.VERY_HARD_LIMIT_TEMP_MAX_BG[1]);
|
||||
targetBg = verifyHardLimits((tempTarget.low + tempTarget.high) / 2, "targetBg", HardLimits.VERY_HARD_LIMIT_TEMP_TARGET_BG[0], HardLimits.VERY_HARD_LIMIT_TEMP_TARGET_BG[1]);
|
||||
targetBg = verifyHardLimits(tempTarget.target(), "targetBg", HardLimits.VERY_HARD_LIMIT_TEMP_TARGET_BG[0], HardLimits.VERY_HARD_LIMIT_TEMP_TARGET_BG[1]);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -249,7 +249,7 @@ public class GraphData {
|
|||
if (tt == null) {
|
||||
value = (profile.getTargetLow(time) + profile.getTargetHigh(time)) / 2;
|
||||
} else {
|
||||
value = (tt.low + tt.high) / 2;
|
||||
value = tt.target();
|
||||
}
|
||||
if (lastTarget > 0 && lastTarget != value) {
|
||||
targetsSeriesArray.add(new DataPoint(time, lastTarget));
|
||||
|
|
|
@ -481,7 +481,7 @@ public class ActionStringHandler {
|
|||
|
||||
ret += "DEFAULT RANGE: ";
|
||||
ret += profile.getTargetLow() + " - " + profile.getTargetHigh();
|
||||
ret += " target: " + (profile.getTargetLow() + profile.getTargetHigh()) / 2;
|
||||
ret += " target: " + profile.getTarget();
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue