diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSAMA/OpenAPSAMAPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSAMA/OpenAPSAMAPlugin.java
index 0cb082f368..25d3981c47 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSAMA/OpenAPSAMAPlugin.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSAMA/OpenAPSAMAPlugin.java
@@ -189,9 +189,9 @@ public class OpenAPSAMAPlugin extends PluginBase implements APSInterface {
}
- if (!hardLimits.checkOnlyHardLimits(profile.getDia(), "dia", hardLimits.getMINDIA(), hardLimits.getMAXDIA()))
+ if (!hardLimits.checkOnlyHardLimits(profile.getDia(), "dia", hardLimits.minDia(), hardLimits.maxDia()))
return;
- if (!hardLimits.checkOnlyHardLimits(profile.getIcTimeFromMidnight(Profile.secondsFromMidnight()), "carbratio", hardLimits.getMINIC(), hardLimits.getMAXIC()))
+ if (!hardLimits.checkOnlyHardLimits(profile.getIcTimeFromMidnight(Profile.secondsFromMidnight()), "carbratio", hardLimits.minIC(), hardLimits.maxIC()))
return;
if (!hardLimits.checkOnlyHardLimits(profile.getIsfMgdl(), "sens", hardLimits.getMINISF(), hardLimits.getMAXISF()))
return;
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMB/OpenAPSSMBPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMB/OpenAPSSMBPlugin.java
index b952a6a909..e631a84955 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMB/OpenAPSSMBPlugin.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/aps/openAPSSMB/OpenAPSSMBPlugin.java
@@ -220,9 +220,9 @@ public class OpenAPSSMBPlugin extends PluginBase implements APSInterface, Constr
}
- if (!hardLimits.checkOnlyHardLimits(profile.getDia(), "dia", hardLimits.getMINDIA(), hardLimits.getMAXDIA()))
+ if (!hardLimits.checkOnlyHardLimits(profile.getDia(), "dia", hardLimits.minDia(), hardLimits.maxDia()))
return;
- if (!hardLimits.checkOnlyHardLimits(profile.getIcTimeFromMidnight(Profile.secondsFromMidnight()), "carbratio", hardLimits.getMINIC(), hardLimits.getMAXIC()))
+ if (!hardLimits.checkOnlyHardLimits(profile.getIcTimeFromMidnight(Profile.secondsFromMidnight()), "carbratio", hardLimits.minIC(), hardLimits.maxIC()))
return;
if (!hardLimits.checkOnlyHardLimits(profile.getIsfMgdl(), "sens", hardLimits.getMINISF(), hardLimits.getMAXISF()))
return;
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/profile/local/LocalProfileFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/profile/local/LocalProfileFragment.kt
index b0a1203170..b8bcd244ea 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/profile/local/LocalProfileFragment.kt
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/profile/local/LocalProfileFragment.kt
@@ -106,9 +106,9 @@ class LocalProfileFragment : DaggerFragment() {
localprofile_name.removeTextChangedListener(textWatch)
localprofile_name.setText(currentProfile.name)
localprofile_name.addTextChangedListener(textWatch)
- localprofile_dia.setParams(currentProfile.dia, hardLimits.MINDIA, hardLimits.MAXDIA, 0.1, DecimalFormat("0.0"), false, localprofile_save, textWatch)
+ localprofile_dia.setParams(currentProfile.dia, hardLimits.minDia(), hardLimits.maxDia(), 0.1, DecimalFormat("0.0"), false, localprofile_save, textWatch)
localprofile_dia.tag = "LP_DIA"
- TimeListEdit(context, aapsLogger, dateUtil, view, R.id.localprofile_ic, "IC", resourceHelper.gs(R.string.ic_label), currentProfile.ic, null, hardLimits.MINIC, hardLimits.MAXIC, 0.1, DecimalFormat("0.0"), save)
+ TimeListEdit(context, aapsLogger, dateUtil, view, R.id.localprofile_ic, "IC", resourceHelper.gs(R.string.ic_label), currentProfile.ic, null, hardLimits.minIC(), hardLimits.maxIC(), 0.1, DecimalFormat("0.0"), save)
basalView = TimeListEdit(context, aapsLogger, dateUtil, view, R.id.localprofile_basal, "BASAL", resourceHelper.gs(R.string.basal_label) + ": " + sumLabel(), currentProfile.basal, null, pumpDescription.basalMinimumRate, 10.0, 0.01, DecimalFormat("0.00"), save)
if (units == Constants.MGDL) {
TimeListEdit(context, aapsLogger, dateUtil, view, R.id.localprofile_isf, "ISF", resourceHelper.gs(R.string.isf_label), currentProfile.isf, null, hardLimits.MINISF, hardLimits.MAXISF, 1.0, DecimalFormat("0"), save)
diff --git a/app/src/main/java/info/nightscout/androidaps/utils/HardLimits.kt b/app/src/main/java/info/nightscout/androidaps/utils/HardLimits.kt
index 37b0c0beb6..74b6743bc8 100644
--- a/app/src/main/java/info/nightscout/androidaps/utils/HardLimits.kt
+++ b/app/src/main/java/info/nightscout/androidaps/utils/HardLimits.kt
@@ -24,6 +24,7 @@ class HardLimits @Inject constructor(
val TEENAGE = 1
val ADULT = 2
val RESISTANTADULT = 3
+ val PREGNANT = 3
val MAXBOLUS = doubleArrayOf(5.0, 10.0, 17.0, 25.0)
// Very Hard Limits Ranges
@@ -36,10 +37,10 @@ class HardLimits @Inject constructor(
val VERY_HARD_LIMIT_TEMP_MIN_BG = intArrayOf(72, 180)
val VERY_HARD_LIMIT_TEMP_MAX_BG = intArrayOf(72, 270)
val VERY_HARD_LIMIT_TEMP_TARGET_BG = intArrayOf(72, 200)
- val MINDIA = 5.0
- val MAXDIA = 7.0
- val MINIC = 2.0
- val MAXIC = 100.0
+ val MINDIA = doubleArrayOf(5.0, 5.0, 5.0, 5.0)
+ val MAXDIA = doubleArrayOf(7.0, 7.0, 7.0, 10.0)
+ val MINIC = doubleArrayOf(2.0, 2.0, 2.0, 0.5)
+ val MAXIC = doubleArrayOf(100.0, 100.0, 100.0, 100.0)
val MINISF = 2.0 // mgdl
val MAXISF = 720.0 // mgdl
val MAXIOB_AMA = doubleArrayOf(3.0, 5.0, 7.0, 12.0)
@@ -57,6 +58,7 @@ class HardLimits @Inject constructor(
else if (sp_age == resourceHelper.gs(R.string.key_teenage)) TEENAGE
else if (sp_age == resourceHelper.gs(R.string.key_adult)) ADULT
else if (sp_age == resourceHelper.gs(R.string.key_resistantadult)) RESISTANTADULT
+ else if (sp_age == resourceHelper.gs(R.string.key_resistantadult)) PREGNANT
else ADULT
return age
}
@@ -77,6 +79,22 @@ class HardLimits @Inject constructor(
return MAXBASAL[loadAge()]
}
+ fun minDia(): Double {
+ return MINDIA[loadAge()]
+ }
+
+ fun maxDia(): Double {
+ return MAXDIA[loadAge()]
+ }
+
+ fun minIC(): Double {
+ return MINIC[loadAge()]
+ }
+
+ fun maxIC(): Double {
+ return MAXIC[loadAge()]
+ }
+
// safety checks
fun checkOnlyHardLimits(value: Double, valueName: String?, lowLimit: Double, highLimit: Double): Boolean {
return value == verifyHardLimits(value, valueName, lowLimit, highLimit)
@@ -96,4 +114,4 @@ class HardLimits @Inject constructor(
}
return newvalue
}
-}
\ No newline at end of file
+}
diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml
index 9d3c758f57..b8fb302f4d 100644
--- a/app/src/main/res/values/arrays.xml
+++ b/app/src/main/res/values/arrays.xml
@@ -77,12 +77,14 @@
- @string/teenage
- @string/adult
- @string/resistantadult
+ - @string/pregnant
- @string/key_child
- @string/key_teenage
- @string/key_adult
- @string/key_resistantadult
+ - @string/key_pregnant
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 9b6011b98e..bdaf216ceb 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -469,11 +469,13 @@
Teenage
Adult
Insulin resistant adult
+ Pregnancy
age
child
teenage
adult
resistantadult
+ pregnant
Please select patient age to setup safety limits
Patient name
Please provide patient name or nickname to differentiate among multiple setups