Set pump driver to busy and set state to suspended when Pod has a fault event

This commit is contained in:
Bart Sopers 2020-08-11 13:10:00 +02:00
parent 1ba9244ecd
commit 84ce2d1790
2 changed files with 5 additions and 4 deletions

View file

@ -407,7 +407,7 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
if (isServiceSet()) { if (isServiceSet()) {
if (isBusy || !podStateManager.isSetupCompleted()) if (isBusy || !podStateManager.isSetupCompleted() || podStateManager.hasFaultEvent())
return true; return true;
if (busyTimestamps.size() > 0) { if (busyTimestamps.size() > 0) {

View file

@ -105,15 +105,16 @@ public class AapsPodStateManager extends PodStateManager {
Double lastBolusAmount = getLastBolusAmount(); Double lastBolusAmount = getLastBolusAmount();
// Update other info: last bolus, units remaining, suspended // Update other info: last bolus, units remaining, suspended
boolean suspended = isSuspended() || !isSetupCompleted() || hasFaultEvent();
if (Objects.equals(lastBolusStartTime, omnipodPumpStatus.lastBolusTime) // if (Objects.equals(lastBolusStartTime, omnipodPumpStatus.lastBolusTime) //
|| !Objects.equals(lastBolusAmount, omnipodPumpStatus.lastBolusAmount) // || !Objects.equals(lastBolusAmount, omnipodPumpStatus.lastBolusAmount) //
|| !isReservoirStatusUpToDate(omnipodPumpStatus, getReservoirLevel()) || !isReservoirStatusUpToDate(omnipodPumpStatus, getReservoirLevel())
|| isSuspended() != PumpStatusType.Suspended.equals(omnipodPumpStatus.pumpStatusType)) { || suspended != PumpStatusType.Suspended.equals(omnipodPumpStatus.pumpStatusType)) {
omnipodPumpStatus.lastBolusTime = lastBolusStartTime; omnipodPumpStatus.lastBolusTime = lastBolusStartTime;
omnipodPumpStatus.lastBolusAmount = lastBolusAmount; omnipodPumpStatus.lastBolusAmount = lastBolusAmount;
omnipodPumpStatus.reservoirRemainingUnits = getReservoirLevel() == null ? 75.0 : getReservoirLevel(); omnipodPumpStatus.reservoirRemainingUnits = getReservoirLevel() == null ? 75.0 : getReservoirLevel();
boolean sendRefreshOverviewEvent = isSuspended() != PumpStatusType.Suspended.equals(omnipodPumpStatus.pumpStatusType); boolean sendRefreshOverviewEvent = suspended != PumpStatusType.Suspended.equals(omnipodPumpStatus.pumpStatusType);
omnipodPumpStatus.pumpStatusType = isSuspended() ? PumpStatusType.Suspended : PumpStatusType.Running; omnipodPumpStatus.pumpStatusType = suspended ? PumpStatusType.Suspended : PumpStatusType.Running;
if (sendRefreshOverviewEvent) { if (sendRefreshOverviewEvent) {
sendEvent(new EventRefreshOverview("Omnipod Pump", false)); sendEvent(new EventRefreshOverview("Omnipod Pump", false));