diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgBolusStart.java b/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgBolusStart.java index 8056bedead..45dbd188a5 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgBolusStart.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgBolusStart.java @@ -4,6 +4,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import info.nightscout.androidaps.Config; +import info.nightscout.androidaps.MainApp; public class MsgBolusStart extends MessageBase { private static Logger log = LoggerFactory.getLogger(MsgBolusStart.class); @@ -14,6 +15,12 @@ public class MsgBolusStart extends MessageBase { public MsgBolusStart(double amount) { this(); + + // HARDCODED LIMIT + amount = MainApp.getConfigBuilder().applyBolusConstraints(amount); + if (amount < 0) amount = 0d; + if (amount > 10) amount = 10d; + AddParamInt((int) (amount * 100)); } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgSetExtendedBolusStart.java b/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgSetExtendedBolusStart.java index 289470253e..86fb0bc9f5 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgSetExtendedBolusStart.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgSetExtendedBolusStart.java @@ -4,6 +4,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import info.nightscout.androidaps.Config; +import info.nightscout.androidaps.MainApp; public class MsgSetExtendedBolusStart extends MessageBase { private static Logger log = LoggerFactory.getLogger(MsgSetExtendedBolusStart.class); @@ -14,6 +15,14 @@ public class MsgSetExtendedBolusStart extends MessageBase { public MsgSetExtendedBolusStart(double amount, byte halfhours) { this(); + + // HARDCODED LIMITS + if (halfhours < 1) halfhours = 1; + if (halfhours > 16) halfhours = 16; + amount = MainApp.getConfigBuilder().applyBolusConstraints(amount); + if (amount < 0d) amount = 0d; + if (amount > 10d) amount = 10d; + AddParamInt((int) (amount * 100)); AddParamByte(halfhours); if (Config.logDanaMessageDetail) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgSetTempBasalStart.java b/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgSetTempBasalStart.java index 63416df35c..29ab838b37 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgSetTempBasalStart.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/DanaR/comm/MsgSetTempBasalStart.java @@ -15,6 +15,12 @@ public class MsgSetTempBasalStart extends MessageBase { public MsgSetTempBasalStart(int percent, int durationInHours) { this(); + //HARDCODED LIMITS + if (percent < 0) percent = 0; + if (percent > 200) percent = 200; + if (durationInHours < 1) durationInHours = 1; + if (durationInHours > 24) durationInHours = 24; + AddParamByte((byte) (percent & 255)); AddParamByte((byte) (durationInHours & 255));