fix deactivation
This commit is contained in:
parent
42daad43f4
commit
c68491ba78
1 changed files with 21 additions and 18 deletions
|
@ -310,8 +310,8 @@ class OmnipodDashPumpPlugin @Inject constructor(
|
||||||
)
|
)
|
||||||
|
|
||||||
private fun checkPodKaput(): Completable = Completable.defer {
|
private fun checkPodKaput(): Completable = Completable.defer {
|
||||||
val tbr = pumpSync.expectedPumpState().temporaryBasal
|
|
||||||
if (podStateManager.isPodKaput) {
|
if (podStateManager.isPodKaput) {
|
||||||
|
val tbr = pumpSync.expectedPumpState().temporaryBasal
|
||||||
if (tbr == null || tbr.rate != 0.0) {
|
if (tbr == null || tbr.rate != 0.0) {
|
||||||
pumpSync.syncTemporaryBasalWithPumpId(
|
pumpSync.syncTemporaryBasalWithPumpId(
|
||||||
timestamp = System.currentTimeMillis(),
|
timestamp = System.currentTimeMillis(),
|
||||||
|
@ -340,20 +340,23 @@ class OmnipodDashPumpPlugin @Inject constructor(
|
||||||
aapsLogger.info(LTag.PUMP, "syncBolusWithPumpId on CANCEL_BOLUS returned: $sync")
|
aapsLogger.info(LTag.PUMP, "syncBolusWithPumpId on CANCEL_BOLUS returned: $sync")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
showNotification(
|
|
||||||
Notification.OMNIPOD_POD_FAULT,
|
podStateManager.alarmType?.let {
|
||||||
podStateManager.alarmType.toString(),
|
showNotification(
|
||||||
Notification.URGENT,
|
Notification.OMNIPOD_POD_FAULT,
|
||||||
R.raw.boluserror
|
it.toString(),
|
||||||
)
|
Notification.URGENT,
|
||||||
if (!podStateManager.alarmSynced) {
|
R.raw.boluserror
|
||||||
pumpSync.insertAnnouncement(
|
|
||||||
error = podStateManager.alarmType?.toString() ?: "Unknown pod failure",
|
|
||||||
pumpId = Random.Default.nextLong(),
|
|
||||||
pumpType = PumpType.OMNIPOD_DASH,
|
|
||||||
pumpSerial = serialNumber()
|
|
||||||
)
|
)
|
||||||
podStateManager.alarmSynced = true
|
if (!podStateManager.alarmSynced) {
|
||||||
|
pumpSync.insertAnnouncement(
|
||||||
|
error = it.toString(),
|
||||||
|
pumpId = Random.Default.nextLong(),
|
||||||
|
pumpType = PumpType.OMNIPOD_DASH,
|
||||||
|
pumpSerial = serialNumber()
|
||||||
|
)
|
||||||
|
podStateManager.alarmSynced = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Completable.complete()
|
Completable.complete()
|
||||||
|
@ -1165,14 +1168,14 @@ class OmnipodDashPumpPlugin @Inject constructor(
|
||||||
val ret = executeProgrammingCommand(
|
val ret = executeProgrammingCommand(
|
||||||
historyEntry = history.createRecord(OmnipodCommandType.DEACTIVATE_POD),
|
historyEntry = history.createRecord(OmnipodCommandType.DEACTIVATE_POD),
|
||||||
command = omnipodManager.deactivatePod().ignoreElements(),
|
command = omnipodManager.deactivatePod().ignoreElements(),
|
||||||
checkNoActiveCommand = false,
|
checkNoActiveCommand = false
|
||||||
post = createFakeTBRWhenNoActivePod(),
|
|
||||||
).doOnComplete {
|
).doOnComplete {
|
||||||
if (podStateManager.activeCommand != null) {
|
if (podStateManager.activeCommand != null) {
|
||||||
success = false
|
success = false
|
||||||
|
} else {
|
||||||
|
podStateManager.reset()
|
||||||
|
rxBus.send(EventDismissNotification(Notification.OMNIPOD_POD_FAULT))
|
||||||
}
|
}
|
||||||
podStateManager.reset()
|
|
||||||
rxBus.send(EventDismissNotification(Notification.OMNIPOD_POD_FAULT))
|
|
||||||
}.toPumpEnactResult()
|
}.toPumpEnactResult()
|
||||||
if (!success) {
|
if (!success) {
|
||||||
ret.success(false)
|
ret.success(false)
|
||||||
|
|
Loading…
Reference in a new issue