Medtrum: Support for 300U

This commit is contained in:
jbr7rr 2023-08-25 21:33:03 +02:00
parent d6e6a98642
commit b87f41a363
7 changed files with 13 additions and 6 deletions

View file

@ -413,6 +413,7 @@ enum class PumpType {
maxReservoirReading = 400,
source = Source.Medtrum
),
MEDTRUM_300U(description = "Medtrum 300U", model = "300U", parent = MEDTRUM_NANO),
MEDTRUM_UNTESTED(description = "Medtrum untested", model = "untested", parent = MEDTRUM_NANO);
val description: String

View file

@ -59,7 +59,8 @@ fun PumpType.Companion.fromDbPumpType(pt: InterfaceIDs.PumpType): PumpType =
InterfaceIDs.PumpType.USER -> PumpType.USER
InterfaceIDs.PumpType.DIACONN_G8 -> PumpType.DIACONN_G8
InterfaceIDs.PumpType.EOPATCH2 -> PumpType.EOFLOW_EOPATCH2
InterfaceIDs.PumpType.MEDTRUM -> PumpType.MEDTRUM_NANO
InterfaceIDs.PumpType.MEDTRUM_NANO -> PumpType.MEDTRUM_NANO
InterfaceIDs.PumpType.MEDTRUM_300U -> PumpType.MEDTRUM_300U
InterfaceIDs.PumpType.MEDTRUM_UNTESTED -> PumpType.MEDTRUM_UNTESTED
InterfaceIDs.PumpType.CACHE -> PumpType.CACHE
}
@ -80,6 +81,7 @@ fun PumpType.Source.toDbSource(): UserEntry.Sources =
PumpType.Source.OmnipodEros -> UserEntry.Sources.OmnipodEros
PumpType.Source.OmnipodDash -> UserEntry.Sources.OmnipodDash
PumpType.Source.EOPatch2 -> UserEntry.Sources.EOPatch2
PumpType.Source.Medtrum -> UserEntry.Sources.Medtrum
PumpType.Source.MDI -> UserEntry.Sources.MDI
PumpType.Source.VirtualPump -> UserEntry.Sources.VirtualPump
else -> UserEntry.Sources.Unknown
@ -119,7 +121,8 @@ fun PumpType.toDbPumpType(): InterfaceIDs.PumpType =
PumpType.USER -> InterfaceIDs.PumpType.USER
PumpType.DIACONN_G8 -> InterfaceIDs.PumpType.DIACONN_G8
PumpType.EOFLOW_EOPATCH2 -> InterfaceIDs.PumpType.EOPATCH2
PumpType.MEDTRUM_NANO -> InterfaceIDs.PumpType.MEDTRUM
PumpType.MEDTRUM_NANO -> InterfaceIDs.PumpType.MEDTRUM_NANO
PumpType.MEDTRUM_300U -> InterfaceIDs.PumpType.MEDTRUM_300U
PumpType.MEDTRUM_UNTESTED -> InterfaceIDs.PumpType.MEDTRUM_UNTESTED
PumpType.CACHE -> InterfaceIDs.PumpType.CACHE
}

View file

@ -172,6 +172,7 @@ data class UserEntry(
OmnipodEros,
OmnipodDash, //No entry currently
EOPatch2,
Medtrum,
MDI,
VirtualPump,
SMS, //From SMS plugin

View file

@ -43,7 +43,8 @@ data class InterfaceIDs(
MDI,
DIACONN_G8,
EOPATCH2,
MEDTRUM,
MEDTRUM_NANO,
MEDTRUM_300U,
MEDTRUM_UNTESTED,
USER,
CACHE;

View file

@ -186,12 +186,12 @@ import kotlin.math.abs
}
when (medtrumPump.pumpType()) {
PumpType.MEDTRUM_NANO -> {
PumpType.MEDTRUM_NANO, PumpType.MEDTRUM_300U -> {
alarmSetting?.entries = arrayOf(allAlarmEntries[6], allAlarmEntries[7]) // "Beep", "Silent"
alarmSetting?.entryValues = arrayOf(allAlarmValues[6], allAlarmValues[7]) // "6", "7"
}
else -> {
else -> {
// Use Nano settings for unknown pumps
alarmSetting?.entries = arrayOf(allAlarmEntries[6], allAlarmEntries[7]) // "Beep", "Silent"
alarmSetting?.entryValues = arrayOf(allAlarmValues[6], allAlarmValues[7]) // "6", "7"

View file

@ -294,6 +294,7 @@ class MedtrumPump @Inject constructor(
fun pumpType(type: Int): PumpType =
when (type) {
MedtrumSnUtil.MD_0201, MedtrumSnUtil.MD_8201 -> PumpType.MEDTRUM_NANO
MedtrumSnUtil.MD_8301 -> PumpType.MEDTRUM_300U
else -> PumpType.MEDTRUM_UNTESTED
}

View file

@ -25,7 +25,7 @@
<string name="medtrum">Medtrum</string>
<string name="medtrum_pump_shortname">MT</string>
<string name="medtrum_pump_description">Pump integration for Medtrum Nano</string>
<string name="medtrum_pump_description">Pump integration for Medtrum Nano and Medtrum 300U</string>
<string name="medtrum_pump_setting">Medtrum pump settings</string>
<string name="pump_error">Pump error: %1$s !! </string>
<string name="pump_is_suspended">Pump is suspended</string>