Rename TBR to 'temp basal'
This commit is contained in:
parent
6fa1badcdb
commit
449dbd79f7
9 changed files with 29 additions and 29 deletions
|
@ -381,7 +381,7 @@ public class ConfigBuilderPlugin implements PluginBase, ConstraintsInterface, Tr
|
|||
if (Config.logCongigBuilderActions)
|
||||
log.debug("applyAPSRequest: " + request.toString());
|
||||
|
||||
if (request.tbrRequested) {
|
||||
if (request.tempBasalReqested) {
|
||||
if ((request.rate == 0 && request.duration == 0) || Math.abs(request.rate - pump.getBaseBasalRate()) < pump.getPumpDescription().basalStep) {
|
||||
if (isTempBasalInProgress()) {
|
||||
if (Config.logCongigBuilderActions)
|
||||
|
|
|
@ -31,7 +31,7 @@ public class APSResult {
|
|||
public String reason;
|
||||
public double rate;
|
||||
public int duration;
|
||||
public boolean tbrRequested = false;
|
||||
public boolean tempBasalReqested = false;
|
||||
public boolean bolusRequested = false;
|
||||
public IobTotal iob;
|
||||
public JSONObject json = new JSONObject();
|
||||
|
@ -48,7 +48,7 @@ public class APSResult {
|
|||
if (rate == 0 && duration == 0)
|
||||
ret = MainApp.sResources.getString(R.string.canceltemp) + "\n";
|
||||
else if (rate == -1)
|
||||
ret = MainApp.sResources.getString(R.string.let_tbr_run) + "\n";
|
||||
ret = MainApp.sResources.getString(R.string.let_temp_basal_run) + "\n";
|
||||
else
|
||||
ret = MainApp.sResources.getString(R.string.rate) + ": " + DecimalFormatter.to2Decimal(rate) + " U/h " +
|
||||
"(" + DecimalFormatter.to2Decimal(rate / pump.getBaseBasalRate() * 100) + "%) \n" +
|
||||
|
@ -73,7 +73,7 @@ public class APSResult {
|
|||
if (rate == 0 && duration == 0)
|
||||
ret = MainApp.sResources.getString(R.string.canceltemp) + "<br>";
|
||||
else if (rate == -1)
|
||||
ret = MainApp.sResources.getString(R.string.let_tbr_run) + "<br>";
|
||||
ret = MainApp.sResources.getString(R.string.let_temp_basal_run) + "<br>";
|
||||
else
|
||||
ret = "<b>" + MainApp.sResources.getString(R.string.rate) + "</b>: " + DecimalFormatter.to2Decimal(rate) + " U/h " +
|
||||
"(" + DecimalFormatter.to2Decimal(rate / pump.getBaseBasalRate() * 100) + "%) <br>" +
|
||||
|
@ -98,7 +98,7 @@ public class APSResult {
|
|||
newResult.reason = reason;
|
||||
newResult.rate = rate;
|
||||
newResult.duration = duration;
|
||||
newResult.tbrRequested = tbrRequested;
|
||||
newResult.tempBasalReqested = tempBasalReqested;
|
||||
newResult.bolusRequested = bolusRequested;
|
||||
newResult.iob = iob;
|
||||
return newResult;
|
||||
|
@ -216,6 +216,6 @@ public class APSResult {
|
|||
}
|
||||
|
||||
public boolean isChangeRequested() {
|
||||
return tbrRequested || bolusRequested;
|
||||
return tempBasalReqested || bolusRequested;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ public class DetermineBasalResultAMA extends APSResult {
|
|||
json = j;
|
||||
if (result.containsKey("error")) {
|
||||
reason = result.get("error").toString();
|
||||
tbrRequested = false;
|
||||
tempBasalReqested = false;
|
||||
rate = -1;
|
||||
duration = -1;
|
||||
} else {
|
||||
|
@ -32,17 +32,17 @@ public class DetermineBasalResultAMA extends APSResult {
|
|||
if (result.containsKey("rate")) {
|
||||
rate = (Double) result.get("rate");
|
||||
if (rate < 0d) rate = 0d;
|
||||
tbrRequested = true;
|
||||
tempBasalReqested = true;
|
||||
} else {
|
||||
rate = -1;
|
||||
tbrRequested = false;
|
||||
tempBasalReqested = false;
|
||||
}
|
||||
if (result.containsKey("duration")) {
|
||||
duration = ((Double) result.get("duration")).intValue();
|
||||
//changeRequested as above
|
||||
} else {
|
||||
duration = -1;
|
||||
tbrRequested = false;
|
||||
tempBasalReqested = false;
|
||||
}
|
||||
}
|
||||
bolusRequested = false;
|
||||
|
@ -58,7 +58,7 @@ public class DetermineBasalResultAMA extends APSResult {
|
|||
newResult.reason = reason;
|
||||
newResult.rate = rate;
|
||||
newResult.duration = duration;
|
||||
newResult.tbrRequested = tbrRequested;
|
||||
newResult.tempBasalReqested = tempBasalReqested;
|
||||
newResult.rate = rate;
|
||||
newResult.duration = duration;
|
||||
|
||||
|
|
|
@ -243,15 +243,15 @@ public class OpenAPSAMAPlugin implements PluginBase, APSInterface {
|
|||
Profiler.log(log, "AMA calculation", start);
|
||||
// Fix bug determine basal
|
||||
if (determineBasalResultAMA.rate == 0d && determineBasalResultAMA.duration == 0 && !MainApp.getConfigBuilder().isTempBasalInProgress())
|
||||
determineBasalResultAMA.tbrRequested = false;
|
||||
determineBasalResultAMA.tempBasalReqested = false;
|
||||
// limit requests on openloop mode
|
||||
if (!MainApp.getConfigBuilder().isClosedModeEnabled()) {
|
||||
if (MainApp.getConfigBuilder().isTempBasalInProgress() && determineBasalResultAMA.rate == 0 && determineBasalResultAMA.duration == 0) {
|
||||
// going to cancel
|
||||
} else if (MainApp.getConfigBuilder().isTempBasalInProgress() && Math.abs(determineBasalResultAMA.rate - MainApp.getConfigBuilder().getTempBasalAbsoluteRateHistory()) < 0.1) {
|
||||
determineBasalResultAMA.tbrRequested = false;
|
||||
determineBasalResultAMA.tempBasalReqested = false;
|
||||
} else if (!MainApp.getConfigBuilder().isTempBasalInProgress() && Math.abs(determineBasalResultAMA.rate - ConfigBuilderPlugin.getActivePump().getBaseBasalRate()) < 0.1)
|
||||
determineBasalResultAMA.tbrRequested = false;
|
||||
determineBasalResultAMA.tempBasalReqested = false;
|
||||
}
|
||||
|
||||
determineBasalResultAMA.iob = iobArray[0];
|
||||
|
|
|
@ -20,7 +20,7 @@ public class DetermineBasalResultMA extends APSResult {
|
|||
json = j;
|
||||
if (result.containsKey("error")) {
|
||||
reason = (String) result.get("error");
|
||||
tbrRequested = false;
|
||||
tempBasalReqested = false;
|
||||
rate = -1;
|
||||
duration = -1;
|
||||
mealAssist = "";
|
||||
|
@ -31,17 +31,17 @@ public class DetermineBasalResultMA extends APSResult {
|
|||
if (result.containsKey("rate")) {
|
||||
rate = (Double) result.get("rate");
|
||||
if (rate < 0d) rate = 0d;
|
||||
tbrRequested = true;
|
||||
tempBasalReqested = true;
|
||||
} else {
|
||||
rate = -1;
|
||||
tbrRequested = false;
|
||||
tempBasalReqested = false;
|
||||
}
|
||||
if (result.containsKey("duration")) {
|
||||
duration = ((Double) result.get("duration")).intValue();
|
||||
//changeRequested as above
|
||||
} else {
|
||||
duration = -1;
|
||||
tbrRequested = false;
|
||||
tempBasalReqested = false;
|
||||
}
|
||||
if (result.containsKey("mealAssist")) {
|
||||
mealAssist = result.get("mealAssist").toString();
|
||||
|
@ -58,10 +58,10 @@ public class DetermineBasalResultMA extends APSResult {
|
|||
newResult.reason = new String(reason);
|
||||
newResult.rate = rate;
|
||||
newResult.duration = duration;
|
||||
newResult.tbrRequested = isChangeRequested();
|
||||
newResult.tempBasalReqested = isChangeRequested();
|
||||
newResult.rate = rate;
|
||||
newResult.duration = duration;
|
||||
newResult.tbrRequested = isChangeRequested();
|
||||
newResult.tempBasalReqested = isChangeRequested();
|
||||
|
||||
try {
|
||||
newResult.json = new JSONObject(json.toString());
|
||||
|
|
|
@ -229,15 +229,15 @@ public class OpenAPSMAPlugin implements PluginBase, APSInterface {
|
|||
DetermineBasalResultMA determineBasalResultMA = determineBasalAdapterMAJS.invoke();
|
||||
// Fix bug determinef basal
|
||||
if (determineBasalResultMA.rate == 0d && determineBasalResultMA.duration == 0 && !MainApp.getConfigBuilder().isTempBasalInProgress())
|
||||
determineBasalResultMA.tbrRequested = false;
|
||||
determineBasalResultMA.tempBasalReqested = false;
|
||||
// limit requests on openloop mode
|
||||
if (!MainApp.getConfigBuilder().isClosedModeEnabled()) {
|
||||
if (MainApp.getConfigBuilder().isTempBasalInProgress() && determineBasalResultMA.rate == 0 && determineBasalResultMA.duration == 0) {
|
||||
// going to cancel
|
||||
} else if (MainApp.getConfigBuilder().isTempBasalInProgress() && Math.abs(determineBasalResultMA.rate - MainApp.getConfigBuilder().getTempBasalAbsoluteRateHistory()) < 0.1) {
|
||||
determineBasalResultMA.tbrRequested = false;
|
||||
determineBasalResultMA.tempBasalReqested = false;
|
||||
} else if (!MainApp.getConfigBuilder().isTempBasalInProgress() && Math.abs(determineBasalResultMA.rate - ConfigBuilderPlugin.getActivePump().getBaseBasalRate()) < 0.1)
|
||||
determineBasalResultMA.tbrRequested = false;
|
||||
determineBasalResultMA.tempBasalReqested = false;
|
||||
}
|
||||
|
||||
determineBasalResultMA.iob = iobTotal;
|
||||
|
|
|
@ -35,7 +35,7 @@ public class DetermineBasalResultSMB extends APSResult {
|
|||
if (result.has("carbsReq")) carbsReq = result.getDouble("carbsReq");
|
||||
|
||||
if (result.has("rate") && result.has("duration")) {
|
||||
tbrRequested = true;
|
||||
tempBasalReqested = true;
|
||||
rate = result.getDouble("rate");
|
||||
if (rate < 0d) rate = 0d;
|
||||
duration = result.getInt("duration");
|
||||
|
@ -74,7 +74,7 @@ public class DetermineBasalResultSMB extends APSResult {
|
|||
newResult.reason = reason;
|
||||
newResult.rate = rate;
|
||||
newResult.duration = duration;
|
||||
newResult.tbrRequested = tbrRequested;
|
||||
newResult.tempBasalReqested = tempBasalReqested;
|
||||
newResult.bolusRequested = bolusRequested;
|
||||
newResult.rate = rate;
|
||||
newResult.duration = duration;
|
||||
|
|
|
@ -249,15 +249,15 @@ public class OpenAPSSMBPlugin implements PluginBase, APSInterface {
|
|||
// TODO still needed with oref1?
|
||||
// Fix bug determine basal
|
||||
if (determineBasalResultSMB.rate == 0d && determineBasalResultSMB.duration == 0 && !MainApp.getConfigBuilder().isTempBasalInProgress())
|
||||
determineBasalResultSMB.tbrRequested = false;
|
||||
determineBasalResultSMB.tempBasalReqested = false;
|
||||
// limit requests on openloop mode
|
||||
if (!MainApp.getConfigBuilder().isClosedModeEnabled()) {
|
||||
if (MainApp.getConfigBuilder().isTempBasalInProgress() && determineBasalResultSMB.rate == 0 && determineBasalResultSMB.duration == 0) {
|
||||
// going to cancel
|
||||
} else if (MainApp.getConfigBuilder().isTempBasalInProgress() && Math.abs(determineBasalResultSMB.rate - MainApp.getConfigBuilder().getTempBasalAbsoluteRateHistory()) < 0.1) {
|
||||
determineBasalResultSMB.tbrRequested = false;
|
||||
determineBasalResultSMB.tempBasalReqested = false;
|
||||
} else if (!MainApp.getConfigBuilder().isTempBasalInProgress() && Math.abs(determineBasalResultSMB.rate - pump.getBaseBasalRate()) < 0.1) {
|
||||
determineBasalResultSMB.tbrRequested = false;
|
||||
determineBasalResultSMB.tempBasalReqested = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -887,6 +887,6 @@
|
|||
<string name="enablesmbwithtemptarget_summary">Enable SMB when there is temp target active (eating soon, exercise)</string>
|
||||
<string name="enablesmbwithhightemptarget">Enable SMB with high temp targets</string>
|
||||
<string name="enablesmbwithhightemptarget_summary">Enable SMB when there is high temp target active (exercise)</string>
|
||||
<string name="let_tbr_run">Let current temp run</string>
|
||||
<string name="let_temp_basal_run">Let current temp basal run</string>
|
||||
</resources>
|
||||
|
||||
|
|
Loading…
Reference in a new issue