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:
commit
5d9277abdb
3 changed files with 19 additions and 32 deletions
|
@ -4,8 +4,7 @@ package info.nightscout.androidaps.plugins.pump.common.defs;
|
|||
* Created by andy on 02/05/2018.
|
||||
*/
|
||||
|
||||
public enum DoseStepSize
|
||||
{
|
||||
public enum DoseStepSize {
|
||||
|
||||
ComboBasal( //
|
||||
new DoseStepSizeEntry(0f, 1f, 0.01f), //
|
||||
|
@ -26,28 +25,25 @@ public enum DoseStepSize
|
|||
new DoseStepSizeEntry(0f, 1f, 0.025f), //
|
||||
new DoseStepSizeEntry(1f, 10f, 0.05f), //
|
||||
new DoseStepSizeEntry(10f, Double.MAX_VALUE, 0.1f)), //
|
||||
|
||||
;
|
||||
|
||||
|
||||
DoseStepSizeEntry[] entries;
|
||||
|
||||
|
||||
DoseStepSize(DoseStepSizeEntry...entries)
|
||||
{
|
||||
DoseStepSize(DoseStepSizeEntry... entries) {
|
||||
this.entries = entries;
|
||||
}
|
||||
|
||||
|
||||
public double getStepSizeForAmount(double amount)
|
||||
{
|
||||
public double getStepSizeForAmount(double amount) {
|
||||
for (DoseStepSizeEntry entry : entries) {
|
||||
if (entry.from <= amount && entry.to > amount)
|
||||
return entry.value;
|
||||
}
|
||||
|
||||
// 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("-");
|
||||
|
||||
if (entry.to == Double.MAX_VALUE)
|
||||
{
|
||||
if (entry.to == Double.MAX_VALUE) {
|
||||
sb.append("~}");
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
sb.append(entry.to);
|
||||
sb.append("}, ");
|
||||
}
|
||||
|
@ -76,15 +69,13 @@ public enum DoseStepSize
|
|||
}
|
||||
|
||||
|
||||
static class DoseStepSizeEntry
|
||||
{
|
||||
static class DoseStepSizeEntry {
|
||||
double from;
|
||||
double to;
|
||||
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]
|
||||
DoseStepSizeEntry(double from, double to, double value)
|
||||
{
|
||||
DoseStepSizeEntry(double from, double to, double value) {
|
||||
this.from = from;
|
||||
this.to = to;
|
||||
this.value = value;
|
||||
|
|
|
@ -13,7 +13,7 @@ import info.nightscout.androidaps.utils.Round;
|
|||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
|
@ -60,7 +60,7 @@ public enum PumpType {
|
|||
0.02d, 0.01d, DoseStepSize.InsightBolus, PumpCapability.InsightCapabilities), //
|
||||
|
||||
// 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), //
|
||||
PumpTempBasalType.Percent, //
|
||||
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, //
|
||||
new DoseSettings(0.05d, 30, 8 * 60, 0.05d), //
|
||||
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), //
|
||||
|
||||
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, //
|
||||
new DoseSettings(0.05d, 30, 8 * 60, 0.05d), //
|
||||
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), //
|
||||
|
||||
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), //
|
||||
|
||||
// MDI
|
||||
MDI("MDI", ManufacturerType.AndroidAPS, "MDI")
|
||||
;
|
||||
MDI("MDI", ManufacturerType.AndroidAPS, "MDI");
|
||||
|
||||
|
||||
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.parent = parent;
|
||||
this.model = model;
|
||||
}
|
||||
|
||||
|
||||
PumpType(String description, ManufacturerType manufacturer, String model)
|
||||
{
|
||||
PumpType(String description, ManufacturerType manufacturer, String model) {
|
||||
this.description = description;
|
||||
this.manufacturer = manufacturer;
|
||||
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.parent = parent;
|
||||
this.pumpCapability = pumpCapability;
|
||||
|
@ -190,9 +186,8 @@ public enum PumpType {
|
|||
|
||||
PumpType(String description, ManufacturerType manufacturer, String model, double bolusSize, DoseStepSize specialBolusSize, //
|
||||
DoseSettings extendedBolusSettings, //
|
||||
PumpTempBasalType pumpTempBasalType, DoseSettings tbrSettings, PumpCapability specialBasalDurations, //
|
||||
double baseBasalMinValue, double baseBasalStep, DoseStepSize baseBasalSpecialSteps, PumpCapability pumpCapability)
|
||||
{
|
||||
PumpTempBasalType pumpTempBasalType, DoseSettings tbrSettings, PumpCapability specialBasalDurations, //
|
||||
double baseBasalMinValue, double baseBasalStep, DoseStepSize baseBasalSpecialSteps, PumpCapability pumpCapability) {
|
||||
this(description, manufacturer, model, bolusSize, specialBolusSize, extendedBolusSettings, pumpTempBasalType, tbrSettings, specialBasalDurations, baseBasalMinValue, null, baseBasalStep, baseBasalSpecialSteps, pumpCapability);
|
||||
}
|
||||
|
||||
|
|
|
@ -182,6 +182,7 @@ public class MedtronicPumpStatus extends PumpStatus {
|
|||
} else {
|
||||
this.pumpType = medtronicPumpMap.get(pumpTypePart);
|
||||
this.medtronicDeviceType = medtronicDeviceTypeMap.get(pumpTypePart);
|
||||
this.pumpDescription.setPumpDescription(this.pumpType);
|
||||
|
||||
if (pumpTypePart.startsWith("7"))
|
||||
this.reservoirFullUnits = 300;
|
||||
|
|
Loading…
Reference in a new issue