Merge pull request #233 from AdrianLxM/xdripstatusline

move evaluation of always_use_shortavg setting to the OAPS plugins
This commit is contained in:
Milos Kozak 2017-05-10 21:37:14 +02:00 committed by GitHub
commit 7ff7aafc09
3 changed files with 13 additions and 3 deletions

View file

@ -131,7 +131,7 @@ public class GlucoseStatus {
status.short_avgdelta = average(short_deltas); status.short_avgdelta = average(short_deltas);
if (prefs.getBoolean("always_use_shortavg", false) || last_deltas.isEmpty()) { if (last_deltas.isEmpty()) {
status.delta = status.short_avgdelta; status.delta = status.short_avgdelta;
} else { } else {
status.delta = average(last_deltas); status.delta = average(last_deltas);

View file

@ -243,7 +243,12 @@ public class DetermineBasalAdapterAMAJS {
mGlucoseStatus = new V8Object(mV8rt); mGlucoseStatus = new V8Object(mV8rt);
mGlucoseStatus.add("glucose", glucoseStatus.glucose); mGlucoseStatus.add("glucose", glucoseStatus.glucose);
mGlucoseStatus.add("delta", glucoseStatus.delta);
if(SP.getBoolean("always_use_shortavg", false)){
mGlucoseStatus.add("delta", glucoseStatus.short_avgdelta);
} else {
mGlucoseStatus.add("delta", glucoseStatus.delta);
}
mGlucoseStatus.add("short_avgdelta", glucoseStatus.short_avgdelta); mGlucoseStatus.add("short_avgdelta", glucoseStatus.short_avgdelta);
mGlucoseStatus.add("long_avgdelta", glucoseStatus.long_avgdelta); mGlucoseStatus.add("long_avgdelta", glucoseStatus.long_avgdelta);
mV8rt.add(PARAM_glucoseStatus, mGlucoseStatus); mV8rt.add(PARAM_glucoseStatus, mGlucoseStatus);

View file

@ -19,6 +19,7 @@ import info.nightscout.androidaps.data.MealData;
import info.nightscout.androidaps.interfaces.PumpInterface; import info.nightscout.androidaps.interfaces.PumpInterface;
import info.nightscout.androidaps.plugins.Loop.ScriptReader; import info.nightscout.androidaps.plugins.Loop.ScriptReader;
import info.nightscout.androidaps.plugins.NSClientInternal.data.NSProfile; import info.nightscout.androidaps.plugins.NSClientInternal.data.NSProfile;
import info.nightscout.utils.SP;
public class DetermineBasalAdapterMAJS { public class DetermineBasalAdapterMAJS {
private static Logger log = LoggerFactory.getLogger(DetermineBasalAdapterMAJS.class); private static Logger log = LoggerFactory.getLogger(DetermineBasalAdapterMAJS.class);
@ -251,7 +252,11 @@ public class DetermineBasalAdapterMAJS {
mIobData.add("hightempinsulin", iobData.hightempinsulin); mIobData.add("hightempinsulin", iobData.hightempinsulin);
mGlucoseStatus.add("glucose", glucoseStatus.glucose); mGlucoseStatus.add("glucose", glucoseStatus.glucose);
mGlucoseStatus.add("delta", glucoseStatus.delta); if(SP.getBoolean("always_use_shortavg", false)){
mGlucoseStatus.add("delta", glucoseStatus.short_avgdelta);
} else {
mGlucoseStatus.add("delta", glucoseStatus.delta);
}
mGlucoseStatus.add("avgdelta", glucoseStatus.avgdelta); mGlucoseStatus.add("avgdelta", glucoseStatus.avgdelta);
mMealData.add("carbs", mealData.carbs); mMealData.add("carbs", mealData.carbs);