Merge pull request #2006 from andyrozman/bug_1954_mdt_wrong_min_bolus_for_554

Bug 1954 mdt wrong min bolus for 554
This commit is contained in:
Milos Kozak 2019-08-30 15:12:38 +02:00 committed by GitHub
commit 5d9277abdb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 32 deletions

View file

@ -4,8 +4,7 @@ package info.nightscout.androidaps.plugins.pump.common.defs;
* Created by andy on 02/05/2018. * Created by andy on 02/05/2018.
*/ */
public enum DoseStepSize public enum DoseStepSize {
{
ComboBasal( // ComboBasal( //
new DoseStepSizeEntry(0f, 1f, 0.01f), // new DoseStepSizeEntry(0f, 1f, 0.01f), //
@ -26,28 +25,25 @@ public enum DoseStepSize
new DoseStepSizeEntry(0f, 1f, 0.025f), // new DoseStepSizeEntry(0f, 1f, 0.025f), //
new DoseStepSizeEntry(1f, 10f, 0.05f), // new DoseStepSizeEntry(1f, 10f, 0.05f), //
new DoseStepSizeEntry(10f, Double.MAX_VALUE, 0.1f)), // new DoseStepSizeEntry(10f, Double.MAX_VALUE, 0.1f)), //
; ;
DoseStepSizeEntry[] entries; DoseStepSizeEntry[] entries;
DoseStepSize(DoseStepSizeEntry...entries) DoseStepSize(DoseStepSizeEntry... entries) {
{
this.entries = entries; this.entries = entries;
} }
public double getStepSizeForAmount(double amount) public double getStepSizeForAmount(double amount) {
{
for (DoseStepSizeEntry entry : entries) { for (DoseStepSizeEntry entry : entries) {
if (entry.from <= amount && entry.to > amount) if (entry.from <= amount && entry.to > amount)
return entry.value; return entry.value;
} }
// should never come to this // should never come to this
return entries[entries.length-1].value; return entries[entries.length - 1].value;
} }
@ -61,12 +57,9 @@ public enum DoseStepSize
sb.append(entry.from); sb.append(entry.from);
sb.append("-"); sb.append("-");
if (entry.to == Double.MAX_VALUE) if (entry.to == Double.MAX_VALUE) {
{
sb.append("~}"); sb.append("~}");
} } else {
else
{
sb.append(entry.to); sb.append(entry.to);
sb.append("}, "); sb.append("}, ");
} }
@ -76,15 +69,13 @@ public enum DoseStepSize
} }
static class DoseStepSizeEntry static class DoseStepSizeEntry {
{
double from; double from;
double to; double to;
double value; double value;
// to = this value is not included, but would actually mean <, so for rates between 0.025-0.975 u/h, we would have [from=0, to=10] // to = this value is not included, but would actually mean <, so for rates between 0.025-0.975 u/h, we would have [from=0, to=10]
DoseStepSizeEntry(double from, double to, double value) DoseStepSizeEntry(double from, double to, double value) {
{
this.from = from; this.from = from;
this.to = to; this.to = to;
this.value = value; this.value = value;

View file

@ -13,7 +13,7 @@ import info.nightscout.androidaps.utils.Round;
/** /**
* Created by andy on 02/05/2018. * Created by andy on 02/05/2018.
* * <p>
* Most of this defintions is intended for VirtualPump only, but they can be used by other plugins. * Most of this defintions is intended for VirtualPump only, but they can be used by other plugins.
*/ */
@ -60,7 +60,7 @@ public enum PumpType {
0.02d, 0.01d, DoseStepSize.InsightBolus, PumpCapability.InsightCapabilities), // 0.02d, 0.01d, DoseStepSize.InsightBolus, PumpCapability.InsightCapabilities), //
// Animas // Animas
AnimasVibe("Animas Vibe",ManufacturerType.Animas, "Vibe", 0.05d, null, // AnimasBolus? AnimasVibe("Animas Vibe", ManufacturerType.Animas, "Vibe", 0.05d, null, // AnimasBolus?
new DoseSettings(0.05d, 30, 12 * 60, 0.05d), // new DoseSettings(0.05d, 30, 12 * 60, 0.05d), //
PumpTempBasalType.Percent, // PumpTempBasalType.Percent, //
new DoseSettings(10, 30, 24 * 60, 0d, 300d), PumpCapability.BasalRate_Duration30minAllowed, // new DoseSettings(10, 30, 24 * 60, 0d, 300d), PumpCapability.BasalRate_Duration30minAllowed, //
@ -101,7 +101,7 @@ public enum PumpType {
Medtronic_512_712("Medtronic 512/712", ManufacturerType.Medtronic, "512/712", 0.1d, null, // Medtronic_512_712("Medtronic 512/712", ManufacturerType.Medtronic, "512/712", 0.1d, null, //
new DoseSettings(0.05d, 30, 8 * 60, 0.05d), // new DoseSettings(0.05d, 30, 8 * 60, 0.05d), //
PumpTempBasalType.Absolute, // PumpTempBasalType.Absolute, //
new DoseSettings(0.05d, 30, 24*60, 0d, 35d), PumpCapability.BasalRate_Duration30minAllowed, // new DoseSettings(0.05d, 30, 24 * 60, 0d, 35d), PumpCapability.BasalRate_Duration30minAllowed, //
0.05d, 0.05d, null, PumpCapability.MedtronicCapabilities), // 0.05d, 0.05d, null, PumpCapability.MedtronicCapabilities), //
Medtronic_515_715("Medtronic 515/715", "515/715", Medtronic_512_712), Medtronic_515_715("Medtronic 515/715", "515/715", Medtronic_512_712),
@ -110,7 +110,7 @@ public enum PumpType {
Medtronic_523_723_Revel("Medtronic 523/723 (Revel)", ManufacturerType.Medtronic, "523/723 (Revel)", 0.05d, null, // Medtronic_523_723_Revel("Medtronic 523/723 (Revel)", ManufacturerType.Medtronic, "523/723 (Revel)", 0.05d, null, //
new DoseSettings(0.05d, 30, 8 * 60, 0.05d), // new DoseSettings(0.05d, 30, 8 * 60, 0.05d), //
PumpTempBasalType.Absolute, // PumpTempBasalType.Absolute, //
new DoseSettings(0.05d, 30, 24*60, 0d, 35d), PumpCapability.BasalRate_Duration30minAllowed, // new DoseSettings(0.05d, 30, 24 * 60, 0d, 35d), PumpCapability.BasalRate_Duration30minAllowed, //
0.025d, 0.025d, DoseStepSize.MedtronicVeoBasal, PumpCapability.MedtronicCapabilities), // 0.025d, 0.025d, DoseStepSize.MedtronicVeoBasal, PumpCapability.MedtronicCapabilities), //
Medtronic_554_754_Veo("Medtronic 554/754 (Veo)", "554/754 (Veo)", Medtronic_523_723_Revel), // TODO Medtronic_554_754_Veo("Medtronic 554/754 (Veo)", "554/754 (Veo)", Medtronic_523_723_Revel), // TODO
@ -133,8 +133,7 @@ public enum PumpType {
TandemTSlimX2("Tandem t:slim X2", "t:slim X2", TandemTSlim), // TandemTSlimX2("Tandem t:slim X2", "t:slim X2", TandemTSlim), //
// MDI // MDI
MDI("MDI", ManufacturerType.AndroidAPS, "MDI") MDI("MDI", ManufacturerType.AndroidAPS, "MDI");
;
private String description; private String description;
@ -164,24 +163,21 @@ public enum PumpType {
} }
PumpType(String description, String model, PumpType parent) PumpType(String description, String model, PumpType parent) {
{
this.description = description; this.description = description;
this.parent = parent; this.parent = parent;
this.model = model; this.model = model;
} }
PumpType(String description, ManufacturerType manufacturer, String model) PumpType(String description, ManufacturerType manufacturer, String model) {
{
this.description = description; this.description = description;
this.manufacturer = manufacturer; this.manufacturer = manufacturer;
this.model = model; this.model = model;
} }
PumpType(String description, String model, PumpType parent, PumpCapability pumpCapability) PumpType(String description, String model, PumpType parent, PumpCapability pumpCapability) {
{
this.description = description; this.description = description;
this.parent = parent; this.parent = parent;
this.pumpCapability = pumpCapability; this.pumpCapability = pumpCapability;
@ -190,9 +186,8 @@ public enum PumpType {
PumpType(String description, ManufacturerType manufacturer, String model, double bolusSize, DoseStepSize specialBolusSize, // PumpType(String description, ManufacturerType manufacturer, String model, double bolusSize, DoseStepSize specialBolusSize, //
DoseSettings extendedBolusSettings, // DoseSettings extendedBolusSettings, //
PumpTempBasalType pumpTempBasalType, DoseSettings tbrSettings, PumpCapability specialBasalDurations, // PumpTempBasalType pumpTempBasalType, DoseSettings tbrSettings, PumpCapability specialBasalDurations, //
double baseBasalMinValue, double baseBasalStep, DoseStepSize baseBasalSpecialSteps, PumpCapability pumpCapability) double baseBasalMinValue, double baseBasalStep, DoseStepSize baseBasalSpecialSteps, PumpCapability pumpCapability) {
{
this(description, manufacturer, model, bolusSize, specialBolusSize, extendedBolusSettings, pumpTempBasalType, tbrSettings, specialBasalDurations, baseBasalMinValue, null, baseBasalStep, baseBasalSpecialSteps, pumpCapability); this(description, manufacturer, model, bolusSize, specialBolusSize, extendedBolusSettings, pumpTempBasalType, tbrSettings, specialBasalDurations, baseBasalMinValue, null, baseBasalStep, baseBasalSpecialSteps, pumpCapability);
} }

View file

@ -182,6 +182,7 @@ public class MedtronicPumpStatus extends PumpStatus {
} else { } else {
this.pumpType = medtronicPumpMap.get(pumpTypePart); this.pumpType = medtronicPumpMap.get(pumpTypePart);
this.medtronicDeviceType = medtronicDeviceTypeMap.get(pumpTypePart); this.medtronicDeviceType = medtronicDeviceTypeMap.get(pumpTypePart);
this.pumpDescription.setPumpDescription(this.pumpType);
if (pumpTypePart.startsWith("7")) if (pumpTypePart.startsWith("7"))
this.reservoirFullUnits = 300; this.reservoirFullUnits = 300;