- trying to fix problem with exception

This commit is contained in:
Andy Rozman 2020-01-12 12:42:10 +01:00
parent be88aa69f1
commit c336ceba33
2 changed files with 4 additions and 2 deletions

View file

@ -105,6 +105,8 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
private Profile currentProfile; private Profile currentProfile;
boolean omnipodServiceRunning = false;
private long nextPodCheck = 0L; private long nextPodCheck = 0L;
private static long UNREACHABLE_ALERT_THRESHOLD_MILLIS = T.mins(30).msecs(); private static long UNREACHABLE_ALERT_THRESHOLD_MILLIS = T.mins(30).msecs();
@ -152,6 +154,7 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
if (omnipodCommunicationManager == null) { if (omnipodCommunicationManager == null) {
omnipodCommunicationManager = AapsOmnipodManager.getInstance(); omnipodCommunicationManager = AapsOmnipodManager.getInstance();
omnipodCommunicationManager.setPumpStatus(pumpStatusLocal); omnipodCommunicationManager.setPumpStatus(pumpStatusLocal);
omnipodServiceRunning = true;
} else { } else {
omnipodCommunicationManager.setPumpStatus(pumpStatusLocal); omnipodCommunicationManager.setPumpStatus(pumpStatusLocal);
} }
@ -278,7 +281,7 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
private void doPodCheck() { private void doPodCheck() {
if (System.currentTimeMillis() > this.nextPodCheck) { if (System.currentTimeMillis() > this.nextPodCheck) {
if (!getPodPumpStatusObject().podAvailable && getPodPumpStatusObject().podAvailibityChecked) { if (!getPodPumpStatusObject().podAvailable && omnipodServiceRunning) {
Notification notification = new Notification(Notification.OMNIPOD_POD_NOT_ATTACHED, MainApp.gs(R.string.omnipod_error_pod_not_attached), Notification.NORMAL); Notification notification = new Notification(Notification.OMNIPOD_POD_NOT_ATTACHED, MainApp.gs(R.string.omnipod_error_pod_not_attached), Notification.NORMAL);
RxBus.INSTANCE.send(new EventNewNotification(notification)); RxBus.INSTANCE.send(new EventNewNotification(notification));
} else { } else {

View file

@ -128,7 +128,6 @@ public class RileyLinkOmnipodService extends RileyLinkService {
} }
OmnipodCommunicationService omnipodCommunicationService = new OmnipodCommunicationService(rfspy); OmnipodCommunicationService omnipodCommunicationService = new OmnipodCommunicationService(rfspy);
omnipodCommunicationService.setPumpStatus(pumpStatus); omnipodCommunicationService.setPumpStatus(pumpStatus);
pumpStatus.podAvailibityChecked = true;
omnipodCommunicationManager = new AapsOmnipodManager(omnipodCommunicationService, podState, pumpStatus); omnipodCommunicationManager = new AapsOmnipodManager(omnipodCommunicationService, podState, pumpStatus);
} else { } else {