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
|
@ -131,7 +131,7 @@ public class GlucoseStatus {
|
|||
|
||||
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;
|
||||
} else {
|
||||
status.delta = average(last_deltas);
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package info.nightscout.androidaps.plugins.OpenAPSAMA;
|
||||
|
||||
import android.preference.PreferenceManager;
|
||||
|
||||
import com.eclipsesource.v8.JavaVoidCallback;
|
||||
import com.eclipsesource.v8.V8;
|
||||
import com.eclipsesource.v8.V8Array;
|
||||
|
@ -243,7 +245,12 @@ public class DetermineBasalAdapterAMAJS {
|
|||
|
||||
mGlucoseStatus = new V8Object(mV8rt);
|
||||
mGlucoseStatus.add("glucose", glucoseStatus.glucose);
|
||||
|
||||
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("long_avgdelta", glucoseStatus.long_avgdelta);
|
||||
mV8rt.add(PARAM_glucoseStatus, mGlucoseStatus);
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package info.nightscout.androidaps.plugins.OpenAPSMA;
|
||||
|
||||
import android.preference.PreferenceManager;
|
||||
|
||||
import com.eclipsesource.v8.JavaVoidCallback;
|
||||
import com.eclipsesource.v8.V8;
|
||||
import com.eclipsesource.v8.V8Array;
|
||||
|
@ -13,6 +15,7 @@ import org.slf4j.LoggerFactory;
|
|||
import java.io.IOException;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.data.GlucoseStatus;
|
||||
import info.nightscout.androidaps.data.IobTotal;
|
||||
import info.nightscout.androidaps.data.MealData;
|
||||
|
@ -251,7 +254,11 @@ public class DetermineBasalAdapterMAJS {
|
|||
mIobData.add("hightempinsulin", iobData.hightempinsulin);
|
||||
|
||||
mGlucoseStatus.add("glucose", glucoseStatus.glucose);
|
||||
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);
|
||||
|
||||
mMealData.add("carbs", mealData.carbs);
|
||||
|
|
Loading…
Reference in a new issue