disconnect on force deactivation when pump in error state
This commit is contained in:
parent
826b0f3d8c
commit
30c1c16cd0
2 changed files with 5 additions and 0 deletions
|
@ -187,6 +187,8 @@ class MedtrumService : DaggerService(), BLECommCallback {
|
|||
if (medtrumPump.tempBasalInProgress) {
|
||||
result = sendPacketAndGetResponse(CancelTempBasalPacket(injector))
|
||||
}
|
||||
// Make sure we have all events of this patch if possible
|
||||
loadEvents()
|
||||
if (result) result = sendPacketAndGetResponse(StopPatchPacket(injector))
|
||||
return result
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package info.nightscout.pump.medtrum.ui.viewmodel
|
||||
|
||||
import android.os.SystemClock
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import info.nightscout.interfaces.queue.Callback
|
||||
|
@ -255,6 +256,8 @@ class MedtrumViewModel @Inject constructor(
|
|||
if (medtrumPump.pumpState >= MedtrumPumpState.OCCLUSION && medtrumPump.pumpState <= MedtrumPumpState.NO_CALIBRATION) {
|
||||
// We are in a fault state, we need to force deactivation
|
||||
aapsLogger.info(LTag.PUMP, "deactivatePatch: force deactivation")
|
||||
medtrumService?.disconnect("ForceDeactivation")
|
||||
SystemClock.sleep(1000)
|
||||
medtrumPump.pumpState = MedtrumPumpState.STOPPED
|
||||
} else {
|
||||
aapsLogger.info(LTag.PUMP, "deactivatePatch: failure!")
|
||||
|
|
Loading…
Reference in a new issue