add hardcoded limits to danar driver
This commit is contained in:
parent
2f47f2a048
commit
be71ef15db
|
@ -4,6 +4,7 @@ import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import info.nightscout.androidaps.Config;
|
import info.nightscout.androidaps.Config;
|
||||||
|
import info.nightscout.androidaps.MainApp;
|
||||||
|
|
||||||
public class MsgBolusStart extends MessageBase {
|
public class MsgBolusStart extends MessageBase {
|
||||||
private static Logger log = LoggerFactory.getLogger(MsgBolusStart.class);
|
private static Logger log = LoggerFactory.getLogger(MsgBolusStart.class);
|
||||||
|
@ -14,6 +15,12 @@ public class MsgBolusStart extends MessageBase {
|
||||||
|
|
||||||
public MsgBolusStart(double amount) {
|
public MsgBolusStart(double amount) {
|
||||||
this();
|
this();
|
||||||
|
|
||||||
|
// HARDCODED LIMIT
|
||||||
|
amount = MainApp.getConfigBuilder().applyBolusConstraints(amount);
|
||||||
|
if (amount < 0) amount = 0d;
|
||||||
|
if (amount > 10) amount = 10d;
|
||||||
|
|
||||||
AddParamInt((int) (amount * 100));
|
AddParamInt((int) (amount * 100));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import info.nightscout.androidaps.Config;
|
import info.nightscout.androidaps.Config;
|
||||||
|
import info.nightscout.androidaps.MainApp;
|
||||||
|
|
||||||
public class MsgSetExtendedBolusStart extends MessageBase {
|
public class MsgSetExtendedBolusStart extends MessageBase {
|
||||||
private static Logger log = LoggerFactory.getLogger(MsgSetExtendedBolusStart.class);
|
private static Logger log = LoggerFactory.getLogger(MsgSetExtendedBolusStart.class);
|
||||||
|
@ -14,6 +15,14 @@ public class MsgSetExtendedBolusStart extends MessageBase {
|
||||||
|
|
||||||
public MsgSetExtendedBolusStart(double amount, byte halfhours) {
|
public MsgSetExtendedBolusStart(double amount, byte halfhours) {
|
||||||
this();
|
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));
|
AddParamInt((int) (amount * 100));
|
||||||
AddParamByte(halfhours);
|
AddParamByte(halfhours);
|
||||||
if (Config.logDanaMessageDetail)
|
if (Config.logDanaMessageDetail)
|
||||||
|
|
|
@ -15,6 +15,12 @@ public class MsgSetTempBasalStart extends MessageBase {
|
||||||
public MsgSetTempBasalStart(int percent, int durationInHours) {
|
public MsgSetTempBasalStart(int percent, int durationInHours) {
|
||||||
this();
|
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) (percent & 255));
|
||||||
AddParamByte((byte) (durationInHours & 255));
|
AddParamByte((byte) (durationInHours & 255));
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue