more build types with maxbolus: full fullteenage fullchild

This commit is contained in:
Milos Kozak 2016-10-21 00:03:52 +02:00
parent 6f8d828ec2
commit 38cf01eb62
3 changed files with 24 additions and 6 deletions

View file

@ -33,25 +33,41 @@ android {
} }
} }
productFlavors { productFlavors {
full {
buildConfigField "boolean", "APS", "true"
buildConfigField "boolean", "PUMPDRIVERS", "true"
buildConfigField "boolean", "CLOSEDLOOP", "true"
buildConfigField "int", "MAXBOLUS", "17"
}
fullteenage {
buildConfigField "boolean", "APS", "true"
buildConfigField "boolean", "PUMPDRIVERS", "true"
buildConfigField "boolean", "CLOSEDLOOP", "true"
buildConfigField "int", "MAXBOLUS", "10"
}
fullchild {
buildConfigField "boolean", "APS", "true"
buildConfigField "boolean", "PUMPDRIVERS", "true"
buildConfigField "boolean", "CLOSEDLOOP", "true"
buildConfigField "int", "MAXBOLUS", "5"
}
danarcontrol { danarcontrol {
buildConfigField "boolean", "APS", "false" buildConfigField "boolean", "APS", "false"
buildConfigField "boolean", "PUMPDRIVERS", "true" buildConfigField "boolean", "PUMPDRIVERS", "true"
buildConfigField "boolean", "CLOSEDLOOP", "false" buildConfigField "boolean", "CLOSEDLOOP", "false"
buildConfigField "int", "MAXBOLUS", "17"
} }
careportal { careportal {
buildConfigField "boolean", "APS", "false" buildConfigField "boolean", "APS", "false"
buildConfigField "boolean", "PUMPDRIVERS", "false" buildConfigField "boolean", "PUMPDRIVERS", "false"
buildConfigField "boolean", "CLOSEDLOOP", "false" buildConfigField "boolean", "CLOSEDLOOP", "false"
buildConfigField "int", "MAXBOLUS", "17"
} }
openloop { openloop {
buildConfigField "boolean", "APS", "true" buildConfigField "boolean", "APS", "true"
buildConfigField "boolean", "PUMPDRIVERS", "true" buildConfigField "boolean", "PUMPDRIVERS", "true"
buildConfigField "boolean", "CLOSEDLOOP", "false" buildConfigField "boolean", "CLOSEDLOOP", "false"
} buildConfigField "int", "MAXBOLUS", "17"
full {
buildConfigField "boolean", "APS", "true"
buildConfigField "boolean", "PUMPDRIVERS", "true"
buildConfigField "boolean", "CLOSEDLOOP", "true"
} }
} }
} }

View file

@ -3,6 +3,7 @@ package info.nightscout.androidaps.plugins.DanaR.comm;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import info.nightscout.androidaps.BuildConfig;
import info.nightscout.androidaps.Config; import info.nightscout.androidaps.Config;
import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.MainApp;
@ -19,7 +20,7 @@ public class MsgBolusStart extends MessageBase {
// HARDCODED LIMIT // HARDCODED LIMIT
amount = MainApp.getConfigBuilder().applyBolusConstraints(amount); amount = MainApp.getConfigBuilder().applyBolusConstraints(amount);
if (amount < 0) amount = 0d; if (amount < 0) amount = 0d;
if (amount > 17) amount = 17d; // TODO: add to constraints too if (amount > BuildConfig.MAXBOLUS) amount = BuildConfig.MAXBOLUS;
AddParamInt((int) (amount * 100)); AddParamInt((int) (amount * 100));
} }

View file

@ -177,6 +177,7 @@ public class SafetyPlugin implements PluginBase, ConstraintsInterface {
} catch (Exception e) { } catch (Exception e) {
insulin = 0d; insulin = 0d;
} }
if (insulin > BuildConfig.MAXBOLUS) insulin = Double.valueOf(BuildConfig.MAXBOLUS);
return insulin; return insulin;
} }