move evaluation of always_use_shortavg setting to the OAPS plugins
For the overview and the watch we still may use the standard delta, even if this setting is enabled. (Also good to check that it is the same as in xDrip e.g.)
This commit is contained in:
parent
bcf15fac9e
commit
fc85deb62d
3 changed files with 17 additions and 3 deletions
|
@ -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);
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package info.nightscout.androidaps.plugins.OpenAPSAMA;
|
package info.nightscout.androidaps.plugins.OpenAPSAMA;
|
||||||
|
|
||||||
|
import android.preference.PreferenceManager;
|
||||||
|
|
||||||
import com.eclipsesource.v8.JavaVoidCallback;
|
import com.eclipsesource.v8.JavaVoidCallback;
|
||||||
import com.eclipsesource.v8.V8;
|
import com.eclipsesource.v8.V8;
|
||||||
import com.eclipsesource.v8.V8Array;
|
import com.eclipsesource.v8.V8Array;
|
||||||
|
@ -243,7 +245,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(PreferenceManager.getDefaultSharedPreferences(MainApp.instance()).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);
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package info.nightscout.androidaps.plugins.OpenAPSMA;
|
package info.nightscout.androidaps.plugins.OpenAPSMA;
|
||||||
|
|
||||||
|
import android.preference.PreferenceManager;
|
||||||
|
|
||||||
import com.eclipsesource.v8.JavaVoidCallback;
|
import com.eclipsesource.v8.JavaVoidCallback;
|
||||||
import com.eclipsesource.v8.V8;
|
import com.eclipsesource.v8.V8;
|
||||||
import com.eclipsesource.v8.V8Array;
|
import com.eclipsesource.v8.V8Array;
|
||||||
|
@ -13,6 +15,7 @@ import org.slf4j.LoggerFactory;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
import info.nightscout.androidaps.Config;
|
import info.nightscout.androidaps.Config;
|
||||||
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.data.GlucoseStatus;
|
import info.nightscout.androidaps.data.GlucoseStatus;
|
||||||
import info.nightscout.androidaps.data.IobTotal;
|
import info.nightscout.androidaps.data.IobTotal;
|
||||||
import info.nightscout.androidaps.data.MealData;
|
import info.nightscout.androidaps.data.MealData;
|
||||||
|
@ -251,7 +254,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(PreferenceManager.getDefaultSharedPreferences(MainApp.instance()).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);
|
||||||
|
|
Loading…
Reference in a new issue