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
2 changed files with 9 additions and 2 deletions
|
@ -443,7 +443,7 @@ class MedtrumPump @Inject constructor(
|
||||||
|
|
||||||
fun setFakeTBRIfNeeded() {
|
fun setFakeTBRIfNeeded() {
|
||||||
val expectedTemporaryBasal = pumpSync.expectedPumpState().temporaryBasal
|
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()
|
setFakeTBR()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -243,7 +243,14 @@ class MedtrumViewModel @Inject constructor(
|
||||||
if (this.result.success) {
|
if (this.result.success) {
|
||||||
// Do nothing, state change will handle this
|
// Do nothing, state change will handle this
|
||||||
} else {
|
} else {
|
||||||
updateSetupStep(SetupStep.ERROR)
|
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