Medtrum: Allow time for notifications to update sequence number

before loadEvents()
This commit is contained in:
jbr7rr 2023-09-05 16:34:18 +02:00
parent 06c1ab0ec3
commit 1ef885b5fe

View file

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