prevent 049 pod fault

This commit is contained in:
Andrei Vereha 2022-01-21 23:31:23 +01:00
parent b2f1684aaf
commit 11687eaf02
2 changed files with 17 additions and 7 deletions

View file

@ -546,12 +546,6 @@ class OmnipodDashPumpPlugin @Inject constructor(
try { try {
bolusDeliveryInProgress = true bolusDeliveryInProgress = true
aapsLogger.info(LTag.PUMP, "Delivering treatment: $detailedBolusInfo $bolusCanceled") aapsLogger.info(LTag.PUMP, "Delivering treatment: $detailedBolusInfo $bolusCanceled")
val beepsConfigurationKey = if (detailedBolusInfo.bolusType == DetailedBolusInfo.BolusType.SMB)
R.string.key_omnipod_common_smb_beeps_enabled
else
R.string.key_omnipod_common_bolus_beeps_enabled
val bolusBeeps = sp.getBoolean(beepsConfigurationKey, false)
R.string.key_omnipod_common_smb_beeps_enabled
if (detailedBolusInfo.carbs > 0 || if (detailedBolusInfo.carbs > 0 ||
detailedBolusInfo.insulin == 0.0 detailedBolusInfo.insulin == 0.0
) { ) {
@ -568,10 +562,24 @@ class OmnipodDashPumpPlugin @Inject constructor(
.success(false) .success(false)
.enacted(false) .enacted(false)
.bolusDelivered(0.0) .bolusDelivered(0.0)
.comment("Not enough insulin in the reservoir") .comment(rh.gs(R.string.omnipod_dash_not_enough_insulin))
} }
if (podStateManager.deliveryStatus == DeliveryStatus.BOLUS_AND_BASAL_ACTIVE ||
podStateManager.deliveryStatus == DeliveryStatus.BOLUS_AND_TEMP_BASAL_ACTIVE) {
return PumpEnactResult(injector)
.success(false)
.enacted(false)
.bolusDelivered(0.0)
.comment(rh.gs(R.string.omnipod_dash_bolus_already_in_progress))
}
var deliveredBolusAmount = 0.0 var deliveredBolusAmount = 0.0
val beepsConfigurationKey = if (detailedBolusInfo.bolusType == DetailedBolusInfo.BolusType.SMB)
R.string.key_omnipod_common_smb_beeps_enabled
else
R.string.key_omnipod_common_bolus_beeps_enabled
val bolusBeeps = sp.getBoolean(beepsConfigurationKey, false)
aapsLogger.info( aapsLogger.info(
LTag.PUMP, LTag.PUMP,
"deliverTreatment: requestedBolusAmount=$requestedBolusAmount" "deliverTreatment: requestedBolusAmount=$requestedBolusAmount"

View file

@ -49,4 +49,6 @@
<string name="dash_bolusdelivering">Delivering %1$.2f U</string> <string name="dash_bolusdelivering">Delivering %1$.2f U</string>
<string name="omnipod_common_alert_delivery_suspended">Insulin delivery is suspended</string> <string name="omnipod_common_alert_delivery_suspended">Insulin delivery is suspended</string>
<string name="omnipod_dash_connection_lost">Lost connection to pod</string> <string name="omnipod_dash_connection_lost">Lost connection to pod</string>
<string name="omnipod_dash_bolus_already_in_progress">Another bolus is being delivered</string>
<string name="omnipod_dash_not_enough_insulin">Not enough insulin left in the reservoir</string>
</resources> </resources>