Small cleanup and added some TODOs
This commit is contained in:
parent
59ad718969
commit
f37a2452fb
|
@ -111,6 +111,8 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
|||
|
||||
// TODO make non-static just inject the Singleton and use a getter)
|
||||
public static boolean isBusy = false;
|
||||
// TODO it seems that we never add anything to this list?
|
||||
// I Wouldn't know why we need it anyway
|
||||
protected List<Long> busyTimestamps = new ArrayList<>();
|
||||
protected boolean sentIdToFirebase = false;
|
||||
protected boolean hasTimeDateOrTimeZoneChanged = false;
|
||||
|
@ -406,7 +408,7 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
|||
|
||||
if (isServiceSet()) {
|
||||
|
||||
if (isBusy || !podStateManager.isPodRunning() || podStateManager.hasFaultEvent())
|
||||
if (isBusy || !podStateManager.isPodRunning())
|
||||
return true;
|
||||
|
||||
if (busyTimestamps.size() > 0) {
|
||||
|
|
|
@ -368,11 +368,7 @@ public abstract class PodStateManager {
|
|||
podState.setExpiresAt(expiresAtCalculated);
|
||||
}
|
||||
|
||||
boolean newSuspendedState = statusResponse.getDeliveryStatus() == DeliveryStatus.SUSPENDED;
|
||||
if (podState.isSuspended() != newSuspendedState) {
|
||||
aapsLogger.info(LTag.PUMPCOMM, "Updating pod suspended state in updateFromStatusResponse. newSuspendedState={}, statusResponse={}", newSuspendedState, statusResponse.toString());
|
||||
podState.setSuspended(newSuspendedState);
|
||||
}
|
||||
podState.setSuspended(statusResponse.getDeliveryStatus() == DeliveryStatus.SUSPENDED);
|
||||
podState.setActiveAlerts(statusResponse.getAlerts());
|
||||
podState.setLastDeliveryStatus(statusResponse.getDeliveryStatus());
|
||||
podState.setReservoirLevel(statusResponse.getReservoirLevel());
|
||||
|
|
|
@ -70,6 +70,8 @@ public class AapsPodStateManager extends PodStateManager {
|
|||
omnipodPumpStatus.lastBolusTime = null;
|
||||
omnipodPumpStatus.lastBolusAmount = null;
|
||||
omnipodPumpStatus.reservoirRemainingUnits = 0.0;
|
||||
// TODO this does not seem to set the pump status to suspended anymore
|
||||
// Also, verify that AAPS is aware that no insulin is delivered anymore at this point
|
||||
omnipodPumpStatus.pumpStatusType = PumpStatusType.Suspended;
|
||||
sendEvent(new EventRefreshOverview("Omnipod Pump", false));
|
||||
} else {
|
||||
|
@ -77,7 +79,7 @@ public class AapsPodStateManager extends PodStateManager {
|
|||
Double lastBolusAmount = getLastBolusAmount();
|
||||
|
||||
// Update other info: last bolus, units remaining, suspended
|
||||
boolean suspended = isSuspended() || !isPodRunning() || hasFaultEvent();
|
||||
boolean suspended = isSuspended() || !isPodRunning();
|
||||
if (Objects.equals(lastBolusStartTime, omnipodPumpStatus.lastBolusTime) //
|
||||
|| !Objects.equals(lastBolusAmount, omnipodPumpStatus.lastBolusAmount) //
|
||||
|| !isReservoirStatusUpToDate(omnipodPumpStatus, getReservoirLevel())
|
||||
|
@ -85,7 +87,10 @@ public class AapsPodStateManager extends PodStateManager {
|
|||
omnipodPumpStatus.lastBolusTime = lastBolusStartTime;
|
||||
omnipodPumpStatus.lastBolusAmount = lastBolusAmount;
|
||||
omnipodPumpStatus.reservoirRemainingUnits = getReservoirLevel() == null ? 75.0 : getReservoirLevel();
|
||||
|
||||
boolean sendRefreshOverviewEvent = suspended != PumpStatusType.Suspended.equals(omnipodPumpStatus.pumpStatusType);
|
||||
// TODO this does not seem to set the pump status to suspended anymore
|
||||
// Also, verify that AAPS is aware that no insulin is delivered anymore at this point
|
||||
omnipodPumpStatus.pumpStatusType = suspended ? PumpStatusType.Suspended : PumpStatusType.Running;
|
||||
|
||||
if (sendRefreshOverviewEvent) {
|
||||
|
|
Loading…
Reference in a new issue