Merge pull request #404 from kakoni/master

Adding out_units support for determine-basal.js
This commit is contained in:
Milos Kozak 2017-08-29 18:23:36 +02:00 committed by GitHub
commit 13b8a9ecf2
2 changed files with 12 additions and 0 deletions

View file

@ -14,6 +14,7 @@ import java.io.IOException;
import java.util.Date; import java.util.Date;
import info.nightscout.androidaps.Config; import info.nightscout.androidaps.Config;
import info.nightscout.androidaps.Constants;
import info.nightscout.androidaps.MainApp; 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;
@ -224,6 +225,11 @@ public class DetermineBasalAdapterAMAJS {
mProfile.add("temptargetSet", tempTargetSet); mProfile.add("temptargetSet", tempTargetSet);
mProfile.add("autosens_adjust_targets", SP.getBoolean("openapsama_autosens_adjusttargets", true)); mProfile.add("autosens_adjust_targets", SP.getBoolean("openapsama_autosens_adjusttargets", true));
mProfile.add("min_5m_carbimpact", SP.getDouble("openapsama_min_5m_carbimpact", 3d)); mProfile.add("min_5m_carbimpact", SP.getDouble("openapsama_min_5m_carbimpact", 3d));
if (units.equals(Constants.MMOL)) {
mProfile.add("out_units", "mmol/L");
}
mV8rt.add(PARAM_profile, mProfile); mV8rt.add(PARAM_profile, mProfile);
mCurrentTemp = new V8Object(mV8rt); mCurrentTemp = new V8Object(mV8rt);

View file

@ -13,6 +13,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.Constants;
import info.nightscout.androidaps.MainApp; 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;
@ -242,6 +243,11 @@ public class DetermineBasalAdapterMAJS {
mProfile.add("sens", Profile.toMgdl(profile.getIsf().doubleValue(), units)); mProfile.add("sens", Profile.toMgdl(profile.getIsf().doubleValue(), units));
mProfile.add("current_basal", pump.getBaseBasalRate()); mProfile.add("current_basal", pump.getBaseBasalRate());
if (units.equals(Constants.MMOL)) {
mProfile.add("out_units", "mmol/L");
}
mCurrentTemp.add("duration", MainApp.getConfigBuilder().getTempBasalRemainingMinutesFromHistory()); mCurrentTemp.add("duration", MainApp.getConfigBuilder().getTempBasalRemainingMinutesFromHistory());
mCurrentTemp.add("rate", MainApp.getConfigBuilder().getTempBasalAbsoluteRateHistory()); mCurrentTemp.add("rate", MainApp.getConfigBuilder().getTempBasalAbsoluteRateHistory());