Fix crash in Omnipod Dash Pod activation
This commit is contained in:
parent
98dc2f92ef
commit
137908eb20
1 changed files with 20 additions and 8 deletions
|
@ -25,7 +25,9 @@ class OmnipodDashManagerImpl @Inject constructor(
|
||||||
private val bleManager: OmnipodDashBleManager,
|
private val bleManager: OmnipodDashBleManager,
|
||||||
private val aapsSchedulers: AapsSchedulers
|
private val aapsSchedulers: AapsSchedulers
|
||||||
) : OmnipodDashManager {
|
) : OmnipodDashManager {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
const val PRIME_BOLUS_DURATION_SECONDS = 35L
|
const val PRIME_BOLUS_DURATION_SECONDS = 35L
|
||||||
const val CANNULA_INSERTION_BOLUS_DURATION_SECONDS = 10L
|
const val CANNULA_INSERTION_BOLUS_DURATION_SECONDS = 10L
|
||||||
}
|
}
|
||||||
|
@ -221,14 +223,22 @@ 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(
|
Observable.timer(PRIME_BOLUS_DURATION_SECONDS, TimeUnit.SECONDS).flatMap { Observable.empty() })
|
||||||
podStateManager.firstPrimeBolusVolume!! * 0.05,
|
observables.add(
|
||||||
podStateManager.primePulseRate!!.toByte(),
|
Observable.defer {
|
||||||
confirmationBeeps = false,
|
bleManager.sendCommand(
|
||||||
completionBeeps = false
|
ProgramBolusCommand.Builder()
|
||||||
).doOnComplete(ActivationProgressUpdater(ActivationProgress.PRIMING))
|
.setUniqueId(podStateManager.uniqueId!!.toInt())
|
||||||
|
.setSequenceNumber(podStateManager.messageSequenceNumber)
|
||||||
|
.setNonce(1229869870) // TODO
|
||||||
|
.setNumberOfUnits(podStateManager.firstPrimeBolusVolume!! * 0.05)
|
||||||
|
.setDelayBetweenPulsesInEighthSeconds(podStateManager.primePulseRate!!.toByte())
|
||||||
|
.setProgramReminder(ProgramReminder(false, false, 0))
|
||||||
|
.build(),
|
||||||
|
DefaultStatusResponse::class
|
||||||
|
)
|
||||||
|
}.doOnComplete(ActivationProgressUpdater(ActivationProgress.PRIMING))
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
if (podStateManager.activationProgress.isBefore(ActivationProgress.REPROGRAMMED_LUMP_OF_COAL_ALERT)) {
|
if (podStateManager.activationProgress.isBefore(ActivationProgress.REPROGRAMMED_LUMP_OF_COAL_ALERT)) {
|
||||||
|
@ -311,7 +321,9 @@ 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(
|
||||||
|
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,
|
||||||
|
|
Loading…
Add table
Reference in a new issue