TT unify target calculation
This commit is contained in:
parent
3b18413eb6
commit
5f614b4072
5 changed files with 8 additions and 4 deletions
|
@ -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;
|
||||
|
|
|
@ -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]);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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));
|
||||
|
|
Loading…
Reference in a new issue