do not calculate autosens for MA

This commit is contained in:
Milos Kozak 2017-01-30 15:19:50 +01:00
parent 90924e607f
commit 8d0c1dcacf
2 changed files with 9 additions and 5 deletions

View file

@ -37,7 +37,7 @@
<ConfirmationsSetting value="0" id="Add" /> <ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" /> <ConfirmationsSetting value="0" id="Remove" />
</component> </component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK"> <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" /> <output url="file://$PROJECT_DIR$/build/classes" />
</component> </component>
<component name="ProjectType"> <component name="ProjectType">

View file

@ -6,8 +6,10 @@ import java.util.List;
import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.db.BgReading; import info.nightscout.androidaps.db.BgReading;
import info.nightscout.androidaps.db.Treatment; import info.nightscout.androidaps.db.Treatment;
import info.nightscout.androidaps.interfaces.PluginBase;
import info.nightscout.androidaps.plugins.OpenAPSAMA.Autosens; import info.nightscout.androidaps.plugins.OpenAPSAMA.Autosens;
import info.nightscout.androidaps.plugins.OpenAPSAMA.AutosensResult; import info.nightscout.androidaps.plugins.OpenAPSAMA.AutosensResult;
import info.nightscout.androidaps.plugins.OpenAPSAMA.OpenAPSAMAPlugin;
import info.nightscout.client.data.NSProfile; import info.nightscout.client.data.NSProfile;
/** /**
@ -32,10 +34,12 @@ public class MealData {
if (t > dia_ago && t <= now) { if (t > dia_ago && t <= now) {
if (treatment.carbs >= 1) { if (treatment.carbs >= 1) {
carbs += treatment.carbs; carbs += treatment.carbs;
AutosensResult result = Autosens.detectSensitivityandCarbAbsorption(bgReadings, t); if (MainApp.getSpecificPlugin(OpenAPSAMAPlugin.class).isEnabled(PluginBase.APS)) {
double myCarbsAbsorbed = result.carbsAbsorbed; AutosensResult result = Autosens.detectSensitivityandCarbAbsorption(bgReadings, t);
double myMealCOB = Math.max(0, carbs - myCarbsAbsorbed); double myCarbsAbsorbed = result.carbsAbsorbed;
mealCOB = Math.max(mealCOB, myMealCOB); double myMealCOB = Math.max(0, carbs - myCarbsAbsorbed);
mealCOB = Math.max(mealCOB, myMealCOB);
}
} }
if (treatment.insulin > 0 && treatment.mealBolus) { if (treatment.insulin > 0 && treatment.mealBolus) {
boluses += treatment.insulin; boluses += treatment.insulin;