Small cleanup and added some TODOs
This commit is contained in:
parent
59ad718969
commit
f37a2452fb
3 changed files with 10 additions and 7 deletions
|
@ -111,6 +111,8 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
||||||
|
|
||||||
// TODO make non-static just inject the Singleton and use a getter)
|
// TODO make non-static just inject the Singleton and use a getter)
|
||||||
public static boolean isBusy = false;
|
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 List<Long> busyTimestamps = new ArrayList<>();
|
||||||
protected boolean sentIdToFirebase = false;
|
protected boolean sentIdToFirebase = false;
|
||||||
protected boolean hasTimeDateOrTimeZoneChanged = false;
|
protected boolean hasTimeDateOrTimeZoneChanged = false;
|
||||||
|
@ -406,7 +408,7 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
||||||
|
|
||||||
if (isServiceSet()) {
|
if (isServiceSet()) {
|
||||||
|
|
||||||
if (isBusy || !podStateManager.isPodRunning() || podStateManager.hasFaultEvent())
|
if (isBusy || !podStateManager.isPodRunning())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (busyTimestamps.size() > 0) {
|
if (busyTimestamps.size() > 0) {
|
||||||
|
|
|
@ -368,11 +368,7 @@ public abstract class PodStateManager {
|
||||||
podState.setExpiresAt(expiresAtCalculated);
|
podState.setExpiresAt(expiresAtCalculated);
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean newSuspendedState = statusResponse.getDeliveryStatus() == DeliveryStatus.SUSPENDED;
|
podState.setSuspended(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.setActiveAlerts(statusResponse.getAlerts());
|
podState.setActiveAlerts(statusResponse.getAlerts());
|
||||||
podState.setLastDeliveryStatus(statusResponse.getDeliveryStatus());
|
podState.setLastDeliveryStatus(statusResponse.getDeliveryStatus());
|
||||||
podState.setReservoirLevel(statusResponse.getReservoirLevel());
|
podState.setReservoirLevel(statusResponse.getReservoirLevel());
|
||||||
|
|
|
@ -70,6 +70,8 @@ public class AapsPodStateManager extends PodStateManager {
|
||||||
omnipodPumpStatus.lastBolusTime = null;
|
omnipodPumpStatus.lastBolusTime = null;
|
||||||
omnipodPumpStatus.lastBolusAmount = null;
|
omnipodPumpStatus.lastBolusAmount = null;
|
||||||
omnipodPumpStatus.reservoirRemainingUnits = 0.0;
|
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;
|
omnipodPumpStatus.pumpStatusType = PumpStatusType.Suspended;
|
||||||
sendEvent(new EventRefreshOverview("Omnipod Pump", false));
|
sendEvent(new EventRefreshOverview("Omnipod Pump", false));
|
||||||
} else {
|
} else {
|
||||||
|
@ -77,7 +79,7 @@ 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() || !isPodRunning() || hasFaultEvent();
|
boolean suspended = isSuspended() || !isPodRunning();
|
||||||
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())
|
||||||
|
@ -85,7 +87,10 @@ public class AapsPodStateManager extends PodStateManager {
|
||||||
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 = suspended != PumpStatusType.Suspended.equals(omnipodPumpStatus.pumpStatusType);
|
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;
|
omnipodPumpStatus.pumpStatusType = suspended ? PumpStatusType.Suspended : PumpStatusType.Running;
|
||||||
|
|
||||||
if (sendRefreshOverviewEvent) {
|
if (sendRefreshOverviewEvent) {
|
||||||
|
|
Loading…
Reference in a new issue