From a7d7f373deb2e424ee743bb9b8ec1dc21b3503f6 Mon Sep 17 00:00:00 2001 From: jbr7rr <> Date: Tue, 11 Jul 2023 14:54:40 +0200 Subject: [PATCH] Fix bolus not properly updating for short bolus --- .../pump/medtrum/services/MedtrumService.kt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) 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 643245978a..36566a22c0 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 @@ -276,13 +276,6 @@ class MedtrumService : DaggerService(), BLECommCallback { fun setBolus(detailedBolusInfo: DetailedBolusInfo, t: EventOverviewBolusProgress.Treatment): Boolean { if (!isConnected) return false val insulin = detailedBolusInfo.insulin - val result = sendPacketAndGetResponse(SetBolusPacket(injector, insulin)) - if (result == false) { - aapsLogger.error(LTag.PUMPCOMM, "Failed to set bolus") - commandQueue.loadEvents(null) // make sure if anything is delivered (which is highly unlikely at this point) we get it - return false - } - val bolusStart = System.currentTimeMillis() medtrumPump.bolusDone = false @@ -291,6 +284,13 @@ class MedtrumService : DaggerService(), BLECommCallback { medtrumPump.bolusStopped = false medtrumPump.bolusStopForced = false medtrumPump.bolusProgressLastTimeStamp = bolusStart + + val result = sendPacketAndGetResponse(SetBolusPacket(injector, insulin)) + if (result == false) { + aapsLogger.error(LTag.PUMPCOMM, "Failed to set bolus") + commandQueue.loadEvents(null) // make sure if anything is delivered (which is highly unlikely at this point) we get it + return false + } detailedBolusInfo.timestamp = bolusStart // Make sure the timestamp is set to the start of the bolus detailedBolusInfoStorage.add(detailedBolusInfo) // will be picked up on reading history