Rx drivers: set new TBR if running is expiring

This commit is contained in:
Milos Kozak 2019-07-28 01:37:44 +02:00
parent f58a219d2d
commit 74bcf3e73e
3 changed files with 6 additions and 6 deletions

View file

@ -194,8 +194,8 @@ public abstract class AbstractDanaRPlugin extends PluginBase implements PumpInte
if (percent > getPumpDescription().maxTempPercent) if (percent > getPumpDescription().maxTempPercent)
percent = getPumpDescription().maxTempPercent; percent = getPumpDescription().maxTempPercent;
long now = System.currentTimeMillis(); long now = System.currentTimeMillis();
TemporaryBasal runningTB = TreatmentsPlugin.getPlugin().getRealTempBasalFromHistory(now); TemporaryBasal activeTemp = TreatmentsPlugin.getPlugin().getRealTempBasalFromHistory(now);
if (runningTB != null && runningTB.percentRate == percent && !enforceNew) { if (activeTemp != null && activeTemp.percentRate == percent && activeTemp.getPlannedRemainingMinutes() > 4 && !enforceNew) {
result.enacted = false; result.enacted = false;
result.success = true; result.success = true;
result.isTempCancel = false; result.isTempCancel = false;

View file

@ -549,8 +549,8 @@ public class DanaRSPlugin extends PluginBase implements PumpInterface, DanaRInte
if (percent > getPumpDescription().maxTempPercent) if (percent > getPumpDescription().maxTempPercent)
percent = getPumpDescription().maxTempPercent; percent = getPumpDescription().maxTempPercent;
long now = System.currentTimeMillis(); long now = System.currentTimeMillis();
TemporaryBasal runningTB = TreatmentsPlugin.getPlugin().getTempBasalFromHistory(now); TemporaryBasal activeTemp = TreatmentsPlugin.getPlugin().getTempBasalFromHistory(now);
if (runningTB != null && runningTB.percentRate == percent && !enforceNew) { if (activeTemp != null && activeTemp.percentRate == percent && activeTemp.getPlannedRemainingMinutes() > 4 && !enforceNew) {
result.enacted = false; result.enacted = false;
result.success = true; result.success = true;
result.isTempCancel = false; result.isTempCancel = false;

View file

@ -292,8 +292,8 @@ public class DanaRv2Plugin extends AbstractDanaRPlugin {
if (percent > getPumpDescription().maxTempPercent) if (percent > getPumpDescription().maxTempPercent)
percent = getPumpDescription().maxTempPercent; percent = getPumpDescription().maxTempPercent;
long now = System.currentTimeMillis(); long now = System.currentTimeMillis();
TemporaryBasal runningTB = TreatmentsPlugin.getPlugin().getRealTempBasalFromHistory(now); TemporaryBasal activeTemp = TreatmentsPlugin.getPlugin().getRealTempBasalFromHistory(now);
if (runningTB != null && runningTB.percentRate == percent && !enforceNew) { if (activeTemp != null && activeTemp.percentRate == percent && activeTemp.getPlannedRemainingMinutes() > 4 && !enforceNew) {
result.enacted = false; result.enacted = false;
result.success = true; result.success = true;
result.isTempCancel = false; result.isTempCancel = false;