Refactoring Pod constants:

- Const values now defined in "hours"
- Use TimeUnit().HOURS.toMinutes() method to convert
This commit is contained in:
Theo van Elsberg 2021-10-06 23:41:16 +02:00
parent 99ae6b4b84
commit 875cd893e2
2 changed files with 15 additions and 11 deletions

View file

@ -9,9 +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_IMMINENT_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.definition.PodConstants.Companion.POD_EXPIRATION_ALERT_HOURS_DURATION
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.PodConstants.Companion.POD_EXPIRATION_IMMINENT_ALERT_HOURS
import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.PodConstants.Companion.POD_EXPIRATION_ALERT_HOURS
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
@ -397,9 +397,11 @@ class OmnipodDashManagerImpl @Inject constructor(
AlertConfiguration(
AlertType.EXPIRATION,
enabled = true,
durationInMinutes = POD_EXPIRATION_ALERT_MINUTES_DURATION.toShort(),
durationInMinutes = TimeUnit.HOURS.toMinutes(POD_EXPIRATION_ALERT_HOURS_DURATION).toShort(),
autoOff = false,
AlertTrigger.TimerTrigger(POD_EXPIRATION_ALERT_MINUTES.toShort()), // FIXME use activation time
AlertTrigger.TimerTrigger(
TimeUnit.HOURS.toMinutes(POD_EXPIRATION_ALERT_HOURS).toShort()
), // FIXME use activation time
BeepType.FOUR_TIMES_BIP_BEEP,
BeepRepetitionType.XXX3
),
@ -408,7 +410,9 @@ class OmnipodDashManagerImpl @Inject constructor(
enabled = true,
durationInMinutes = 0,
autoOff = false,
AlertTrigger.TimerTrigger(POD_EXPIRATION_IMMINENT_ALERT_MINUTES.toShort()), // FIXME use activation time
AlertTrigger.TimerTrigger(
TimeUnit.HOURS.toMinutes(POD_EXPIRATION_IMMINENT_ALERT_HOURS).toShort()
), // FIXME use activation time
BeepType.FOUR_TIMES_BIP_BEEP,
BeepRepetitionType.XXX4
)

View file

@ -7,12 +7,12 @@ 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 alert time in minutes since activation and duration in minutes
const val POD_EXPIRATION_ALERT_HOURS = 72L
const val POD_EXPIRATION_ALERT_HOURS_DURATION = 7L
// Expiration eminent alert time in minutes since activation
const val POD_EXPIRATION_IMMINENT_ALERT_MINUTES = 60 * 79
const val POD_EXPIRATION_IMMINENT_ALERT_HOURS = 79L
// Bolus & Priming units
const val POD_PULSE_BOLUS_UNITS = 0.05