Actually cancel TBR
This commit is contained in:
parent
dba9fa7a73
commit
88fbacf036
|
@ -524,10 +524,10 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
|
||||||
}
|
}
|
||||||
|
|
||||||
private PumpEnactResult getPodStatus() {
|
private PumpEnactResult getPodStatus() {
|
||||||
PumpEnactResult result = executeCommand(OmnipodCommandType.GET_POD_STATUS, aapsOmnipodManager::getPodStatus);
|
PumpEnactResult getStatusResult = executeCommand(OmnipodCommandType.GET_POD_STATUS, aapsOmnipodManager::getPodStatus);
|
||||||
|
|
||||||
// bit hacky...
|
// bit hacky...
|
||||||
if (result.success && !activePlugin.getActiveTreatments().isTempBasalInProgress() && podStateManager.isTempBasalRunning()) {
|
if (getStatusResult.success && !activePlugin.getActiveTreatments().isTempBasalInProgress() && podStateManager.isTempBasalRunning()) {
|
||||||
if (podStateManager.hasTempBasal()) {
|
if (podStateManager.hasTempBasal()) {
|
||||||
aapsLogger.warn(LTag.PUMP, "Registering TBR that AAPS was unaware of");
|
aapsLogger.warn(LTag.PUMP, "Registering TBR that AAPS was unaware of");
|
||||||
|
|
||||||
|
@ -546,20 +546,17 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
|
||||||
// Not sure what's going on. Cancel TBR on the Pod
|
// Not sure what's going on. Cancel TBR on the Pod
|
||||||
aapsLogger.warn(LTag.PUMP, "Cancelling TBR because AAPS is not aware of any running TBR");
|
aapsLogger.warn(LTag.PUMP, "Cancelling TBR because AAPS is not aware of any running TBR");
|
||||||
|
|
||||||
getCommandQueue().cancelTempBasal(true, new Callback() {
|
PumpEnactResult cancelTbrResult = executeCommand(OmnipodCommandType.CANCEL_TEMPORARY_BASAL, aapsOmnipodManager::cancelTemporaryBasal);
|
||||||
@Override public void run() {
|
if (cancelTbrResult.success) {
|
||||||
if (result.success) {
|
aapsLogger.info(LTag.PUMP, "Successfully cancelled TBR because AAPS was not aware of any running TBR");
|
||||||
aapsLogger.info(LTag.PUMP, "Successfully cancelled TBR because AAPS was not aware of any running TBR");
|
} else {
|
||||||
} else {
|
aapsLogger.error(LTag.PUMP, "Failed to cancel TBR because AAPS was not aware of any running TBR");
|
||||||
aapsLogger.error(LTag.PUMP, "Failed to cancel TBR because AAPS was not aware of any running TBR");
|
rxBus.send(new EventNewNotification(new Notification(Notification.OMNIPOD_PUMP_ALARM, resourceHelper.gs(R.string.omnipod_error_tbr_running_but_aaps_not_aware), Notification.NORMAL).sound(R.raw.boluserror)));
|
||||||
rxBus.send(new EventNewNotification(new Notification(Notification.OMNIPOD_PUMP_ALARM, resourceHelper.gs(R.string.omnipod_error_tbr_running_but_aaps_not_aware), Notification.NORMAL).sound(R.raw.boluserror)));
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return getStatusResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
|
|
Loading…
Reference in a new issue