From 30342f2e23b87ec9ee6452b7dc1f91dc40154163 Mon Sep 17 00:00:00 2001 From: Theo van Elsberg Date: Tue, 5 Oct 2021 00:07:09 +0200 Subject: [PATCH] Move fixed values for expiration alerts to PodConstants --- .../omnipod/dash/driver/OmnipodDashManagerImpl.kt | 13 ++++++------- .../dash/driver/pod/definition/PodConstants.kt | 15 +++++++++++++-- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/OmnipodDashManagerImpl.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/OmnipodDashManagerImpl.kt index 3e9c78ed4e..0828b50c74 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/OmnipodDashManagerImpl.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/OmnipodDashManagerImpl.kt @@ -9,6 +9,9 @@ import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command.* import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.command.GetVersionCommand.Companion.DEFAULT_UNIQUE_ID import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.* import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.PodConstants.Companion.MAX_POD_LIFETIME +import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.PodConstants.Companion.POD_EXPIRATION_ALERT_MINUTES_DURATION +import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.PodConstants.Companion.POD_EXPIRATION_EMINENT_ALERT_MINUTES +import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.PodConstants.Companion.POD_EXPIRATION_ALERT_MINUTES import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.response.* import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.state.OmnipodDashPodStateManager import info.nightscout.androidaps.utils.rx.AapsSchedulers @@ -394,11 +397,9 @@ class OmnipodDashManagerImpl @Inject constructor( AlertConfiguration( AlertType.EXPIRATION, enabled = true, - durationInMinutes = TimeUnit.HOURS.toMinutes(7).toShort(), + durationInMinutes = POD_EXPIRATION_ALERT_MINUTES_DURATION.toShort(), autoOff = false, - AlertTrigger.TimerTrigger( - TimeUnit.HOURS.toMinutes(72).toShort() - ), // FIXME use activation time + AlertTrigger.TimerTrigger(POD_EXPIRATION_ALERT_MINUTES.toShort()), // FIXME use activation time BeepType.FOUR_TIMES_BIP_BEEP, BeepRepetitionType.XXX3 ), @@ -407,9 +408,7 @@ class OmnipodDashManagerImpl @Inject constructor( enabled = true, durationInMinutes = 0, autoOff = false, - AlertTrigger.TimerTrigger( - TimeUnit.HOURS.toMinutes(79).toShort() - ), // FIXME use activation time + AlertTrigger.TimerTrigger(POD_EXPIRATION_EMINENT_ALERT_MINUTES.toShort()), // FIXME use activation time BeepType.FOUR_TIMES_BIP_BEEP, BeepRepetitionType.XXX4 ) diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/definition/PodConstants.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/definition/PodConstants.kt index f6901d34d7..04de6d4c50 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/definition/PodConstants.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/definition/PodConstants.kt @@ -1,16 +1,27 @@ package info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition import java.time.Duration +import java.util.concurrent.TimeUnit class PodConstants { companion object { val MAX_POD_LIFETIME : Duration = Duration.ofHours(80) + // Expiration alerts duration in minutes + const val POD_EXPIRATION_ALERT_MINUTES_DURATION = 60 * 7 + // Expiration alert time in minutes since activation + const val POD_EXPIRATION_ALERT_MINUTES = 60 * 72 + // Expiration eminent alert time in minutes since activation + const val POD_EXPIRATION_EMINENT_ALERT_MINUTES = 60 * 79 + + // Bolus units const val POD_PULSE_BOLUS_UNITS = 0.05 - // Priming + + // Priming units const val POD_PRIMING_BOLUS_UNITS = 0.05 const val POD_CANNULA_INSERTION_BOLUS_UNITS = 0.05 - // Reservoir + + // Reservoir units alert threshold const val DEFAULT_MAX_RESERVOIR_ALERT_THRESHOLD : Short = 20 } }