Fix for some TBR cancels getting through
This commit is contained in:
parent
8e2fe7eaec
commit
501ca5c597
2 changed files with 22 additions and 9 deletions
|
@ -499,6 +499,12 @@ public class InsightPumpPlugin implements PluginBase, PumpInterface, Constraints
|
||||||
@Override
|
@Override
|
||||||
public PumpEnactResult setTempBasalPercent(Integer percent, Integer durationInMinutes, boolean enforceNew) {
|
public PumpEnactResult setTempBasalPercent(Integer percent, Integer durationInMinutes, boolean enforceNew) {
|
||||||
log("Set TBR %");
|
log("Set TBR %");
|
||||||
|
|
||||||
|
if (percent == 100) {
|
||||||
|
// This would cause a cancel if a tbr is in progress so treat as a cancel
|
||||||
|
return cancelTempBasal(false);
|
||||||
|
}
|
||||||
|
|
||||||
final UUID cmd = aSyncTaskRunner(new SetTBRTaskRunner(connector.getServiceConnector(), percent, durationInMinutes), "Set TBR " + percent + "%" + " " + durationInMinutes + "m");
|
final UUID cmd = aSyncTaskRunner(new SetTBRTaskRunner(connector.getServiceConnector(), percent, durationInMinutes), "Set TBR " + percent + "%" + " " + durationInMinutes + "m");
|
||||||
|
|
||||||
if (cmd == null) {
|
if (cmd == null) {
|
||||||
|
@ -787,12 +793,15 @@ public class InsightPumpPlugin implements PluginBase, PumpInterface, Constraints
|
||||||
(batteryPercent < 70 ?
|
(batteryPercent < 70 ?
|
||||||
(StatusItem.Highlight.BAD) : StatusItem.Highlight.NOTICE) : StatusItem.Highlight.NORMAL) : StatusItem.Highlight.GOOD));
|
(StatusItem.Highlight.BAD) : StatusItem.Highlight.NOTICE) : StatusItem.Highlight.NORMAL) : StatusItem.Highlight.GOOD));
|
||||||
l.add(new StatusItem(gs(R.string.pump_reservoir_label), reservoirInUnits + "U"));
|
l.add(new StatusItem(gs(R.string.pump_reservoir_label), reservoirInUnits + "U"));
|
||||||
|
try {
|
||||||
if (statusResult.getCurrentTBRMessage().getPercentage() != 100) {
|
if (statusResult.getCurrentTBRMessage().getPercentage() != 100) {
|
||||||
l.add(new StatusItem(gs(R.string.insight_active_tbr), statusResult.getCurrentTBRMessage().getPercentage() + "% " + gs(R.string.with) + " "
|
l.add(new StatusItem(gs(R.string.insight_active_tbr), statusResult.getCurrentTBRMessage().getPercentage() + "% " + gs(R.string.with) + " "
|
||||||
+ Helpers.qs(statusResult.getCurrentTBRMessage().getLeftoverTime() - offset_minutes, 0)
|
+ Helpers.qs(statusResult.getCurrentTBRMessage().getLeftoverTime() - offset_minutes, 0)
|
||||||
+ " " + gs(R.string.insight_min_left), StatusItem.Highlight.NOTICE));
|
+ " " + gs(R.string.insight_min_left), StatusItem.Highlight.NOTICE));
|
||||||
}
|
}
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
// currentTBRMessage may be null
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -805,9 +814,13 @@ public class InsightPumpPlugin implements PluginBase, PumpInterface, Constraints
|
||||||
}
|
}
|
||||||
|
|
||||||
if (statusResult != null) {
|
if (statusResult != null) {
|
||||||
|
try {
|
||||||
statusActiveBolus(statusResult.getActiveBolusesMessage().getBolus1(), offset_minutes, l);
|
statusActiveBolus(statusResult.getActiveBolusesMessage().getBolus1(), offset_minutes, l);
|
||||||
statusActiveBolus(statusResult.getActiveBolusesMessage().getBolus2(), offset_minutes, l);
|
statusActiveBolus(statusResult.getActiveBolusesMessage().getBolus2(), offset_minutes, l);
|
||||||
statusActiveBolus(statusResult.getActiveBolusesMessage().getBolus3(), offset_minutes, l);
|
statusActiveBolus(statusResult.getActiveBolusesMessage().getBolus3(), offset_minutes, l);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
// getActiveBolusesMessage() may be null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MainApp.getConfigBuilder().isInHistoryExtendedBoluslInProgress()) {
|
if (MainApp.getConfigBuilder().isInHistoryExtendedBoluslInProgress()) {
|
||||||
|
|
|
@ -18,7 +18,7 @@ class Mstatus {
|
||||||
if (success()) {
|
if (success()) {
|
||||||
return "OK";
|
return "OK";
|
||||||
} else {
|
} else {
|
||||||
return (event == null) ? "EVENT IS NULL" : event.message;
|
return (event == null) ? "EVENT DATA IS NULL - ERROR OR FIREWALL ENABLED?" : event.message;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue