Add delay for prime and cannula insertion for Omnipod Dash

This commit is contained in:
Bart Sopers 2021-03-14 22:39:07 +01:00
parent 1872e1ceb7
commit 98dc2f92ef

View file

@ -25,6 +25,10 @@ class OmnipodDashManagerImpl @Inject constructor(
private val bleManager: OmnipodDashBleManager, private val bleManager: OmnipodDashBleManager,
private val aapsSchedulers: AapsSchedulers private val aapsSchedulers: AapsSchedulers
) : OmnipodDashManager { ) : OmnipodDashManager {
companion object {
const val PRIME_BOLUS_DURATION_SECONDS = 35L
const val CANNULA_INSERTION_BOLUS_DURATION_SECONDS = 10L
}
private val observePodReadyForActivationPart1: Observable<PodEvent> private val observePodReadyForActivationPart1: Observable<PodEvent>
get() = Observable.defer { get() = Observable.defer {
@ -217,6 +221,7 @@ class OmnipodDashManagerImpl @Inject constructor(
) )
} }
if (podStateManager.activationProgress.isBefore(ActivationProgress.PRIMING)) { if (podStateManager.activationProgress.isBefore(ActivationProgress.PRIMING)) {
observables.add(Observable.timer(PRIME_BOLUS_DURATION_SECONDS, TimeUnit.SECONDS).flatMap { Observable.empty() })
observables.add( observables.add(
observeSendProgramBolusCommand( observeSendProgramBolusCommand(
podStateManager.firstPrimeBolusVolume!! * 0.05, podStateManager.firstPrimeBolusVolume!! * 0.05,
@ -306,6 +311,7 @@ class OmnipodDashManagerImpl @Inject constructor(
) )
} }
if (podStateManager.activationProgress.isBefore(ActivationProgress.INSERTING_CANNULA)) { if (podStateManager.activationProgress.isBefore(ActivationProgress.INSERTING_CANNULA)) {
observables.add(Observable.timer(CANNULA_INSERTION_BOLUS_DURATION_SECONDS, TimeUnit.SECONDS).flatMap { Observable.empty() })
observables.add( observables.add(
observeSendProgramBolusCommand( observeSendProgramBolusCommand(
podStateManager.secondPrimeBolusVolume!! * 0.05, podStateManager.secondPrimeBolusVolume!! * 0.05,