Merge pull request #779 from jotomo/loop-results

Loop results
This commit is contained in:
Milos Kozak 2018-03-21 10:44:13 +01:00 committed by GitHub
commit 272fdb4747
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 123 additions and 99 deletions

View file

@ -97,18 +97,22 @@ public class PumpEnactResult {
if (bolusDelivered > 0) { if (bolusDelivered > 0) {
ret += "\n" + MainApp.sResources.getString(R.string.enacted) + ": " + enacted; ret += "\n" + MainApp.sResources.getString(R.string.enacted) + ": " + enacted;
ret += "\n" + MainApp.sResources.getString(R.string.comment) + ": " + comment; ret += "\n" + MainApp.sResources.getString(R.string.comment) + ": " + comment;
ret += "\n" + MainApp.sResources.getString(R.string.smb_shortname) + ": " + bolusDelivered + "U"; ret += "\n" + MainApp.sResources.getString(R.string.smb_shortname)
+ ": " + bolusDelivered + " " + MainApp.gs(R.string.insulin_unit_shortname);
} else if (isTempCancel) { } else if (isTempCancel) {
ret += "\n" + MainApp.sResources.getString(R.string.enacted) + ": " + enacted; ret += "\n" + MainApp.sResources.getString(R.string.enacted) + ": " + enacted;
ret += "\n" + MainApp.sResources.getString(R.string.comment) + ": " + comment + "\n" + if (!comment.isEmpty())
MainApp.sResources.getString(R.string.canceltemp); ret += "\n" + MainApp.sResources.getString(R.string.comment) + ": " + comment;
ret += MainApp.sResources.getString(R.string.canceltemp);
} else if (isPercent) { } else if (isPercent) {
ret += "\n" + MainApp.sResources.getString(R.string.enacted) + ": " + enacted; ret += "\n" + MainApp.sResources.getString(R.string.enacted) + ": " + enacted;
if (!comment.isEmpty())
ret += "\n" + MainApp.sResources.getString(R.string.comment) + ": " + comment; ret += "\n" + MainApp.sResources.getString(R.string.comment) + ": " + comment;
ret += "\n" + MainApp.sResources.getString(R.string.duration) + ": " + duration + " min"; ret += "\n" + MainApp.sResources.getString(R.string.duration) + ": " + duration + " min";
ret += "\n" + MainApp.sResources.getString(R.string.percent) + ": " + percent + "%"; ret += "\n" + MainApp.sResources.getString(R.string.percent) + ": " + percent + "%";
} else { } else {
ret += "\n" + MainApp.sResources.getString(R.string.enacted) + ": " + enacted; ret += "\n" + MainApp.sResources.getString(R.string.enacted) + ": " + enacted;
if (!comment.isEmpty())
ret += "\n" + MainApp.sResources.getString(R.string.comment) + ": " + comment; ret += "\n" + MainApp.sResources.getString(R.string.comment) + ": " + comment;
ret += "\n" + MainApp.sResources.getString(R.string.duration) + ": " + duration + " min"; ret += "\n" + MainApp.sResources.getString(R.string.duration) + ": " + duration + " min";
ret += "\n" + MainApp.sResources.getString(R.string.absolute) + ": " + absolute + " U/h"; ret += "\n" + MainApp.sResources.getString(R.string.absolute) + ": " + absolute + " U/h";
@ -126,26 +130,26 @@ public class PumpEnactResult {
} else if (enacted) { } else if (enacted) {
if (bolusDelivered > 0) { if (bolusDelivered > 0) {
ret += "<br><b>" + MainApp.sResources.getString(R.string.enacted) + "</b>: " + enacted; ret += "<br><b>" + MainApp.sResources.getString(R.string.enacted) + "</b>: " + enacted;
if (!comment.isEmpty())
ret += "<br><b>" + MainApp.sResources.getString(R.string.comment) + "</b>: " + comment; ret += "<br><b>" + MainApp.sResources.getString(R.string.comment) + "</b>: " + comment;
ret += "<br><b>" + MainApp.sResources.getString(R.string.smb_shortname) + "</b>: " + bolusDelivered + "U"; ret += "<br><b>" + MainApp.sResources.getString(R.string.smb_shortname) + "</b>: " + bolusDelivered + " " + MainApp.gs(R.string.insulin_unit_shortname);
} else if (isTempCancel) { } else if (isTempCancel) {
ret += "<br><b>" + MainApp.sResources.getString(R.string.enacted) + "</b>: " + enacted; ret += "<br><b>" + MainApp.sResources.getString(R.string.enacted) + "</b>: " + enacted;
ret += "<br><b>" + MainApp.sResources.getString(R.string.comment) + "</b>: " + comment + ret += "<br><b>" + MainApp.sResources.getString(R.string.comment) + "</b>: " + comment +
"<br>" + MainApp.sResources.getString(R.string.canceltemp); "<br>" + MainApp.sResources.getString(R.string.canceltemp);
} else if (isPercent && percent != -1) { } else if (isPercent && percent != -1) {
ret += "<br><b>" + MainApp.sResources.getString(R.string.enacted) + "</b>: " + enacted; ret += "<br><b>" + MainApp.sResources.getString(R.string.enacted) + "</b>: " + enacted;
if (!comment.isEmpty())
ret += "<br><b>" + MainApp.sResources.getString(R.string.comment) + "</b>: " + comment; ret += "<br><b>" + MainApp.sResources.getString(R.string.comment) + "</b>: " + comment;
ret += "<br><b>" + MainApp.sResources.getString(R.string.duration) + "</b>: " + duration + " min"; ret += "<br><b>" + MainApp.sResources.getString(R.string.duration) + "</b>: " + duration + " min";
ret += "<br><b>" + MainApp.sResources.getString(R.string.percent) + "</b>: " + percent + "%"; ret += "<br><b>" + MainApp.sResources.getString(R.string.percent) + "</b>: " + percent + "%";
} else if (absolute != -1) { } else if (absolute != -1) {
ret += "<br><b>" + MainApp.sResources.getString(R.string.enacted) + "</b>: " + enacted; ret += "<br><b>" + MainApp.sResources.getString(R.string.enacted) + "</b>: " + enacted;
if (!comment.isEmpty())
ret += "<br><b>" + MainApp.sResources.getString(R.string.comment) + "</b>: " + comment; ret += "<br><b>" + MainApp.sResources.getString(R.string.comment) + "</b>: " + comment;
ret += "<br><b>" + MainApp.sResources.getString(R.string.duration) + "</b>: " + duration + " min"; ret += "<br><b>" + MainApp.sResources.getString(R.string.duration) + "</b>: " + duration + " min";
ret += "<br><b>" + MainApp.sResources.getString(R.string.absolute) + "</b>: " + DecimalFormatter.to2Decimal(absolute) + " U/h"; ret += "<br><b>" + MainApp.sResources.getString(R.string.absolute) + "</b>: " + DecimalFormatter.to2Decimal(absolute) + " U/h";
} }
if (bolusDelivered > 0) {
ret += "<br><b>" + MainApp.sResources.getString(R.string.bolus) + "</b>: " + DecimalFormatter.to2Decimal(bolusDelivered) + " U";
}
} else { } else {
ret += "<br><b>" + MainApp.sResources.getString(R.string.comment) + "</b>: " + comment; ret += "<br><b>" + MainApp.sResources.getString(R.string.comment) + "</b>: " + comment;
} }

View file

@ -4,8 +4,6 @@ import android.content.SharedPreferences;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import org.json.JSONException;
import org.json.JSONObject;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -43,7 +41,6 @@ import info.nightscout.androidaps.interfaces.TreatmentsInterface;
import info.nightscout.androidaps.plugins.Loop.APSResult; import info.nightscout.androidaps.plugins.Loop.APSResult;
import info.nightscout.androidaps.plugins.Loop.LoopPlugin; import info.nightscout.androidaps.plugins.Loop.LoopPlugin;
import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification; import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification;
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
import info.nightscout.androidaps.plugins.Overview.notifications.Notification; import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
import info.nightscout.androidaps.plugins.PumpVirtual.VirtualPumpPlugin; import info.nightscout.androidaps.plugins.PumpVirtual.VirtualPumpPlugin;
import info.nightscout.androidaps.queue.Callback; import info.nightscout.androidaps.queue.Callback;
@ -355,11 +352,13 @@ public class ConfigBuilderPlugin implements PluginBase, ConstraintsInterface, Tr
* expect absolute request and allow both absolute and percent response based on pump capabilities * expect absolute request and allow both absolute and percent response based on pump capabilities
*/ */
public void applyTBRRequest(APSResult request, Profile profile, Callback callback) { public void applyTBRRequest(APSResult request, Profile profile, Callback callback) {
if (!request.tempBasalRequested) {
return;
}
PumpInterface pump = getActivePump(); PumpInterface pump = getActivePump();
request.rate = applyBasalConstraints(request.rate); request.rate = applyBasalConstraints(request.rate);
long now = System.currentTimeMillis();
if (!pump.isInitialized()) { if (!pump.isInitialized()) {
log.debug("applyAPSRequest: " + MainApp.sResources.getString(R.string.pumpNotInitialized)); log.debug("applyAPSRequest: " + MainApp.sResources.getString(R.string.pumpNotInitialized));
if (callback != null) { if (callback != null) {
@ -379,7 +378,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.tempBasalReqested) { long now = System.currentTimeMillis();
TemporaryBasal activeTemp = getTempBasalFromHistory(now); TemporaryBasal activeTemp = getTempBasalFromHistory(now);
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 (activeTemp != null) { if (activeTemp != null) {
@ -390,16 +389,20 @@ public class ConfigBuilderPlugin implements PluginBase, ConstraintsInterface, Tr
if (Config.logCongigBuilderActions) if (Config.logCongigBuilderActions)
log.debug("applyAPSRequest: Basal set correctly"); log.debug("applyAPSRequest: Basal set correctly");
if (callback != null) { if (callback != null) {
callback.result(new PumpEnactResult().absolute(request.rate).duration(0).enacted(false).success(true).comment("Basal set correctly")).run(); callback.result(new PumpEnactResult().absolute(request.rate).duration(0)
.enacted(false).success(true).comment(MainApp.gs(R.string.basal_set_correctly))).run();
} }
} }
} else if (activeTemp != null } else if (activeTemp != null
&& activeTemp.getPlannedRemainingMinutes() > 5 && activeTemp.getPlannedRemainingMinutes() > 5
&& request.duration - activeTemp.getPlannedRemainingMinutes() < 30
&& Math.abs(request.rate - activeTemp.tempBasalConvertedToAbsolute(now, profile)) < pump.getPumpDescription().basalStep) { && Math.abs(request.rate - activeTemp.tempBasalConvertedToAbsolute(now, profile)) < pump.getPumpDescription().basalStep) {
if (Config.logCongigBuilderActions) if (Config.logCongigBuilderActions)
log.debug("applyAPSRequest: Temp basal set correctly"); log.debug("applyAPSRequest: Temp basal set correctly");
if (callback != null) { if (callback != null) {
callback.result(new PumpEnactResult().absolute(activeTemp.tempBasalConvertedToAbsolute(now, profile)).duration(activeTemp.getPlannedRemainingMinutes()).enacted(false).success(true).comment("Temp basal set correctly")).run(); callback.result(new PumpEnactResult().absolute(activeTemp.tempBasalConvertedToAbsolute(now, profile))
.enacted(false).success(true).duration(activeTemp.getPlannedRemainingMinutes())
.comment(MainApp.gs(R.string.let_temp_basal_run))).run();
} }
} else { } else {
if (Config.logCongigBuilderActions) if (Config.logCongigBuilderActions)
@ -407,9 +410,23 @@ public class ConfigBuilderPlugin implements PluginBase, ConstraintsInterface, Tr
getCommandQueue().tempBasalAbsolute(request.rate, request.duration, false, callback); getCommandQueue().tempBasalAbsolute(request.rate, request.duration, false, callback);
} }
} }
}
public void applySMBRequest(APSResult request, Callback callback) { public void applySMBRequest(APSResult request, Callback callback) {
if (!request.bolusRequested) {
return;
}
long lastBolusTime = getLastBolusTime();
if (lastBolusTime != 0 && lastBolusTime + 3 * 60 * 1000 > System.currentTimeMillis()) {
log.debug("SMB requested but still in 3 min interval");
if (callback != null) {
callback.result(new PumpEnactResult()
.comment(MainApp.gs(R.string.smb_frequency_exceeded))
.enacted(false).success(false)).run();
}
return;
}
PumpInterface pump = getActivePump(); PumpInterface pump = getActivePump();
if (!pump.isInitialized()) { if (!pump.isInitialized()) {
@ -431,21 +448,17 @@ public class ConfigBuilderPlugin implements PluginBase, ConstraintsInterface, Tr
if (Config.logCongigBuilderActions) if (Config.logCongigBuilderActions)
log.debug("applySMBRequest: " + request.toString()); log.debug("applySMBRequest: " + request.toString());
if (request.bolusRequested) { // deliver SMB
long lastBolusTime = getLastBolusTime();
if (lastBolusTime != 0 && lastBolusTime + 3 * 60 * 1000 > System.currentTimeMillis()) {
log.debug("SMB requsted but still in 3 min interval");
} else {
DetailedBolusInfo detailedBolusInfo = new DetailedBolusInfo(); DetailedBolusInfo detailedBolusInfo = new DetailedBolusInfo();
detailedBolusInfo.eventType = CareportalEvent.CORRECTIONBOLUS; detailedBolusInfo.eventType = CareportalEvent.CORRECTIONBOLUS;
detailedBolusInfo.insulin = request.smb; detailedBolusInfo.insulin = request.smb;
detailedBolusInfo.isSMB = true; detailedBolusInfo.isSMB = true;
detailedBolusInfo.source = Source.USER; detailedBolusInfo.source = Source.USER;
detailedBolusInfo.deliverAt = request.deliverAt; detailedBolusInfo.deliverAt = request.deliverAt;
if (Config.logCongigBuilderActions)
log.debug("applyAPSRequest: bolus()");
getCommandQueue().bolus(detailedBolusInfo, callback); getCommandQueue().bolus(detailedBolusInfo, callback);
} }
}
}
/** /**
* Constraints interface * Constraints interface

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 tempBasalReqested = false; public boolean tempBasalRequested = 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();
@ -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.tempBasalReqested = tempBasalReqested; newResult.tempBasalRequested = tempBasalRequested;
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 tempBasalReqested || bolusRequested; return tempBasalRequested || bolusRequested;
} }
} }

View file

@ -328,7 +328,10 @@ public class LoopPlugin implements PluginBase {
if (result.isChangeRequested()) { if (result.isChangeRequested()) {
final PumpEnactResult waiting = new PumpEnactResult(); final PumpEnactResult waiting = new PumpEnactResult();
waiting.queued = true; waiting.queued = true;
if (resultAfterConstraints.tempBasalRequested)
lastRun.tbrSetByPump = waiting; lastRun.tbrSetByPump = waiting;
if (resultAfterConstraints.bolusRequested)
lastRun.smbSetByPump = waiting;
MainApp.bus().post(new EventLoopUpdateGui()); MainApp.bus().post(new EventLoopUpdateGui());
FabricPrivacy.getInstance().logCustom(new CustomEvent("APSRequest")); FabricPrivacy.getInstance().logCustom(new CustomEvent("APSRequest"));
MainApp.getConfigBuilder().applyTBRRequest(resultAfterConstraints, profile, new Callback() { MainApp.getConfigBuilder().applyTBRRequest(resultAfterConstraints, profile, new Callback() {

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();
tempBasalReqested = false; tempBasalRequested = 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;
tempBasalReqested = true; tempBasalRequested = true;
} else { } else {
rate = -1; rate = -1;
tempBasalReqested = false; tempBasalRequested = 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;
tempBasalReqested = false; tempBasalRequested = 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.tempBasalReqested = tempBasalReqested; newResult.tempBasalRequested = tempBasalRequested;
newResult.rate = rate; newResult.rate = rate;
newResult.duration = duration; newResult.duration = duration;

View file

@ -246,7 +246,7 @@ 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.tempBasalReqested = false; determineBasalResultAMA.tempBasalRequested = false;
// limit requests on openloop mode // limit requests on openloop mode
if (!MainApp.getConfigBuilder().isClosedModeEnabled()) { if (!MainApp.getConfigBuilder().isClosedModeEnabled()) {
long now = System.currentTimeMillis(); long now = System.currentTimeMillis();
@ -254,9 +254,9 @@ public class OpenAPSAMAPlugin implements PluginBase, APSInterface {
if (activeTemp != null && determineBasalResultAMA.rate == 0 && determineBasalResultAMA.duration == 0) { if (activeTemp != null && determineBasalResultAMA.rate == 0 && determineBasalResultAMA.duration == 0) {
// going to cancel // going to cancel
} else if (activeTemp != null && Math.abs(determineBasalResultAMA.rate - activeTemp.tempBasalConvertedToAbsolute(now, profile)) < 0.1) { } else if (activeTemp != null && Math.abs(determineBasalResultAMA.rate - activeTemp.tempBasalConvertedToAbsolute(now, profile)) < 0.1) {
determineBasalResultAMA.tempBasalReqested = false; determineBasalResultAMA.tempBasalRequested = false;
} else if (activeTemp == null && Math.abs(determineBasalResultAMA.rate - ConfigBuilderPlugin.getActivePump().getBaseBasalRate()) < 0.1) } else if (activeTemp == null && Math.abs(determineBasalResultAMA.rate - ConfigBuilderPlugin.getActivePump().getBaseBasalRate()) < 0.1)
determineBasalResultAMA.tempBasalReqested = false; determineBasalResultAMA.tempBasalRequested = 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");
tempBasalReqested = false; tempBasalRequested = 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;
tempBasalReqested = true; tempBasalRequested = true;
} else { } else {
rate = -1; rate = -1;
tempBasalReqested = false; tempBasalRequested = 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;
tempBasalReqested = false; tempBasalRequested = 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.tempBasalReqested = isChangeRequested(); newResult.tempBasalRequested = isChangeRequested();
newResult.rate = rate; newResult.rate = rate;
newResult.duration = duration; newResult.duration = duration;
newResult.tempBasalReqested = isChangeRequested(); newResult.tempBasalRequested = isChangeRequested();
try { try {
newResult.json = new JSONObject(json.toString()); newResult.json = new JSONObject(json.toString());

View file

@ -235,16 +235,16 @@ 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.tempBasalReqested = false; determineBasalResultMA.tempBasalRequested = false;
// limit requests on openloop mode // limit requests on openloop mode
if (!MainApp.getConfigBuilder().isClosedModeEnabled()) { if (!MainApp.getConfigBuilder().isClosedModeEnabled()) {
TemporaryBasal activeTemp = MainApp.getConfigBuilder().getTempBasalFromHistory(now); TemporaryBasal activeTemp = MainApp.getConfigBuilder().getTempBasalFromHistory(now);
if (activeTemp != null && determineBasalResultMA.rate == 0 && determineBasalResultMA.duration == 0) { if (activeTemp != null && determineBasalResultMA.rate == 0 && determineBasalResultMA.duration == 0) {
// going to cancel // going to cancel
} else if (activeTemp != null && Math.abs(determineBasalResultMA.rate - activeTemp.tempBasalConvertedToAbsolute(now, profile)) < 0.1) { } else if (activeTemp != null && Math.abs(determineBasalResultMA.rate - activeTemp.tempBasalConvertedToAbsolute(now, profile)) < 0.1) {
determineBasalResultMA.tempBasalReqested = false; determineBasalResultMA.tempBasalRequested = false;
} else if (activeTemp == null && Math.abs(determineBasalResultMA.rate - ConfigBuilderPlugin.getActivePump().getBaseBasalRate()) < 0.1) } else if (activeTemp == null && Math.abs(determineBasalResultMA.rate - ConfigBuilderPlugin.getActivePump().getBaseBasalRate()) < 0.1)
determineBasalResultMA.tempBasalReqested = false; determineBasalResultMA.tempBasalRequested = 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")) {
tempBasalReqested = true; tempBasalRequested = 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.tempBasalReqested = tempBasalReqested; newResult.tempBasalRequested = tempBasalRequested;
newResult.bolusRequested = bolusRequested; newResult.bolusRequested = bolusRequested;
newResult.rate = rate; newResult.rate = rate;
newResult.duration = duration; newResult.duration = duration;

View file

@ -251,16 +251,16 @@ 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.tempBasalReqested = false; determineBasalResultSMB.tempBasalRequested = false;
// limit requests on openloop mode // limit requests on openloop mode
if (!MainApp.getConfigBuilder().isClosedModeEnabled()) { if (!MainApp.getConfigBuilder().isClosedModeEnabled()) {
TemporaryBasal activeTemp = MainApp.getConfigBuilder().getTempBasalFromHistory(now); TemporaryBasal activeTemp = MainApp.getConfigBuilder().getTempBasalFromHistory(now);
if (activeTemp != null && determineBasalResultSMB.rate == 0 && determineBasalResultSMB.duration == 0) { if (activeTemp != null && determineBasalResultSMB.rate == 0 && determineBasalResultSMB.duration == 0) {
// going to cancel // going to cancel
} else if (activeTemp != null && Math.abs(determineBasalResultSMB.rate - activeTemp.tempBasalConvertedToAbsolute(now, profile)) < 0.1) { } else if (activeTemp != null && Math.abs(determineBasalResultSMB.rate - activeTemp.tempBasalConvertedToAbsolute(now, profile)) < 0.1) {
determineBasalResultSMB.tempBasalReqested = false; determineBasalResultSMB.tempBasalRequested = false;
} else if (activeTemp == null && Math.abs(determineBasalResultSMB.rate - ConfigBuilderPlugin.getActivePump().getBaseBasalRate()) < 0.1) } else if (activeTemp == null && Math.abs(determineBasalResultSMB.rate - ConfigBuilderPlugin.getActivePump().getBaseBasalRate()) < 0.1)
determineBasalResultSMB.tempBasalReqested = false; determineBasalResultSMB.tempBasalRequested = false;
} }
determineBasalResultSMB.iob = iobArray[0]; determineBasalResultSMB.iob = iobArray[0];

View file

@ -233,7 +233,7 @@ public class ComboFragment extends SubscriberFragment implements View.OnClickLis
// reservoir // reservoir
int reservoirLevel = plugin.getPump().reservoirLevel; int reservoirLevel = plugin.getPump().reservoirLevel;
if (reservoirLevel != -1) { if (reservoirLevel != -1) {
reservoirView.setText(reservoirLevel + " " + MainApp.sResources.getString(R.string.treatments_wizard_unit_label)); reservoirView.setText(reservoirLevel + " " + MainApp.sResources.getString(R.string.insulin_unit_shortname));
} else if (ps.insulinState == PumpState.LOW) { } else if (ps.insulinState == PumpState.LOW) {
reservoirView.setText(MainApp.gs(R.string.combo_reservoir_low)); reservoirView.setText(MainApp.gs(R.string.combo_reservoir_low));
} else if (ps.insulinState == PumpState.EMPTY) { } else if (ps.insulinState == PumpState.EMPTY) {
@ -275,7 +275,7 @@ public class ComboFragment extends SubscriberFragment implements View.OnClickLis
if (bolus != null) { if (bolus != null) {
long agoMsc = System.currentTimeMillis() - bolus.timestamp; long agoMsc = System.currentTimeMillis() - bolus.timestamp;
double bolusMinAgo = agoMsc / 60d / 1000d; double bolusMinAgo = agoMsc / 60d / 1000d;
String unit = MainApp.gs(R.string.treatments_wizard_unit_label); String unit = MainApp.gs(R.string.insulin_unit_shortname);
String ago; String ago;
if ((agoMsc < 60 * 1000)) { if ((agoMsc < 60 * 1000)) {
ago = MainApp.gs(R.string.combo_pump_connected_now); ago = MainApp.gs(R.string.combo_pump_connected_now);

View file

@ -108,7 +108,7 @@
android:gravity="left" android:gravity="left"
android:minWidth="45dp" android:minWidth="45dp"
android:paddingLeft="5dp" android:paddingLeft="5dp"
android:text="@string/treatments_wizard_unit_label" android:text="@string/insulin_unit_shortname"
android:textAppearance="?android:attr/textAppearanceSmall" /> android:textAppearance="?android:attr/textAppearanceSmall" />
</LinearLayout> </LinearLayout>

View file

@ -40,7 +40,7 @@
<string name="treatments_wizard_bg_label">КЗ</string> <string name="treatments_wizard_bg_label">КЗ</string>
<string name="treatments_wizard_carbs_label">ВХ</string> <string name="treatments_wizard_carbs_label">ВХ</string>
<string name="treatments_wizard_correction_label">Корекция</string> <string name="treatments_wizard_correction_label">Корекция</string>
<string name="treatments_wizard_unit_label">Ед</string> <string name="insulin_unit_shortname">Ед</string>
<string name="treatments_wizard_bolusiob_label">IOB от болуси</string> <string name="treatments_wizard_bolusiob_label">IOB от болуси</string>
<string name="openapsma_run">Старт сега</string> <string name="openapsma_run">Старт сега</string>
<string name="pump_basebasalrate_label">Базова базална стойност</string> <string name="pump_basebasalrate_label">Базова базална стойност</string>

View file

@ -139,7 +139,7 @@
<string name="treatments_wizard_bolusiob_label">Bolusové IOB</string> <string name="treatments_wizard_bolusiob_label">Bolusové IOB</string>
<string name="treatments_wizard_carbs_label">Sacharidy</string> <string name="treatments_wizard_carbs_label">Sacharidy</string>
<string name="treatments_wizard_correction_label">Korekce</string> <string name="treatments_wizard_correction_label">Korekce</string>
<string name="treatments_wizard_unit_label">U</string> <string name="insulin_unit_shortname">U</string>
<string name="treatmentssafety_maxbolus_title">Maximální povolený bolus [U]</string> <string name="treatmentssafety_maxbolus_title">Maximální povolený bolus [U]</string>
<string name="treatmentssafety_maxcarbs_title">Maximální povolené sacharidy [g]</string> <string name="treatmentssafety_maxcarbs_title">Maximální povolené sacharidy [g]</string>
<string name="treatmentssafety_title">Bezpečnost zadání ošetřeni</string> <string name="treatmentssafety_title">Bezpečnost zadání ošetřeni</string>

View file

@ -84,7 +84,7 @@
<string name="treatments_iobactivitytotal_label_string">Aktives Gesamt-IOB:</string> <string name="treatments_iobactivitytotal_label_string">Aktives Gesamt-IOB:</string>
<string name="treatments_iobtotal_label_string">Gesamt-IOB:</string> <string name="treatments_iobtotal_label_string">Gesamt-IOB:</string>
<string name="treatments_wizard_basaliob_label">Basal-IOB</string> <string name="treatments_wizard_basaliob_label">Basal-IOB</string>
<string name="treatments_wizard_unit_label">IE</string> <string name="insulin_unit_shortname">IE</string>
<string name="virtualpump">Virtuelle Pumpe</string> <string name="virtualpump">Virtuelle Pumpe</string>
<string name="pump_reservoir_label">Reservoir</string> <string name="pump_reservoir_label">Reservoir</string>
<string name="xdrip">xDrip</string> <string name="xdrip">xDrip</string>
@ -742,4 +742,6 @@
<string name="combo_high_temp_rejected_due_to_pump_history_changes">Es wurde keine hohe TBR gesetzt, da nach der Berechnung Boluseinträge in der Pumpenhistorik gefunden wurden.</string> <string name="combo_high_temp_rejected_due_to_pump_history_changes">Es wurde keine hohe TBR gesetzt, da nach der Berechnung Boluseinträge in der Pumpenhistorik gefunden wurden.</string>
<string name="combo_check_date">Der letzte Bolus liegt mehr als 24 Stunden zurück oder liegt in der Zukunft. Prüfe bitte das Datum auf der Pumpe.</string> <string name="combo_check_date">Der letzte Bolus liegt mehr als 24 Stunden zurück oder liegt in der Zukunft. Prüfe bitte das Datum auf der Pumpe.</string>
<string name="combo_suspious_bolus_time">Zeit/Datum des abgegebenen Boluses auf der Pumpe erscheint falsch, IOB ist wahrscheinlich nicht korrekt. Bitte prüfe Zeit/Datum der Pumpe.</string> <string name="combo_suspious_bolus_time">Zeit/Datum des abgegebenen Boluses auf der Pumpe erscheint falsch, IOB ist wahrscheinlich nicht korrekt. Bitte prüfe Zeit/Datum der Pumpe.</string>
<string name="combo_tbr_count">Anzahl TBRs</string>
<string name="combo_bolus_count">Anzahl Boluse</string>
</resources> </resources>

View file

@ -42,7 +42,7 @@
<string name="treatments_wizard_tt_label">TT</string> <string name="treatments_wizard_tt_label">TT</string>
<string name="treatments_wizard_carbs_label">Υδατάνθρακες</string> <string name="treatments_wizard_carbs_label">Υδατάνθρακες</string>
<string name="treatments_wizard_correction_label">Διόρθωση</string> <string name="treatments_wizard_correction_label">Διόρθωση</string>
<string name="treatments_wizard_unit_label">U</string> <string name="insulin_unit_shortname">U</string>
<string name="treatments_wizard_bolusiob_label">Bolus IOB</string> <string name="treatments_wizard_bolusiob_label">Bolus IOB</string>
<string name="openapsma_run">Έναρξη τώρα</string> <string name="openapsma_run">Έναρξη τώρα</string>
<string name="vitualpump_label">ΕΙΚΟΝΙΚΗ ΑΝΤΛΙΑ</string> <string name="vitualpump_label">ΕΙΚΟΝΙΚΗ ΑΝΤΛΙΑ</string>

View file

@ -36,7 +36,7 @@
<string name="treatments_wizard_bg_label">Glucosa</string> <string name="treatments_wizard_bg_label">Glucosa</string>
<string name="treatments_wizard_carbs_label">Hidratos Carbono</string> <string name="treatments_wizard_carbs_label">Hidratos Carbono</string>
<string name="treatments_wizard_correction_label">Corrección</string> <string name="treatments_wizard_correction_label">Corrección</string>
<string name="treatments_wizard_unit_label">U</string> <string name="insulin_unit_shortname">U</string>
<string name="treatments_wizard_bolusiob_label">Bolo IOB</string> <string name="treatments_wizard_bolusiob_label">Bolo IOB</string>
<string name="openapsma_run">Ejecutar ahora</string> <string name="openapsma_run">Ejecutar ahora</string>
<string name="vitualpump_label">BOMBA VIRTUAL</string> <string name="vitualpump_label">BOMBA VIRTUAL</string>

View file

@ -42,7 +42,7 @@
<string name="treatments_wizard_tt_label">CT</string> <string name="treatments_wizard_tt_label">CT</string>
<string name="treatments_wizard_carbs_label">Glucides</string> <string name="treatments_wizard_carbs_label">Glucides</string>
<string name="treatments_wizard_correction_label">Corr</string> <string name="treatments_wizard_correction_label">Corr</string>
<string name="treatments_wizard_unit_label">U</string> <string name="insulin_unit_shortname">U</string>
<string name="treatments_wizard_bolusiob_label">Bolus IR</string> <string name="treatments_wizard_bolusiob_label">Bolus IR</string>
<string name="openapsma_run">"Exécuter maintenant "</string> <string name="openapsma_run">"Exécuter maintenant "</string>
<string name="vitualpump_label">POMPE VIRTUELLE</string> <string name="vitualpump_label">POMPE VIRTUELLE</string>

View file

@ -425,7 +425,7 @@
<string name="treatmentssafety_title">Sicurezza delle prestazioni</string> <string name="treatmentssafety_title">Sicurezza delle prestazioni</string>
<string name="treatmentssafety_maxcarbs_title">Valore massimo carbo (g)</string> <string name="treatmentssafety_maxcarbs_title">Valore massimo carbo (g)</string>
<string name="treatmentssafety_maxbolus_title">Bolo massimo (U)</string> <string name="treatmentssafety_maxbolus_title">Bolo massimo (U)</string>
<string name="treatments_wizard_unit_label">U</string> <string name="insulin_unit_shortname">U</string>
<string name="treatments_wizard_correction_label">Correzione</string> <string name="treatments_wizard_correction_label">Correzione</string>
<string name="treatments_wizard_cob_label">COB</string> <string name="treatments_wizard_cob_label">COB</string>
<string name="treatments_wizard_carbs_label">Carboidrati</string> <string name="treatments_wizard_carbs_label">Carboidrati</string>

View file

@ -40,7 +40,7 @@
<string name="treatments_wizard_bg_label">혈당</string> <string name="treatments_wizard_bg_label">혈당</string>
<string name="treatments_wizard_carbs_label">탄수화물</string> <string name="treatments_wizard_carbs_label">탄수화물</string>
<string name="treatments_wizard_correction_label">교정</string> <string name="treatments_wizard_correction_label">교정</string>
<string name="treatments_wizard_unit_label">U</string> <string name="insulin_unit_shortname">U</string>
<string name="treatments_wizard_bolusiob_label">식사주입 IOB</string> <string name="treatments_wizard_bolusiob_label">식사주입 IOB</string>
<string name="openapsma_run">지금 실행</string> <string name="openapsma_run">지금 실행</string>
<string name="vitualpump_label">가상 펌프</string> <string name="vitualpump_label">가상 펌프</string>

View file

@ -347,7 +347,7 @@
<string name="nsclientinternal_autoscroll">Autoscroll</string> <string name="nsclientinternal_autoscroll">Autoscroll</string>
<string name="nsclientinternal_secret_dialogmessage">Geen NS API geheim op (min 12 kar.)</string> <string name="nsclientinternal_secret_dialogmessage">Geen NS API geheim op (min 12 kar.)</string>
<string name="treatmentssafety_maxbolus_title">Max toegestane bolus [E]</string> <string name="treatmentssafety_maxbolus_title">Max toegestane bolus [E]</string>
<string name="treatments_wizard_unit_label">E</string> <string name="insulin_unit_shortname">E</string>
<string name="treatments_wizard_correction_label">Correctie</string> <string name="treatments_wizard_correction_label">Correctie</string>
<string name="treatments_wizard_cob_label">COB</string> <string name="treatments_wizard_cob_label">COB</string>
<string name="treatments_wizard_carbs_label">Koolhydraten</string> <string name="treatments_wizard_carbs_label">Koolhydraten</string>

View file

@ -42,7 +42,7 @@
<string name="treatments_wizard_bg_label">BG</string> <string name="treatments_wizard_bg_label">BG</string>
<string name="treatments_wizard_carbs_label">Carbohidrați</string> <string name="treatments_wizard_carbs_label">Carbohidrați</string>
<string name="treatments_wizard_correction_label">Corecție</string> <string name="treatments_wizard_correction_label">Corecție</string>
<string name="treatments_wizard_unit_label">U</string> <string name="insulin_unit_shortname">U</string>
<string name="treatments_wizard_bolusiob_label">Bolus IOB</string> <string name="treatments_wizard_bolusiob_label">Bolus IOB</string>
<string name="openapsma_run">Fă acum</string> <string name="openapsma_run">Fă acum</string>
<string name="vitualpump_label">POMPĂ VIRTUALĂ</string> <string name="vitualpump_label">POMPĂ VIRTUALĂ</string>

View file

@ -482,7 +482,7 @@
<string name="treatments_wizard_carbs_label">углеводы</string> <string name="treatments_wizard_carbs_label">углеводы</string>
<string name="treatments_wizard_cob_label">активн углеводы</string> <string name="treatments_wizard_cob_label">активн углеводы</string>
<string name="treatments_wizard_correction_label">коррекция</string> <string name="treatments_wizard_correction_label">коррекция</string>
<string name="treatments_wizard_unit_label">ед</string> <string name="insulin_unit_shortname">ед</string>
<string name="treatmentssafety_maxbolus_title">макс разрешенный болюс</string> <string name="treatmentssafety_maxbolus_title">макс разрешенный болюс</string>
<string name="treatmentssafety_maxcarbs_title">макс разрешенные углеводы (г)</string> <string name="treatmentssafety_maxcarbs_title">макс разрешенные углеводы (г)</string>
<string name="treatmentssafety_title">безопасность назначений</string> <string name="treatmentssafety_title">безопасность назначений</string>

View file

@ -303,7 +303,7 @@
<string name="treatmentssafety_title">Säkerhet vid behandling</string> <string name="treatmentssafety_title">Säkerhet vid behandling</string>
<string name="treatmentssafety_maxcarbs_title">Max tillåtna KH (g)</string> <string name="treatmentssafety_maxcarbs_title">Max tillåtna KH (g)</string>
<string name="treatmentssafety_maxbolus_title">Max tillåten bolus [E]</string> <string name="treatmentssafety_maxbolus_title">Max tillåten bolus [E]</string>
<string name="treatments_wizard_unit_label">E</string> <string name="insulin_unit_shortname">E</string>
<string name="treatments_wizard_correction_label">Korr</string> <string name="treatments_wizard_correction_label">Korr</string>
<string name="treatments_wizard_cob_label">COB</string> <string name="treatments_wizard_cob_label">COB</string>
<string name="treatments_wizard_carbs_label">KH</string> <string name="treatments_wizard_carbs_label">KH</string>

View file

@ -42,7 +42,7 @@
<string name="treatments_wizard_tt_label">TT</string> <string name="treatments_wizard_tt_label">TT</string>
<string name="treatments_wizard_carbs_label">Carbs</string> <string name="treatments_wizard_carbs_label">Carbs</string>
<string name="treatments_wizard_correction_label">Corr</string> <string name="treatments_wizard_correction_label">Corr</string>
<string name="treatments_wizard_unit_label">U</string> <string name="insulin_unit_shortname">U</string>
<string name="treatments_wizard_bolusiob_label">Bolus IOB</string> <string name="treatments_wizard_bolusiob_label">Bolus IOB</string>
<string name="openapsma_run">Run now</string> <string name="openapsma_run">Run now</string>
<string name="vitualpump_label">VIRTUAL PUMP</string> <string name="vitualpump_label">VIRTUAL PUMP</string>
@ -641,8 +641,8 @@
<string name="mdtp_cancel">Cancel</string> <string name="mdtp_cancel">Cancel</string>
<string name="notloadedplugins">Not all profiles loaded!</string> <string name="notloadedplugins">Not all profiles loaded!</string>
<string name="valuesnotstored">Values not stored!</string> <string name="valuesnotstored">Values not stored!</string>
<string name="combopump">Accu-Chek Combo</string> <string name="combopump" translatable="false">Accu-Chek Combo</string>
<string name="combopump_shortname">COMBO</string> <string name="combopump_shortname" translatable="false">COMBO</string>
<string name="ns_localbroadcasts">Enable broadcasts to other apps (like xDrip).</string> <string name="ns_localbroadcasts">Enable broadcasts to other apps (like xDrip).</string>
<string name="ns_localbroadcasts_title">Enable local Broadcasts.</string> <string name="ns_localbroadcasts_title">Enable local Broadcasts.</string>
<string name="careportal_activity_label">ACTIVITY &amp; FEEDBACK</string> <string name="careportal_activity_label">ACTIVITY &amp; FEEDBACK</string>
@ -889,7 +889,7 @@
<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_temp_basal_run">Let current temp basal run</string> <string name="let_temp_basal_run">Let temp basal run</string>
<string name="mute">Mute</string> <string name="mute">Mute</string>
<string name="overview_insulin_label">Insulin</string> <string name="overview_insulin_label">Insulin</string>
<string name="overview_carbs_label">Carbs</string> <string name="overview_carbs_label">Carbs</string>
@ -962,5 +962,7 @@
<string name="profileswitch_ismissing">ProfileSwitch missing. Please do a profile switch or press \"Activate Profile\" in the LocalProfile.</string> <string name="profileswitch_ismissing">ProfileSwitch missing. Please do a profile switch or press \"Activate Profile\" in the LocalProfile.</string>
<string name="combo_bolus_count">Bolus count</string> <string name="combo_bolus_count">Bolus count</string>
<string name="combo_tbr_count">TBR count</string> <string name="combo_tbr_count">TBR count</string>
<string name="smb_frequency_exceeded">A bolus was delivered within the last 3 minutes, skipping SMB</string>
<string name="basal_set_correctly">Basal set correctly</string>
</resources> </resources>