Merge pull request #2742 from jbr7rr/medtrum-fixes

Medtrum: Allow time for notifications to update sequence number
This commit is contained in:
Milos Kozak 2023-09-05 21:50:53 +02:00 committed by GitHub
commit 89ad5f18b2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -373,11 +373,14 @@ class MedtrumService : DaggerService(), BLECommCallback {
bolusingEvent.percent = 99 bolusingEvent.percent = 99
val bolusDurationInMSec = (insulin * 60 * 1000) val bolusDurationInMSec = (insulin * 60 * 1000)
val expectedEnd = bolusStart + bolusDurationInMSec + 2000 val expectedEnd = bolusStart + bolusDurationInMSec + 1000
while (System.currentTimeMillis() < expectedEnd && !medtrumPump.bolusDone) { while (System.currentTimeMillis() < expectedEnd && !medtrumPump.bolusDone) {
SystemClock.sleep(1000) SystemClock.sleep(1000)
} }
// Allow time for notification packet with new sequnce number to arrive
SystemClock.sleep(2000)
bolusingEvent.t = medtrumPump.bolusingTreatment bolusingEvent.t = medtrumPump.bolusingTreatment
medtrumPump.bolusingTreatment = null medtrumPump.bolusingTreatment = null