OpenAPS MA target value

This commit is contained in:
Milos Kozak 2016-08-09 15:40:12 +02:00
parent a284f2fc38
commit 49d6690450
5 changed files with 14 additions and 1 deletions

View file

@ -263,6 +263,7 @@ public class DetermineBasalAdapterJS implements Parcelable {
double maxBasal, double maxBasal,
double minBg, double minBg,
double maxBg, double maxBg,
double targetBg,
PumpInterface pump, PumpInterface pump,
IobTotal iobData, IobTotal iobData,
DatabaseHelper.GlucoseStatus glucoseStatus, DatabaseHelper.GlucoseStatus glucoseStatus,
@ -278,6 +279,7 @@ public class DetermineBasalAdapterJS implements Parcelable {
mProfile.add("max_basal", maxBasal); mProfile.add("max_basal", maxBasal);
mProfile.add("min_bg", minBg); mProfile.add("min_bg", minBg);
mProfile.add("max_bg", maxBg); mProfile.add("max_bg", maxBg);
mProfile.add("target_bg", targetBg);
mProfile.add("carbratio", profile.getIc(profile.secondsFromMidnight())); mProfile.add("carbratio", profile.getIc(profile.secondsFromMidnight()));
mProfile.add("sens", NSProfile.toMgdl(profile.getIsf(NSProfile.secondsFromMidnight()).doubleValue(), units)); mProfile.add("sens", NSProfile.toMgdl(profile.getIsf(NSProfile.secondsFromMidnight()).doubleValue(), units));

View file

@ -141,9 +141,11 @@ public class OpenAPSMAPlugin implements PluginBase, APSInterface {
String maxBgDefault = "180"; String maxBgDefault = "180";
String minBgDefault = "100"; String minBgDefault = "100";
String targetBgDefault = "150";
if (!units.equals(Constants.MGDL)) { if (!units.equals(Constants.MGDL)) {
maxBgDefault = "10"; maxBgDefault = "10";
minBgDefault = "5"; minBgDefault = "5";
targetBgDefault = "7";
} }
Date now = new Date(); Date now = new Date();
@ -152,6 +154,7 @@ public class OpenAPSMAPlugin implements PluginBase, APSInterface {
double maxBasal = SafeParse.stringToDouble(SP.getString("openapsma_max_basal", "1")); double maxBasal = SafeParse.stringToDouble(SP.getString("openapsma_max_basal", "1"));
double minBg = NSProfile.toMgdl(SafeParse.stringToDouble(SP.getString("openapsma_min_bg", minBgDefault)), units); double minBg = NSProfile.toMgdl(SafeParse.stringToDouble(SP.getString("openapsma_min_bg", minBgDefault)), units);
double maxBg = NSProfile.toMgdl(SafeParse.stringToDouble(SP.getString("openapsma_max_bg", maxBgDefault)), units); double maxBg = NSProfile.toMgdl(SafeParse.stringToDouble(SP.getString("openapsma_max_bg", maxBgDefault)), units);
double targetBg = NSProfile.toMgdl(SafeParse.stringToDouble(SP.getString("openapsma_target_bg", targetBgDefault)), units);
minBg = Round.roundTo(minBg, 0.1d); minBg = Round.roundTo(minBg, 0.1d);
maxBg = Round.roundTo(maxBg, 0.1d); maxBg = Round.roundTo(maxBg, 0.1d);
@ -168,7 +171,7 @@ public class OpenAPSMAPlugin implements PluginBase, APSInterface {
maxIob = MainApp.getConfigBuilder().applyMaxIOBConstraints(maxIob); maxIob = MainApp.getConfigBuilder().applyMaxIOBConstraints(maxIob);
determineBasalAdapterJS.setData(profile, maxIob, maxBasal, minBg, maxBg, pump, iobTotal, glucoseStatus, mealData); determineBasalAdapterJS.setData(profile, maxIob, maxBasal, minBg, maxBg, targetBg, pump, iobTotal, glucoseStatus, mealData);
DetermineBasalResult determineBasalResult = determineBasalAdapterJS.invoke(); DetermineBasalResult determineBasalResult = determineBasalAdapterJS.invoke();

View file

@ -300,4 +300,5 @@
<string name="objectives_5_objective">Upravit bazály a koeficinty, když bude potřeba a povolit automatickou detekci citlivosti na inzulín</string> <string name="objectives_5_objective">Upravit bazály a koeficinty, když bude potřeba a povolit automatickou detekci citlivosti na inzulín</string>
<string name="objectives_6_objective">Povolit další fukce pro běžné používání jako AMA</string> <string name="objectives_6_objective">Povolit další fukce pro běžné používání jako AMA</string>
<string name="youareonallowedlimit">Dosaženo limitu</string> <string name="youareonallowedlimit">Dosaženo limitu</string>
<string name="openapsma_target_bg">Cílová hodnota pro výpočty</string>
</resources> </resources>

View file

@ -302,5 +302,6 @@
<string name="objectives_5_gate">1 week successful daytime looping with regular carb entry</string> <string name="objectives_5_gate">1 week successful daytime looping with regular carb entry</string>
<string name="objectives_6_objective">Enabling additional features for daytime use, such as advanced meal assist</string> <string name="objectives_6_objective">Enabling additional features for daytime use, such as advanced meal assist</string>
<string name="youareonallowedlimit">You reached allowed limit</string> <string name="youareonallowedlimit">You reached allowed limit</string>
<string name="openapsma_target_bg">Target value for calculations</string>
</resources> </resources>

View file

@ -14,6 +14,12 @@
android:numeric="decimal" android:numeric="decimal"
android:title="@string/openapsma_high_summary" /> android:title="@string/openapsma_high_summary" />
<EditTextPreference
android:defaultValue=""
android:key="openapsma_target_bg"
android:numeric="decimal"
android:title="@string/openapsma_target_bg" />
<EditTextPreference <EditTextPreference
android:defaultValue="1" android:defaultValue="1"
android:key="openapsma_max_basal" android:key="openapsma_max_basal"