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) {
|
if (medtrumPump.tempBasalInProgress) {
|
||||||
result = sendPacketAndGetResponse(CancelTempBasalPacket(injector))
|
result = sendPacketAndGetResponse(CancelTempBasalPacket(injector))
|
||||||
}
|
}
|
||||||
|
// Make sure we have all events of this patch if possible
|
||||||
|
loadEvents()
|
||||||
if (result) result = sendPacketAndGetResponse(StopPatchPacket(injector))
|
if (result) result = sendPacketAndGetResponse(StopPatchPacket(injector))
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package info.nightscout.pump.medtrum.ui.viewmodel
|
package info.nightscout.pump.medtrum.ui.viewmodel
|
||||||
|
|
||||||
|
import android.os.SystemClock
|
||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import info.nightscout.interfaces.queue.Callback
|
import info.nightscout.interfaces.queue.Callback
|
||||||
|
@ -255,6 +256,8 @@ class MedtrumViewModel @Inject constructor(
|
||||||
if (medtrumPump.pumpState >= MedtrumPumpState.OCCLUSION && medtrumPump.pumpState <= MedtrumPumpState.NO_CALIBRATION) {
|
if (medtrumPump.pumpState >= MedtrumPumpState.OCCLUSION && medtrumPump.pumpState <= MedtrumPumpState.NO_CALIBRATION) {
|
||||||
// We are in a fault state, we need to force deactivation
|
// We are in a fault state, we need to force deactivation
|
||||||
aapsLogger.info(LTag.PUMP, "deactivatePatch: force deactivation")
|
aapsLogger.info(LTag.PUMP, "deactivatePatch: force deactivation")
|
||||||
|
medtrumService?.disconnect("ForceDeactivation")
|
||||||
|
SystemClock.sleep(1000)
|
||||||
medtrumPump.pumpState = MedtrumPumpState.STOPPED
|
medtrumPump.pumpState = MedtrumPumpState.STOPPED
|
||||||
} else {
|
} else {
|
||||||
aapsLogger.info(LTag.PUMP, "deactivatePatch: failure!")
|
aapsLogger.info(LTag.PUMP, "deactivatePatch: failure!")
|
||||||
|
|
Loading…
Reference in a new issue