From 345ae0f9b2a0f1b715583a0640c5f5e5221114e1 Mon Sep 17 00:00:00 2001 From: jbr7rr <> Date: Tue, 27 Jun 2023 13:27:21 +0200 Subject: [PATCH] Early return on setBolus failure --- .../info/nightscout/pump/medtrum/services/MedtrumService.kt | 5 +++++ 1 file changed, 5 insertions(+) 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 7856008f6e..b3d57110b3 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 @@ -286,6 +286,11 @@ class MedtrumService : DaggerService(), BLECommCallback { 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()