Minor fixes;
Allow set of fake TBR when 0 temp is already running, Automatically force deactivation when patch is in error state
This commit is contained in:
parent
93dee4eb3c
commit
f52726128a
|
@ -443,7 +443,7 @@ class MedtrumPump @Inject constructor(
|
|||
|
||||
fun setFakeTBRIfNeeded() {
|
||||
val expectedTemporaryBasal = pumpSync.expectedPumpState().temporaryBasal
|
||||
if (expectedTemporaryBasal?.rate != 0.0 && expectedTemporaryBasal?.duration != T.mins(FAKE_TBR_LENGTH).msecs()) {
|
||||
if (expectedTemporaryBasal?.duration != T.mins(FAKE_TBR_LENGTH).msecs()) {
|
||||
setFakeTBR()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -243,9 +243,16 @@ class MedtrumViewModel @Inject constructor(
|
|||
if (this.result.success) {
|
||||
// Do nothing, state change will handle this
|
||||
} else {
|
||||
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")
|
||||
medtrumPump.pumpState = MedtrumPumpState.STOPPED
|
||||
} else {
|
||||
aapsLogger.info(LTag.PUMP, "deactivatePatch: failure!")
|
||||
updateSetupStep(SetupStep.ERROR)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue