diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicPumpPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicPumpPlugin.java index 064ad3b1e0..1e46fecf61 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicPumpPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicPumpPlugin.java @@ -791,6 +791,17 @@ public class MedtronicPumpPlugin extends PumpPluginAbstract implements PumpInter setRefreshButtonEnabled(false); + MedtronicPumpStatus mdtPumpStatus = getMDTPumpStatus(); + + if (detailedBolusInfo.insulin > mdtPumpStatus.reservoirRemainingUnits) { + return new PumpEnactResult() // + .success(false) // + .enacted(false) // + .comment(MainApp.gs(R.string.medtronic_cmd_bolus_could_not_be_delivered_no_insulin, + mdtPumpStatus.reservoirRemainingUnits, + detailedBolusInfo.insulin)); + } + bolusDeliveryType = BolusDeliveryType.DeliveryPrepared; if (isPumpNotReachable()) { diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 0c03b2d54b..c2cf9a9c0f 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1637,6 +1637,7 @@ Could not cancel current TBR. Stopping operation. Profile set failed, because following patterns, have too big basal rate: %1$s Bolus could not be delivered. + Bolus could not be delivered, because available amount (%1$d) is less than Bolus required (%2$d). TBR could not be set. Could not cancel current TBR. Basal profile could not be set.