This commit is contained in:
Milos Kozak 2019-05-31 10:44:38 +02:00
parent 63d5ef4aa7
commit 15e997abb3

View file

@ -30,11 +30,11 @@ import info.nightscout.androidaps.utils.T;
public class TriggerAutosensValue extends Trigger { public class TriggerAutosensValue extends Trigger {
private static Logger log = LoggerFactory.getLogger(L.AUTOMATION); private static Logger log = LoggerFactory.getLogger(L.AUTOMATION);
public int minValue = (int) (SP.getDouble("openapsama_autosens_min", 0.7d) * 100); private final int minValue = (int) (SP.getDouble("openapsama_autosens_min", 0.7d) * 100);
public int maxValue = (int) (SP.getDouble("openapsama_autosens_max", 1.2d) * 100); private final int maxValue = (int) (SP.getDouble("openapsama_autosens_max", 1.2d) * 100);
private double step = 1; private final double step = 1;
private DecimalFormat decimalFormat = new DecimalFormat("1");; private DecimalFormat decimalFormat = new DecimalFormat("1");
private InputDouble value = new InputDouble( (double) minValue,(double) minValue, (double) maxValue, step, decimalFormat); private InputDouble value = new InputDouble(100, (double) minValue, (double) maxValue, step, decimalFormat);
private Comparator comparator = new Comparator(); private Comparator comparator = new Comparator();
public TriggerAutosensValue() { public TriggerAutosensValue() {
@ -68,7 +68,7 @@ public class TriggerAutosensValue extends Trigger {
if (lastRun > DateUtil.now() - T.mins(5).msecs()) if (lastRun > DateUtil.now() - T.mins(5).msecs())
return false; return false;
boolean doRun = comparator.getValue().check((autosensData.autosensResult.ratio), (double) (getValue() / 100d)); boolean doRun = comparator.getValue().check((autosensData.autosensResult.ratio), getValue() / 100d);
if (doRun) { if (doRun) {
if (L.isEnabled(L.AUTOMATION)) if (L.isEnabled(L.AUTOMATION))
log.debug("Ready for execution: " + friendlyDescription()); log.debug("Ready for execution: " + friendlyDescription());