From 1ef885b5fed8c55b019ee5bb8bf358fb2d4b45bd Mon Sep 17 00:00:00 2001 From: jbr7rr <> Date: Tue, 5 Sep 2023 16:34:18 +0200 Subject: [PATCH] Medtrum: Allow time for notifications to update sequence number before loadEvents() --- .../info/nightscout/pump/medtrum/services/MedtrumService.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pump/medtrum/src/main/java/info/nightscout/pump/medtrum/services/MedtrumService.kt b/pump/medtrum/src/main/java/info/nightscout/pump/medtrum/services/MedtrumService.kt index aa31cd1459..867ee5b1dd 100644 --- a/pump/medtrum/src/main/java/info/nightscout/pump/medtrum/services/MedtrumService.kt +++ b/pump/medtrum/src/main/java/info/nightscout/pump/medtrum/services/MedtrumService.kt @@ -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