fix bolus step for Dana pumps
This commit is contained in:
parent
2f299bc670
commit
870d23c08c
|
@ -35,6 +35,7 @@ import info.nightscout.androidaps.interfaces.Constraint;
|
|||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||
import info.nightscout.androidaps.plugins.Treatments.TreatmentsPlugin;
|
||||
import info.nightscout.androidaps.queue.Callback;
|
||||
import info.nightscout.utils.DecimalFormatter;
|
||||
import info.nightscout.utils.FabricPrivacy;
|
||||
import info.nightscout.utils.NumberPicker;
|
||||
import info.nightscout.utils.SafeParse;
|
||||
|
@ -104,7 +105,7 @@ public class NewTreatmentDialog extends DialogFragment implements OnClickListene
|
|||
editInsulin = (NumberPicker) view.findViewById(R.id.treatments_newtreatment_insulinamount);
|
||||
|
||||
editCarbs.setParams(0d, 0d, (double) maxCarbs, 1d, new DecimalFormat("0"), false, textWatcher);
|
||||
editInsulin.setParams(0d, 0d, maxInsulin, ConfigBuilderPlugin.getActivePump().getPumpDescription().bolusStep, new DecimalFormat("0.00"), false, textWatcher);
|
||||
editInsulin.setParams(0d, 0d, maxInsulin, ConfigBuilderPlugin.getActivePump().getPumpDescription().bolusStep, DecimalFormatter.pumpSupportedBolusFormat(), false, textWatcher);
|
||||
|
||||
recordOnlyCheckbox = (CheckBox) view.findViewById(R.id.newtreatment_record_only);
|
||||
|
||||
|
|
|
@ -304,7 +304,11 @@ public abstract class AbstractDanaRPlugin extends PluginBase implements PumpInte
|
|||
|
||||
@Override
|
||||
public void getPumpStatus() {
|
||||
if (sExecutionService != null) sExecutionService.getPumpStatus();
|
||||
if (sExecutionService != null) {
|
||||
sExecutionService.getPumpStatus();
|
||||
pumpDescription.basalStep = pump.basalStep;
|
||||
pumpDescription.bolusStep = pump.bolusStep;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -178,8 +178,6 @@ public class DanaRSPlugin extends PluginBase implements PumpInterface, DanaRInte
|
|||
final Object o = new Object();
|
||||
|
||||
danaRSService.connect(from, mDeviceAddress, o);
|
||||
pumpDescription.basalStep = pump.basalStep;
|
||||
pumpDescription.bolusStep = pump.bolusStep;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -205,8 +203,11 @@ public class DanaRSPlugin extends PluginBase implements PumpInterface, DanaRInte
|
|||
|
||||
@Override
|
||||
public void getPumpStatus() {
|
||||
if (danaRSService != null)
|
||||
if (danaRSService != null) {
|
||||
danaRSService.getPumpStatus();
|
||||
pumpDescription.basalStep = pump.basalStep;
|
||||
pumpDescription.bolusStep = pump.bolusStep;
|
||||
}
|
||||
}
|
||||
|
||||
// DanaR interface
|
||||
|
|
|
@ -46,13 +46,13 @@ public class DecimalFormatter {
|
|||
}
|
||||
|
||||
public static String toPumpSupportedBolus(double value) {
|
||||
return ConfigBuilderPlugin.getActivePump().getPumpDescription().bolusStep <= 0.01
|
||||
return ConfigBuilderPlugin.getActivePump().getPumpDescription().bolusStep <= 0.05
|
||||
? to2Decimal(value)
|
||||
: to1Decimal(value);
|
||||
}
|
||||
|
||||
public static DecimalFormat pumpSupportedBolusFormat() {
|
||||
return ConfigBuilderPlugin.getActivePump().getPumpDescription().bolusStep <= 0.01
|
||||
return ConfigBuilderPlugin.getActivePump().getPumpDescription().bolusStep <= 0.05
|
||||
? new DecimalFormat("0.00")
|
||||
: new DecimalFormat("0.0");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue