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.
*/
public enum DoseStepSize
{
public enum DoseStepSize {
ComboBasal( //
new DoseStepSizeEntry(0f, 1f, 0.01f), //
@ -26,21 +25,18 @@ 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;
@ -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;

View file

@ -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.
*/
@ -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;
@ -191,8 +187,7 @@ 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)
{
double baseBasalMinValue, double baseBasalStep, DoseStepSize baseBasalSpecialSteps, PumpCapability 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 {
this.pumpType = medtronicPumpMap.get(pumpTypePart);
this.medtronicDeviceType = medtronicDeviceTypeMap.get(pumpTypePart);
this.pumpDescription.setPumpDescription(this.pumpType);
if (pumpTypePart.startsWith("7"))
this.reservoirFullUnits = 300;