Rename TBR to 'temp basal'

This commit is contained in:
Johannes Mockenhaupt 2018-01-27 22:06:57 +01:00
parent 6fa1badcdb
commit 449dbd79f7
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1
9 changed files with 29 additions and 29 deletions

View file

@ -381,7 +381,7 @@ public class ConfigBuilderPlugin implements PluginBase, ConstraintsInterface, Tr
if (Config.logCongigBuilderActions) if (Config.logCongigBuilderActions)
log.debug("applyAPSRequest: " + request.toString()); 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 ((request.rate == 0 && request.duration == 0) || Math.abs(request.rate - pump.getBaseBasalRate()) < pump.getPumpDescription().basalStep) {
if (isTempBasalInProgress()) { if (isTempBasalInProgress()) {
if (Config.logCongigBuilderActions) if (Config.logCongigBuilderActions)

View file

@ -31,7 +31,7 @@ public class APSResult {
public String reason; public String reason;
public double rate; public double rate;
public int duration; public int duration;
public boolean tbrRequested = false; public boolean tempBasalReqested = false;
public boolean bolusRequested = false; public boolean bolusRequested = false;
public IobTotal iob; public IobTotal iob;
public JSONObject json = new JSONObject(); public JSONObject json = new JSONObject();
@ -48,7 +48,7 @@ public class APSResult {
if (rate == 0 && duration == 0) if (rate == 0 && duration == 0)
ret = MainApp.sResources.getString(R.string.canceltemp) + "\n"; ret = MainApp.sResources.getString(R.string.canceltemp) + "\n";
else if (rate == -1) 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 else
ret = MainApp.sResources.getString(R.string.rate) + ": " + DecimalFormatter.to2Decimal(rate) + " U/h " + ret = MainApp.sResources.getString(R.string.rate) + ": " + DecimalFormatter.to2Decimal(rate) + " U/h " +
"(" + DecimalFormatter.to2Decimal(rate / pump.getBaseBasalRate() * 100) + "%) \n" + "(" + DecimalFormatter.to2Decimal(rate / pump.getBaseBasalRate() * 100) + "%) \n" +
@ -73,7 +73,7 @@ public class APSResult {
if (rate == 0 && duration == 0) if (rate == 0 && duration == 0)
ret = MainApp.sResources.getString(R.string.canceltemp) + "<br>"; ret = MainApp.sResources.getString(R.string.canceltemp) + "<br>";
else if (rate == -1) 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 else
ret = "<b>" + MainApp.sResources.getString(R.string.rate) + "</b>: " + DecimalFormatter.to2Decimal(rate) + " U/h " + ret = "<b>" + MainApp.sResources.getString(R.string.rate) + "</b>: " + DecimalFormatter.to2Decimal(rate) + " U/h " +
"(" + DecimalFormatter.to2Decimal(rate / pump.getBaseBasalRate() * 100) + "%) <br>" + "(" + DecimalFormatter.to2Decimal(rate / pump.getBaseBasalRate() * 100) + "%) <br>" +
@ -98,7 +98,7 @@ public class APSResult {
newResult.reason = reason; newResult.reason = reason;
newResult.rate = rate; newResult.rate = rate;
newResult.duration = duration; newResult.duration = duration;
newResult.tbrRequested = tbrRequested; newResult.tempBasalReqested = tempBasalReqested;
newResult.bolusRequested = bolusRequested; newResult.bolusRequested = bolusRequested;
newResult.iob = iob; newResult.iob = iob;
return newResult; return newResult;
@ -216,6 +216,6 @@ public class APSResult {
} }
public boolean isChangeRequested() { public boolean isChangeRequested() {
return tbrRequested || bolusRequested; return tempBasalReqested || bolusRequested;
} }
} }

View file

@ -22,7 +22,7 @@ public class DetermineBasalResultAMA extends APSResult {
json = j; json = j;
if (result.containsKey("error")) { if (result.containsKey("error")) {
reason = result.get("error").toString(); reason = result.get("error").toString();
tbrRequested = false; tempBasalReqested = false;
rate = -1; rate = -1;
duration = -1; duration = -1;
} else { } else {
@ -32,17 +32,17 @@ public class DetermineBasalResultAMA extends APSResult {
if (result.containsKey("rate")) { if (result.containsKey("rate")) {
rate = (Double) result.get("rate"); rate = (Double) result.get("rate");
if (rate < 0d) rate = 0d; if (rate < 0d) rate = 0d;
tbrRequested = true; tempBasalReqested = true;
} else { } else {
rate = -1; rate = -1;
tbrRequested = false; tempBasalReqested = false;
} }
if (result.containsKey("duration")) { if (result.containsKey("duration")) {
duration = ((Double) result.get("duration")).intValue(); duration = ((Double) result.get("duration")).intValue();
//changeRequested as above //changeRequested as above
} else { } else {
duration = -1; duration = -1;
tbrRequested = false; tempBasalReqested = false;
} }
} }
bolusRequested = false; bolusRequested = false;
@ -58,7 +58,7 @@ public class DetermineBasalResultAMA extends APSResult {
newResult.reason = reason; newResult.reason = reason;
newResult.rate = rate; newResult.rate = rate;
newResult.duration = duration; newResult.duration = duration;
newResult.tbrRequested = tbrRequested; newResult.tempBasalReqested = tempBasalReqested;
newResult.rate = rate; newResult.rate = rate;
newResult.duration = duration; newResult.duration = duration;

View file

@ -243,15 +243,15 @@ public class OpenAPSAMAPlugin implements PluginBase, APSInterface {
Profiler.log(log, "AMA calculation", start); Profiler.log(log, "AMA calculation", start);
// Fix bug determine basal // Fix bug determine basal
if (determineBasalResultAMA.rate == 0d && determineBasalResultAMA.duration == 0 && !MainApp.getConfigBuilder().isTempBasalInProgress()) if (determineBasalResultAMA.rate == 0d && determineBasalResultAMA.duration == 0 && !MainApp.getConfigBuilder().isTempBasalInProgress())
determineBasalResultAMA.tbrRequested = false; determineBasalResultAMA.tempBasalReqested = false;
// limit requests on openloop mode // limit requests on openloop mode
if (!MainApp.getConfigBuilder().isClosedModeEnabled()) { if (!MainApp.getConfigBuilder().isClosedModeEnabled()) {
if (MainApp.getConfigBuilder().isTempBasalInProgress() && determineBasalResultAMA.rate == 0 && determineBasalResultAMA.duration == 0) { if (MainApp.getConfigBuilder().isTempBasalInProgress() && determineBasalResultAMA.rate == 0 && determineBasalResultAMA.duration == 0) {
// going to cancel // going to cancel
} else if (MainApp.getConfigBuilder().isTempBasalInProgress() && Math.abs(determineBasalResultAMA.rate - MainApp.getConfigBuilder().getTempBasalAbsoluteRateHistory()) < 0.1) { } 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) } else if (!MainApp.getConfigBuilder().isTempBasalInProgress() && Math.abs(determineBasalResultAMA.rate - ConfigBuilderPlugin.getActivePump().getBaseBasalRate()) < 0.1)
determineBasalResultAMA.tbrRequested = false; determineBasalResultAMA.tempBasalReqested = false;
} }
determineBasalResultAMA.iob = iobArray[0]; determineBasalResultAMA.iob = iobArray[0];

View file

@ -20,7 +20,7 @@ public class DetermineBasalResultMA extends APSResult {
json = j; json = j;
if (result.containsKey("error")) { if (result.containsKey("error")) {
reason = (String) result.get("error"); reason = (String) result.get("error");
tbrRequested = false; tempBasalReqested = false;
rate = -1; rate = -1;
duration = -1; duration = -1;
mealAssist = ""; mealAssist = "";
@ -31,17 +31,17 @@ public class DetermineBasalResultMA extends APSResult {
if (result.containsKey("rate")) { if (result.containsKey("rate")) {
rate = (Double) result.get("rate"); rate = (Double) result.get("rate");
if (rate < 0d) rate = 0d; if (rate < 0d) rate = 0d;
tbrRequested = true; tempBasalReqested = true;
} else { } else {
rate = -1; rate = -1;
tbrRequested = false; tempBasalReqested = false;
} }
if (result.containsKey("duration")) { if (result.containsKey("duration")) {
duration = ((Double) result.get("duration")).intValue(); duration = ((Double) result.get("duration")).intValue();
//changeRequested as above //changeRequested as above
} else { } else {
duration = -1; duration = -1;
tbrRequested = false; tempBasalReqested = false;
} }
if (result.containsKey("mealAssist")) { if (result.containsKey("mealAssist")) {
mealAssist = result.get("mealAssist").toString(); mealAssist = result.get("mealAssist").toString();
@ -58,10 +58,10 @@ public class DetermineBasalResultMA extends APSResult {
newResult.reason = new String(reason); newResult.reason = new String(reason);
newResult.rate = rate; newResult.rate = rate;
newResult.duration = duration; newResult.duration = duration;
newResult.tbrRequested = isChangeRequested(); newResult.tempBasalReqested = isChangeRequested();
newResult.rate = rate; newResult.rate = rate;
newResult.duration = duration; newResult.duration = duration;
newResult.tbrRequested = isChangeRequested(); newResult.tempBasalReqested = isChangeRequested();
try { try {
newResult.json = new JSONObject(json.toString()); newResult.json = new JSONObject(json.toString());

View file

@ -229,15 +229,15 @@ public class OpenAPSMAPlugin implements PluginBase, APSInterface {
DetermineBasalResultMA determineBasalResultMA = determineBasalAdapterMAJS.invoke(); DetermineBasalResultMA determineBasalResultMA = determineBasalAdapterMAJS.invoke();
// Fix bug determinef basal // Fix bug determinef basal
if (determineBasalResultMA.rate == 0d && determineBasalResultMA.duration == 0 && !MainApp.getConfigBuilder().isTempBasalInProgress()) if (determineBasalResultMA.rate == 0d && determineBasalResultMA.duration == 0 && !MainApp.getConfigBuilder().isTempBasalInProgress())
determineBasalResultMA.tbrRequested = false; determineBasalResultMA.tempBasalReqested = false;
// limit requests on openloop mode // limit requests on openloop mode
if (!MainApp.getConfigBuilder().isClosedModeEnabled()) { if (!MainApp.getConfigBuilder().isClosedModeEnabled()) {
if (MainApp.getConfigBuilder().isTempBasalInProgress() && determineBasalResultMA.rate == 0 && determineBasalResultMA.duration == 0) { if (MainApp.getConfigBuilder().isTempBasalInProgress() && determineBasalResultMA.rate == 0 && determineBasalResultMA.duration == 0) {
// going to cancel // going to cancel
} else if (MainApp.getConfigBuilder().isTempBasalInProgress() && Math.abs(determineBasalResultMA.rate - MainApp.getConfigBuilder().getTempBasalAbsoluteRateHistory()) < 0.1) { } 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) } else if (!MainApp.getConfigBuilder().isTempBasalInProgress() && Math.abs(determineBasalResultMA.rate - ConfigBuilderPlugin.getActivePump().getBaseBasalRate()) < 0.1)
determineBasalResultMA.tbrRequested = false; determineBasalResultMA.tempBasalReqested = false;
} }
determineBasalResultMA.iob = iobTotal; determineBasalResultMA.iob = iobTotal;

View file

@ -35,7 +35,7 @@ public class DetermineBasalResultSMB extends APSResult {
if (result.has("carbsReq")) carbsReq = result.getDouble("carbsReq"); if (result.has("carbsReq")) carbsReq = result.getDouble("carbsReq");
if (result.has("rate") && result.has("duration")) { if (result.has("rate") && result.has("duration")) {
tbrRequested = true; tempBasalReqested = true;
rate = result.getDouble("rate"); rate = result.getDouble("rate");
if (rate < 0d) rate = 0d; if (rate < 0d) rate = 0d;
duration = result.getInt("duration"); duration = result.getInt("duration");
@ -74,7 +74,7 @@ public class DetermineBasalResultSMB extends APSResult {
newResult.reason = reason; newResult.reason = reason;
newResult.rate = rate; newResult.rate = rate;
newResult.duration = duration; newResult.duration = duration;
newResult.tbrRequested = tbrRequested; newResult.tempBasalReqested = tempBasalReqested;
newResult.bolusRequested = bolusRequested; newResult.bolusRequested = bolusRequested;
newResult.rate = rate; newResult.rate = rate;
newResult.duration = duration; newResult.duration = duration;

View file

@ -249,15 +249,15 @@ public class OpenAPSSMBPlugin implements PluginBase, APSInterface {
// TODO still needed with oref1? // TODO still needed with oref1?
// Fix bug determine basal // Fix bug determine basal
if (determineBasalResultSMB.rate == 0d && determineBasalResultSMB.duration == 0 && !MainApp.getConfigBuilder().isTempBasalInProgress()) if (determineBasalResultSMB.rate == 0d && determineBasalResultSMB.duration == 0 && !MainApp.getConfigBuilder().isTempBasalInProgress())
determineBasalResultSMB.tbrRequested = false; determineBasalResultSMB.tempBasalReqested = false;
// limit requests on openloop mode // limit requests on openloop mode
if (!MainApp.getConfigBuilder().isClosedModeEnabled()) { if (!MainApp.getConfigBuilder().isClosedModeEnabled()) {
if (MainApp.getConfigBuilder().isTempBasalInProgress() && determineBasalResultSMB.rate == 0 && determineBasalResultSMB.duration == 0) { if (MainApp.getConfigBuilder().isTempBasalInProgress() && determineBasalResultSMB.rate == 0 && determineBasalResultSMB.duration == 0) {
// going to cancel // going to cancel
} else if (MainApp.getConfigBuilder().isTempBasalInProgress() && Math.abs(determineBasalResultSMB.rate - MainApp.getConfigBuilder().getTempBasalAbsoluteRateHistory()) < 0.1) { } 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) { } else if (!MainApp.getConfigBuilder().isTempBasalInProgress() && Math.abs(determineBasalResultSMB.rate - pump.getBaseBasalRate()) < 0.1) {
determineBasalResultSMB.tbrRequested = false; determineBasalResultSMB.tempBasalReqested = false;
} }
} }

View file

@ -887,6 +887,6 @@
<string name="enablesmbwithtemptarget_summary">Enable SMB when there is temp target active (eating soon, exercise)</string> <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">Enable SMB with high temp targets</string>
<string name="enablesmbwithhightemptarget_summary">Enable SMB when there is high temp target active (exercise)</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> </resources>