allow UAM only if oref1 sensitivity plugin is selected
This commit is contained in:
parent
94233d28e1
commit
c1bbaab8e1
|
@ -42,6 +42,10 @@ public class ConstraintChecker implements ConstraintsInterface {
|
||||||
return isSMBModeEnabled(new Constraint<>(true));
|
return isSMBModeEnabled(new Constraint<>(true));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Constraint<Boolean> isUAMEnabled() {
|
||||||
|
return isUAMEnabled(new Constraint<>(true));
|
||||||
|
}
|
||||||
|
|
||||||
public Constraint<Boolean> isAdvancedFilteringEnabled() {
|
public Constraint<Boolean> isAdvancedFilteringEnabled() {
|
||||||
return isAdvancedFilteringEnabled(new Constraint<>(true));
|
return isAdvancedFilteringEnabled(new Constraint<>(true));
|
||||||
}
|
}
|
||||||
|
@ -130,6 +134,18 @@ public class ConstraintChecker implements ConstraintsInterface {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Constraint<Boolean> isUAMEnabled(Constraint<Boolean> value) {
|
||||||
|
|
||||||
|
ArrayList<PluginBase> constraintsPlugins = mainApp.getSpecificPluginsListByInterface(ConstraintsInterface.class);
|
||||||
|
for (PluginBase p : constraintsPlugins) {
|
||||||
|
ConstraintsInterface constraint = (ConstraintsInterface) p;
|
||||||
|
if (!p.isEnabled(PluginType.CONSTRAINTS)) continue;
|
||||||
|
constraint.isUAMEnabled(value);
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Constraint<Boolean> isAdvancedFilteringEnabled(Constraint<Boolean> value) {
|
public Constraint<Boolean> isAdvancedFilteringEnabled(Constraint<Boolean> value) {
|
||||||
ArrayList<PluginBase> constraintsPlugins = mainApp.getSpecificPluginsListByInterface(ConstraintsInterface.class);
|
ArrayList<PluginBase> constraintsPlugins = mainApp.getSpecificPluginsListByInterface(ConstraintsInterface.class);
|
||||||
|
|
|
@ -27,6 +27,10 @@ public interface ConstraintsInterface {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
default Constraint<Boolean> isUAMEnabled(Constraint<Boolean> value) {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
default Constraint<Boolean> isAdvancedFilteringEnabled(Constraint<Boolean> value) {
|
default Constraint<Boolean> isAdvancedFilteringEnabled(Constraint<Boolean> value) {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ import info.nightscout.androidaps.plugins.OpenAPSMA.OpenAPSMAPlugin;
|
||||||
import info.nightscout.androidaps.plugins.OpenAPSSMB.OpenAPSSMBPlugin;
|
import info.nightscout.androidaps.plugins.OpenAPSSMB.OpenAPSSMBPlugin;
|
||||||
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
|
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
|
||||||
import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
|
import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
|
||||||
|
import info.nightscout.androidaps.plugins.Sensitivity.SensitivityOref1Plugin;
|
||||||
import info.nightscout.utils.DecimalFormatter;
|
import info.nightscout.utils.DecimalFormatter;
|
||||||
import info.nightscout.utils.HardLimits;
|
import info.nightscout.utils.HardLimits;
|
||||||
import info.nightscout.utils.Round;
|
import info.nightscout.utils.Round;
|
||||||
|
@ -94,6 +95,17 @@ public class SafetyPlugin extends PluginBase implements ConstraintsInterface {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Constraint<Boolean> isUAMEnabled(Constraint<Boolean> value) {
|
||||||
|
boolean enabled = SP.getBoolean(R.string.key_use_uam, false);
|
||||||
|
if (!enabled)
|
||||||
|
value.set(false, MainApp.gs(R.string.uamdisabledinpreferences), this);
|
||||||
|
boolean oref1Enabled = SensitivityOref1Plugin.getPlugin().isEnabled(PluginType.SENSITIVITY);
|
||||||
|
if (!oref1Enabled)
|
||||||
|
value.set(false, MainApp.gs(R.string.uamdisabledoref1notselected), this);
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Constraint<Boolean> isAdvancedFilteringEnabled(Constraint<Boolean> value) {
|
public Constraint<Boolean> isAdvancedFilteringEnabled(Constraint<Boolean> value) {
|
||||||
BgSourceInterface bgSource = ConfigBuilderPlugin.getPlugin().getActiveBgSource();
|
BgSourceInterface bgSource = ConfigBuilderPlugin.getPlugin().getActiveBgSource();
|
||||||
|
|
|
@ -211,6 +211,7 @@ public class DetermineBasalAdapterSMBJS {
|
||||||
double autosensDataRatio,
|
double autosensDataRatio,
|
||||||
boolean tempTargetSet,
|
boolean tempTargetSet,
|
||||||
boolean microBolusAllowed,
|
boolean microBolusAllowed,
|
||||||
|
boolean uamAllowed,
|
||||||
boolean advancedFiltering
|
boolean advancedFiltering
|
||||||
) throws JSONException {
|
) throws JSONException {
|
||||||
|
|
||||||
|
@ -247,7 +248,7 @@ public class DetermineBasalAdapterSMBJS {
|
||||||
// mProfile.put("min_5m_carbimpact", SP.getDouble(R.string.key_openapsama_min_5m_carbimpact, SMBDefaults.min_5m_carbimpact));
|
// mProfile.put("min_5m_carbimpact", SP.getDouble(R.string.key_openapsama_min_5m_carbimpact, SMBDefaults.min_5m_carbimpact));
|
||||||
//}
|
//}
|
||||||
mProfile.put("remainingCarbsCap", SMBDefaults.remainingCarbsCap);
|
mProfile.put("remainingCarbsCap", SMBDefaults.remainingCarbsCap);
|
||||||
mProfile.put("enableUAM", SP.getBoolean(R.string.key_use_uam, false));
|
mProfile.put("enableUAM", uamAllowed);
|
||||||
mProfile.put("A52_risk_enable", SMBDefaults.A52_risk_enable);
|
mProfile.put("A52_risk_enable", SMBDefaults.A52_risk_enable);
|
||||||
mProfile.put("enableSMB_with_COB", SP.getBoolean(R.string.key_enableSMB_with_COB, false));
|
mProfile.put("enableSMB_with_COB", SP.getBoolean(R.string.key_enableSMB_with_COB, false));
|
||||||
mProfile.put("enableSMB_with_temptarget", SP.getBoolean(R.string.key_enableSMB_with_temptarget, false));
|
mProfile.put("enableSMB_with_temptarget", SP.getBoolean(R.string.key_enableSMB_with_temptarget, false));
|
||||||
|
|
|
@ -198,6 +198,10 @@ public class OpenAPSSMBPlugin extends PluginBase implements APSInterface {
|
||||||
MainApp.getConstraintChecker().isAdvancedFilteringEnabled(advancedFiltering);
|
MainApp.getConstraintChecker().isAdvancedFilteringEnabled(advancedFiltering);
|
||||||
inputConstraints.copyReasons(advancedFiltering);
|
inputConstraints.copyReasons(advancedFiltering);
|
||||||
|
|
||||||
|
Constraint<Boolean> uam = new Constraint<>(true);
|
||||||
|
MainApp.getConstraintChecker().isUAMEnabled(uam);
|
||||||
|
inputConstraints.copyReasons(uam);
|
||||||
|
|
||||||
if (L.isEnabled(L.APS))
|
if (L.isEnabled(L.APS))
|
||||||
Profiler.log(log, "detectSensitivityandCarbAbsorption()", startPart);
|
Profiler.log(log, "detectSensitivityandCarbAbsorption()", startPart);
|
||||||
if (L.isEnabled(L.APS))
|
if (L.isEnabled(L.APS))
|
||||||
|
@ -209,6 +213,7 @@ public class OpenAPSSMBPlugin extends PluginBase implements APSInterface {
|
||||||
lastAutosensResult.ratio, //autosensDataRatio
|
lastAutosensResult.ratio, //autosensDataRatio
|
||||||
isTempTarget,
|
isTempTarget,
|
||||||
smbAllowed.value(),
|
smbAllowed.value(),
|
||||||
|
uam.value(),
|
||||||
advancedFiltering.value()
|
advancedFiltering.value()
|
||||||
);
|
);
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
|
|
|
@ -1007,6 +1007,8 @@
|
||||||
<string name="closedmodedisabledinpreferences">Closed loop mode disabled in preferences</string>
|
<string name="closedmodedisabledinpreferences">Closed loop mode disabled in preferences</string>
|
||||||
<string name="autosensdisabledinpreferences">Autosens disabled in preferences</string>
|
<string name="autosensdisabledinpreferences">Autosens disabled in preferences</string>
|
||||||
<string name="smbdisabledinpreferences">SMB disabled in preferences</string>
|
<string name="smbdisabledinpreferences">SMB disabled in preferences</string>
|
||||||
|
<string name="uamdisabledinpreferences">UAM disabled in preferences</string>
|
||||||
|
<string name="uamdisabledoref1notselected">UAM disabled because it rely on Oref1 sensitivity plugin</string>
|
||||||
<string name="limitingbasalratio">Limiting max basal rate to %1$.2f U/h because of %2$s</string>
|
<string name="limitingbasalratio">Limiting max basal rate to %1$.2f U/h because of %2$s</string>
|
||||||
<string name="pumplimit">pump limit</string>
|
<string name="pumplimit">pump limit</string>
|
||||||
<string name="key_openapsma_max_basal" translatable="false">openapsma_max_basal</string>
|
<string name="key_openapsma_max_basal" translatable="false">openapsma_max_basal</string>
|
||||||
|
|
Loading…
Reference in a new issue