renaming before adding AMA
This commit is contained in:
parent
fe75298263
commit
faf8e07248
15 changed files with 69 additions and 86 deletions
|
@ -7,7 +7,7 @@ public class Config {
|
|||
// MAIN FUCTIONALITY
|
||||
public static final boolean APS = BuildConfig.APS;
|
||||
// PLUGINS
|
||||
public static final boolean OPENAPSMAENABLED = APS;
|
||||
public static final boolean OPENAPSENABLED = APS;
|
||||
public static final boolean LOOPENABLED = APS;
|
||||
public static final boolean WEAR = BuildConfig.WEAR;
|
||||
|
||||
|
|
|
@ -82,7 +82,7 @@ public class MainApp extends Application {
|
|||
pluginsList.add(MDIFragment.getPlugin());
|
||||
pluginsList.add(VirtualPumpFragment.getPlugin());
|
||||
if (Config.LOOPENABLED) pluginsList.add(LoopFragment.getPlugin());
|
||||
if (Config.OPENAPSMAENABLED) pluginsList.add(OpenAPSMAFragment.getPlugin());
|
||||
if (Config.OPENAPSENABLED) pluginsList.add(OpenAPSMAFragment.getPlugin());
|
||||
pluginsList.add(NSProfileFragment.getPlugin());
|
||||
pluginsList.add(SimpleProfileFragment.getPlugin());
|
||||
pluginsList.add(LocalProfileFragment.getPlugin());
|
||||
|
|
|
@ -15,7 +15,6 @@ import info.nightscout.androidaps.events.EventPreferenceChange;
|
|||
import info.nightscout.androidaps.events.EventRefreshGui;
|
||||
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||
import info.nightscout.androidaps.plugins.DanaR.BluetoothDevicePreference;
|
||||
import info.nightscout.androidaps.plugins.DanaR.DanaRFragment;
|
||||
import info.nightscout.androidaps.plugins.DanaR.DanaRPlugin;
|
||||
import info.nightscout.androidaps.plugins.DanaRKorean.DanaRKoreanPlugin;
|
||||
import info.nightscout.utils.LocaleHelper;
|
||||
|
@ -85,7 +84,7 @@ public class PreferencesActivity extends PreferenceActivity implements SharedPre
|
|||
addPreferencesFromResource(R.xml.pref_treatments);
|
||||
if (Config.APS)
|
||||
addPreferencesFromResource(R.xml.pref_closedmode);
|
||||
if (Config.OPENAPSMAENABLED)
|
||||
if (Config.OPENAPSENABLED)
|
||||
addPreferencesFromResource(R.xml.pref_openapsma);
|
||||
addPreferencesFromResource(R.xml.pref_nightscout);
|
||||
if (Config.DANAR) {
|
||||
|
|
|
@ -4,7 +4,6 @@ import java.util.List;
|
|||
|
||||
import info.nightscout.androidaps.db.Treatment;
|
||||
import info.nightscout.androidaps.plugins.OpenAPSMA.IobTotal;
|
||||
import info.nightscout.androidaps.plugins.Treatments.TreatmentsFragment;
|
||||
import info.nightscout.androidaps.plugins.Treatments.TreatmentsPlugin;
|
||||
|
||||
/**
|
||||
|
|
|
@ -15,7 +15,6 @@ import info.nightscout.androidaps.MainApp;
|
|||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||
import info.nightscout.androidaps.interfaces.ProfileInterface;
|
||||
import info.nightscout.androidaps.plugins.OpenAPSMA.OpenAPSMAPlugin;
|
||||
import info.nightscout.client.data.NSProfile;
|
||||
import info.nightscout.utils.DecimalFormatter;
|
||||
import info.nightscout.utils.SafeParse;
|
||||
|
|
|
@ -43,13 +43,12 @@ import info.nightscout.androidaps.plugins.DanaR.comm.MsgError;
|
|||
import info.nightscout.androidaps.plugins.Loop.APSResult;
|
||||
import info.nightscout.androidaps.plugins.Loop.DeviceStatus;
|
||||
import info.nightscout.androidaps.plugins.Loop.LoopPlugin;
|
||||
import info.nightscout.androidaps.plugins.OpenAPSMA.DetermineBasalResult;
|
||||
import info.nightscout.androidaps.plugins.OpenAPSMA.DetermineBasalResultMA;
|
||||
import info.nightscout.androidaps.plugins.Overview.Dialogs.BolusProgressDialog;
|
||||
import info.nightscout.androidaps.plugins.Actions.dialogs.NewExtendedBolusDialog;
|
||||
import info.nightscout.androidaps.plugins.Overview.Notification;
|
||||
import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification;
|
||||
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
|
||||
import info.nightscout.androidaps.plugins.SmsCommunicator.SmsCommunicatorPlugin;
|
||||
import info.nightscout.client.data.DbLogger;
|
||||
import info.nightscout.client.data.NSProfile;
|
||||
import info.nightscout.utils.DateUtil;
|
||||
|
@ -901,8 +900,8 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
|
|||
apsResult.json().put("timestamp", DateUtil.toISOString(lastRun.lastAPSRun));
|
||||
deviceStatus.suggested = apsResult.json();
|
||||
|
||||
if (lastRun.request instanceof DetermineBasalResult) {
|
||||
DetermineBasalResult result = (DetermineBasalResult) lastRun.request;
|
||||
if (lastRun.request instanceof DetermineBasalResultMA) {
|
||||
DetermineBasalResultMA result = (DetermineBasalResultMA) lastRun.request;
|
||||
deviceStatus.iob = result.iob.json();
|
||||
deviceStatus.iob.put("time", DateUtil.toISOString(lastRun.lastAPSRun));
|
||||
}
|
||||
|
|
|
@ -19,12 +19,11 @@ import info.nightscout.androidaps.Config;
|
|||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||
import info.nightscout.androidaps.db.DatabaseHelper;
|
||||
import info.nightscout.androidaps.plugins.Loop.ScriptReader;
|
||||
import info.nightscout.androidaps.plugins.Treatments.TreatmentsFragment;
|
||||
import info.nightscout.androidaps.plugins.Treatments.TreatmentsPlugin;
|
||||
import info.nightscout.client.data.NSProfile;
|
||||
|
||||
public class DetermineBasalAdapterJS implements Parcelable {
|
||||
private static Logger log = LoggerFactory.getLogger(DetermineBasalAdapterJS.class);
|
||||
public class DetermineBasalAdapterMAJS implements Parcelable {
|
||||
private static Logger log = LoggerFactory.getLogger(DetermineBasalAdapterMAJS.class);
|
||||
|
||||
|
||||
private ScriptReader mScriptReader = null;
|
||||
|
@ -51,7 +50,7 @@ public class DetermineBasalAdapterJS implements Parcelable {
|
|||
* Parcelable implementation
|
||||
* result string for display only
|
||||
**/
|
||||
protected DetermineBasalAdapterJS(Parcel in) {
|
||||
protected DetermineBasalAdapterMAJS(Parcel in) {
|
||||
storedCurrentTemp = in.readString();
|
||||
storedIobData = in.readString();
|
||||
storedGlucoseStatus = in.readString();
|
||||
|
@ -73,15 +72,15 @@ public class DetermineBasalAdapterJS implements Parcelable {
|
|||
return 0;
|
||||
}
|
||||
|
||||
public static final Creator<DetermineBasalAdapterJS> CREATOR = new Creator<DetermineBasalAdapterJS>() {
|
||||
public static final Creator<DetermineBasalAdapterMAJS> CREATOR = new Creator<DetermineBasalAdapterMAJS>() {
|
||||
@Override
|
||||
public DetermineBasalAdapterJS createFromParcel(Parcel in) {
|
||||
return new DetermineBasalAdapterJS(in);
|
||||
public DetermineBasalAdapterMAJS createFromParcel(Parcel in) {
|
||||
return new DetermineBasalAdapterMAJS(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DetermineBasalAdapterJS[] newArray(int size) {
|
||||
return new DetermineBasalAdapterJS[size];
|
||||
public DetermineBasalAdapterMAJS[] newArray(int size) {
|
||||
return new DetermineBasalAdapterMAJS[size];
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -89,7 +88,7 @@ public class DetermineBasalAdapterJS implements Parcelable {
|
|||
* Main code
|
||||
*/
|
||||
|
||||
public DetermineBasalAdapterJS(ScriptReader scriptReader) throws IOException {
|
||||
public DetermineBasalAdapterMAJS(ScriptReader scriptReader) throws IOException {
|
||||
mV8rt = V8.createV8Runtime();
|
||||
mScriptReader = scriptReader;
|
||||
|
||||
|
@ -143,7 +142,7 @@ public class DetermineBasalAdapterJS implements Parcelable {
|
|||
mV8rt.add(PARAM_meal_data, mMealData);
|
||||
}
|
||||
|
||||
public DetermineBasalResult invoke() {
|
||||
public DetermineBasalResultMA invoke() {
|
||||
mV8rt.executeVoidScript(
|
||||
"console.error(\"determine_basal(\"+\n" +
|
||||
"JSON.stringify(" + PARAM_glucoseStatus + ")+ \", \" +\n" +
|
||||
|
@ -170,9 +169,9 @@ public class DetermineBasalAdapterJS implements Parcelable {
|
|||
|
||||
V8Object v8ObjectReuslt = mV8rt.getObject("rT");
|
||||
|
||||
DetermineBasalResult result = null;
|
||||
DetermineBasalResultMA result = null;
|
||||
try {
|
||||
result = new DetermineBasalResult(v8ObjectReuslt, new JSONObject(ret));
|
||||
result = new DetermineBasalResultMA(v8ObjectReuslt, new JSONObject(ret));
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
|
@ -10,7 +10,7 @@ import org.json.JSONObject;
|
|||
|
||||
import info.nightscout.androidaps.plugins.Loop.APSResult;
|
||||
|
||||
public class DetermineBasalResult extends APSResult {
|
||||
public class DetermineBasalResultMA extends APSResult {
|
||||
|
||||
public JSONObject json = new JSONObject();
|
||||
public double eventualBG;
|
||||
|
@ -18,7 +18,7 @@ public class DetermineBasalResult extends APSResult {
|
|||
public String mealAssist;
|
||||
public IobTotal iob;
|
||||
|
||||
public DetermineBasalResult(V8Object result, JSONObject j) {
|
||||
public DetermineBasalResultMA(V8Object result, JSONObject j) {
|
||||
json = j;
|
||||
if (result.contains("error")) {
|
||||
reason = result.getString("error");
|
||||
|
@ -61,17 +61,17 @@ public class DetermineBasalResult extends APSResult {
|
|||
dest.writeString(mealAssist);
|
||||
}
|
||||
|
||||
public final Parcelable.Creator<DetermineBasalResult> CREATOR = new Parcelable.Creator<DetermineBasalResult>() {
|
||||
public DetermineBasalResult createFromParcel(Parcel in) {
|
||||
return new DetermineBasalResult(in);
|
||||
public final Parcelable.Creator<DetermineBasalResultMA> CREATOR = new Parcelable.Creator<DetermineBasalResultMA>() {
|
||||
public DetermineBasalResultMA createFromParcel(Parcel in) {
|
||||
return new DetermineBasalResultMA(in);
|
||||
}
|
||||
|
||||
public DetermineBasalResult[] newArray(int size) {
|
||||
return new DetermineBasalResult[size];
|
||||
public DetermineBasalResultMA[] newArray(int size) {
|
||||
return new DetermineBasalResultMA[size];
|
||||
}
|
||||
};
|
||||
|
||||
private DetermineBasalResult(Parcel in) {
|
||||
private DetermineBasalResultMA(Parcel in) {
|
||||
super(in);
|
||||
try {
|
||||
json = new JSONObject(in.readString());
|
||||
|
@ -83,12 +83,12 @@ public class DetermineBasalResult extends APSResult {
|
|||
mealAssist = in.readString();
|
||||
}
|
||||
|
||||
public DetermineBasalResult() {
|
||||
public DetermineBasalResultMA() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public DetermineBasalResult clone() {
|
||||
DetermineBasalResult newResult = new DetermineBasalResult();
|
||||
public DetermineBasalResultMA clone() {
|
||||
DetermineBasalResultMA newResult = new DetermineBasalResultMA();
|
||||
newResult.reason = new String(reason);
|
||||
newResult.rate = rate;
|
||||
newResult.duration = duration;
|
|
@ -17,9 +17,8 @@ import org.slf4j.LoggerFactory;
|
|||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.interfaces.FragmentBase;
|
||||
import info.nightscout.androidaps.plugins.Loop.APSResult;
|
||||
import info.nightscout.androidaps.plugins.OpenAPSMA.events.EventOpenAPSMAUpdateGui;
|
||||
import info.nightscout.androidaps.plugins.OpenAPSMA.events.EventOpenAPSMAUpdateResultGui;
|
||||
import info.nightscout.androidaps.plugins.OpenAPSMA.events.EventOpenAPSUpdateGui;
|
||||
import info.nightscout.androidaps.plugins.OpenAPSMA.events.EventOpenAPSUpdateResultGui;
|
||||
import info.nightscout.utils.JSONFormatter;
|
||||
|
||||
public class OpenAPSMAFragment extends Fragment implements View.OnClickListener, FragmentBase {
|
||||
|
@ -87,12 +86,12 @@ public class OpenAPSMAFragment extends Fragment implements View.OnClickListener,
|
|||
}
|
||||
|
||||
@Subscribe
|
||||
public void onStatusEvent(final EventOpenAPSMAUpdateGui ev) {
|
||||
public void onStatusEvent(final EventOpenAPSUpdateGui ev) {
|
||||
updateGUI();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onStatusEvent(final EventOpenAPSMAUpdateResultGui ev) {
|
||||
public void onStatusEvent(final EventOpenAPSUpdateResultGui ev) {
|
||||
updateResultGUI(ev.text);
|
||||
}
|
||||
|
||||
|
@ -102,18 +101,18 @@ public class OpenAPSMAFragment extends Fragment implements View.OnClickListener,
|
|||
activity.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
DetermineBasalResult lastAPSResult = getPlugin().lastAPSResult;
|
||||
DetermineBasalResultMA lastAPSResult = getPlugin().lastAPSResult;
|
||||
if (lastAPSResult != null) {
|
||||
resultView.setText(JSONFormatter.format(lastAPSResult.json));
|
||||
requestView.setText(lastAPSResult.toSpanned());
|
||||
}
|
||||
DetermineBasalAdapterJS determineBasalAdapterJS = getPlugin().lastDetermineBasalAdapterJS;
|
||||
if (determineBasalAdapterJS != null) {
|
||||
glucoseStatusView.setText(JSONFormatter.format(determineBasalAdapterJS.getGlucoseStatusParam()));
|
||||
currentTempView.setText(JSONFormatter.format(determineBasalAdapterJS.getCurrentTempParam()));
|
||||
iobDataView.setText(JSONFormatter.format(determineBasalAdapterJS.getIobDataParam()));
|
||||
profileView.setText(JSONFormatter.format(determineBasalAdapterJS.getProfileParam()));
|
||||
mealDataView.setText(JSONFormatter.format(determineBasalAdapterJS.getMealDataParam()));
|
||||
DetermineBasalAdapterMAJS determineBasalAdapterMAJS = getPlugin().lastDetermineBasalAdapterMAJS;
|
||||
if (determineBasalAdapterMAJS != null) {
|
||||
glucoseStatusView.setText(JSONFormatter.format(determineBasalAdapterMAJS.getGlucoseStatusParam()));
|
||||
currentTempView.setText(JSONFormatter.format(determineBasalAdapterMAJS.getCurrentTempParam()));
|
||||
iobDataView.setText(JSONFormatter.format(determineBasalAdapterMAJS.getIobDataParam()));
|
||||
profileView.setText(JSONFormatter.format(determineBasalAdapterMAJS.getProfileParam()));
|
||||
mealDataView.setText(JSONFormatter.format(determineBasalAdapterMAJS.getMealDataParam()));
|
||||
}
|
||||
if (getPlugin().lastAPSRun != null) {
|
||||
lastRunView.setText(getPlugin().lastAPSRun.toLocaleString());
|
||||
|
|
|
@ -1,13 +1,9 @@
|
|||
package info.nightscout.androidaps.plugins.OpenAPSMA;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -18,7 +14,6 @@ import info.nightscout.androidaps.Config;
|
|||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.Services.Intents;
|
||||
import info.nightscout.androidaps.db.DatabaseHelper;
|
||||
import info.nightscout.androidaps.interfaces.APSInterface;
|
||||
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||
|
@ -27,10 +22,9 @@ import info.nightscout.androidaps.interfaces.TempBasalsInterface;
|
|||
import info.nightscout.androidaps.interfaces.TreatmentsInterface;
|
||||
import info.nightscout.androidaps.plugins.Loop.APSResult;
|
||||
import info.nightscout.androidaps.plugins.Loop.ScriptReader;
|
||||
import info.nightscout.androidaps.plugins.OpenAPSMA.events.EventOpenAPSMAUpdateGui;
|
||||
import info.nightscout.androidaps.plugins.OpenAPSMA.events.EventOpenAPSMAUpdateResultGui;
|
||||
import info.nightscout.androidaps.plugins.OpenAPSMA.events.EventOpenAPSUpdateGui;
|
||||
import info.nightscout.androidaps.plugins.OpenAPSMA.events.EventOpenAPSUpdateResultGui;
|
||||
import info.nightscout.androidaps.plugins.Treatments.TreatmentsPlugin;
|
||||
import info.nightscout.client.data.DbLogger;
|
||||
import info.nightscout.client.data.NSProfile;
|
||||
import info.nightscout.utils.DateUtil;
|
||||
import info.nightscout.utils.Round;
|
||||
|
@ -44,9 +38,9 @@ public class OpenAPSMAPlugin implements PluginBase, APSInterface {
|
|||
private static Logger log = LoggerFactory.getLogger(OpenAPSMAPlugin.class);
|
||||
|
||||
// last values
|
||||
DetermineBasalAdapterJS lastDetermineBasalAdapterJS = null;
|
||||
DetermineBasalAdapterMAJS lastDetermineBasalAdapterMAJS = null;
|
||||
Date lastAPSRun = null;
|
||||
DetermineBasalResult lastAPSResult = null;
|
||||
DetermineBasalResultMA lastAPSResult = null;
|
||||
|
||||
boolean fragmentEnabled = false;
|
||||
boolean fragmentVisible = true;
|
||||
|
@ -104,9 +98,9 @@ public class OpenAPSMAPlugin implements PluginBase, APSInterface {
|
|||
@Override
|
||||
public void invoke() {
|
||||
lastAPSResult = null;
|
||||
DetermineBasalAdapterJS determineBasalAdapterJS = null;
|
||||
DetermineBasalAdapterMAJS determineBasalAdapterMAJS = null;
|
||||
try {
|
||||
determineBasalAdapterJS = new DetermineBasalAdapterJS(new ScriptReader(MainApp.instance().getBaseContext()));
|
||||
determineBasalAdapterMAJS = new DetermineBasalAdapterMAJS(new ScriptReader(MainApp.instance().getBaseContext()));
|
||||
} catch (IOException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
return;
|
||||
|
@ -117,28 +111,28 @@ public class OpenAPSMAPlugin implements PluginBase, APSInterface {
|
|||
PumpInterface pump = MainApp.getConfigBuilder();
|
||||
|
||||
if (!isEnabled(PluginBase.APS)) {
|
||||
MainApp.bus().post(new EventOpenAPSMAUpdateResultGui(MainApp.instance().getString(R.string.openapsma_disabled)));
|
||||
MainApp.bus().post(new EventOpenAPSUpdateResultGui(MainApp.instance().getString(R.string.openapsma_disabled)));
|
||||
if (Config.logAPSResult)
|
||||
log.debug(MainApp.instance().getString(R.string.openapsma_disabled));
|
||||
return;
|
||||
}
|
||||
|
||||
if (glucoseStatus == null) {
|
||||
MainApp.bus().post(new EventOpenAPSMAUpdateResultGui(MainApp.instance().getString(R.string.openapsma_noglucosedata)));
|
||||
MainApp.bus().post(new EventOpenAPSUpdateResultGui(MainApp.instance().getString(R.string.openapsma_noglucosedata)));
|
||||
if (Config.logAPSResult)
|
||||
log.debug(MainApp.instance().getString(R.string.openapsma_noglucosedata));
|
||||
return;
|
||||
}
|
||||
|
||||
if (profile == null) {
|
||||
MainApp.bus().post(new EventOpenAPSMAUpdateResultGui(MainApp.instance().getString(R.string.openapsma_noprofile)));
|
||||
MainApp.bus().post(new EventOpenAPSUpdateResultGui(MainApp.instance().getString(R.string.openapsma_noprofile)));
|
||||
if (Config.logAPSResult)
|
||||
log.debug(MainApp.instance().getString(R.string.openapsma_noprofile));
|
||||
return;
|
||||
}
|
||||
|
||||
if (pump == null) {
|
||||
MainApp.bus().post(new EventOpenAPSMAUpdateResultGui(MainApp.instance().getString(R.string.openapsma_nopump)));
|
||||
MainApp.bus().post(new EventOpenAPSUpdateResultGui(MainApp.instance().getString(R.string.openapsma_nopump)));
|
||||
if (Config.logAPSResult)
|
||||
log.debug(MainApp.instance().getString(R.string.openapsma_nopump));
|
||||
return;
|
||||
|
@ -193,37 +187,37 @@ public class OpenAPSMAPlugin implements PluginBase, APSInterface {
|
|||
if (!checkOnlyHardLimits(profile.getMaxDailyBasal(), "max_daily_basal", 0.1, 10)) return;
|
||||
if (!checkOnlyHardLimits(pump.getBaseBasalRate(), "current_basal", 0.01, 5)) return;
|
||||
|
||||
determineBasalAdapterJS.setData(profile, maxIob, maxBasal, minBg, maxBg, targetBg, pump, iobTotal, glucoseStatus, mealData);
|
||||
determineBasalAdapterMAJS.setData(profile, maxIob, maxBasal, minBg, maxBg, targetBg, pump, iobTotal, glucoseStatus, mealData);
|
||||
|
||||
|
||||
DetermineBasalResult determineBasalResult = determineBasalAdapterJS.invoke();
|
||||
DetermineBasalResultMA determineBasalResultMA = determineBasalAdapterMAJS.invoke();
|
||||
// Fix bug determine basal
|
||||
if (determineBasalResult.rate == 0d && determineBasalResult.duration == 0 && !MainApp.getConfigBuilder().isTempBasalInProgress())
|
||||
determineBasalResult.changeRequested = false;
|
||||
if (determineBasalResultMA.rate == 0d && determineBasalResultMA.duration == 0 && !MainApp.getConfigBuilder().isTempBasalInProgress())
|
||||
determineBasalResultMA.changeRequested = false;
|
||||
// limit requests on openloop mode
|
||||
if (!MainApp.getConfigBuilder().isClosedModeEnabled()) {
|
||||
if (MainApp.getConfigBuilder().isTempBasalInProgress() && Math.abs(determineBasalResult.rate - MainApp.getConfigBuilder().getTempBasalAbsoluteRate()) < 0.1)
|
||||
determineBasalResult.changeRequested = false;
|
||||
if (!MainApp.getConfigBuilder().isTempBasalInProgress() && Math.abs(determineBasalResult.rate - MainApp.getConfigBuilder().getBaseBasalRate()) < 0.1)
|
||||
determineBasalResult.changeRequested = false;
|
||||
if (MainApp.getConfigBuilder().isTempBasalInProgress() && Math.abs(determineBasalResultMA.rate - MainApp.getConfigBuilder().getTempBasalAbsoluteRate()) < 0.1)
|
||||
determineBasalResultMA.changeRequested = false;
|
||||
if (!MainApp.getConfigBuilder().isTempBasalInProgress() && Math.abs(determineBasalResultMA.rate - MainApp.getConfigBuilder().getBaseBasalRate()) < 0.1)
|
||||
determineBasalResultMA.changeRequested = false;
|
||||
}
|
||||
|
||||
determineBasalResult.iob = iobTotal;
|
||||
determineBasalResultMA.iob = iobTotal;
|
||||
|
||||
determineBasalAdapterJS.release();
|
||||
determineBasalAdapterMAJS.release();
|
||||
|
||||
try {
|
||||
determineBasalResult.json.put("timestamp", DateUtil.toISOString(now));
|
||||
determineBasalResultMA.json.put("timestamp", DateUtil.toISOString(now));
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
lastDetermineBasalAdapterJS = determineBasalAdapterJS;
|
||||
lastAPSResult = determineBasalResult;
|
||||
lastDetermineBasalAdapterMAJS = determineBasalAdapterMAJS;
|
||||
lastAPSResult = determineBasalResultMA;
|
||||
lastAPSRun = now;
|
||||
MainApp.bus().post(new EventOpenAPSMAUpdateGui());
|
||||
MainApp.bus().post(new EventOpenAPSUpdateGui());
|
||||
|
||||
//deviceStatus.suggested = determineBasalResult.json;
|
||||
//deviceStatus.suggested = determineBasalResultMA.json;
|
||||
}
|
||||
|
||||
// safety checks
|
||||
|
|
|
@ -3,5 +3,5 @@ package info.nightscout.androidaps.plugins.OpenAPSMA.events;
|
|||
/**
|
||||
* Created by mike on 05.08.2016.
|
||||
*/
|
||||
public class EventOpenAPSMAUpdateGui {
|
||||
public class EventOpenAPSUpdateGui {
|
||||
}
|
|
@ -3,10 +3,10 @@ package info.nightscout.androidaps.plugins.OpenAPSMA.events;
|
|||
/**
|
||||
* Created by mike on 05.08.2016.
|
||||
*/
|
||||
public class EventOpenAPSMAUpdateResultGui {
|
||||
public class EventOpenAPSUpdateResultGui {
|
||||
public String text = null;
|
||||
|
||||
public EventOpenAPSMAUpdateResultGui(String text) {
|
||||
public EventOpenAPSUpdateResultGui(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
}
|
|
@ -38,10 +38,8 @@ import info.nightscout.androidaps.MainApp;
|
|||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.data.PumpEnactResult;
|
||||
import info.nightscout.androidaps.db.BgReading;
|
||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||
import info.nightscout.androidaps.interfaces.TempBasalsInterface;
|
||||
import info.nightscout.androidaps.interfaces.TreatmentsInterface;
|
||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderFragment;
|
||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||
import info.nightscout.androidaps.plugins.OpenAPSMA.IobTotal;
|
||||
import info.nightscout.client.data.NSProfile;
|
||||
|
@ -49,7 +47,6 @@ import info.nightscout.utils.BolusWizard;
|
|||
import info.nightscout.utils.DateUtil;
|
||||
import info.nightscout.utils.DecimalFormatter;
|
||||
import info.nightscout.utils.PlusMinusEditText;
|
||||
import info.nightscout.utils.Round;
|
||||
import info.nightscout.utils.SafeParse;
|
||||
import info.nightscout.utils.ToastUtils;
|
||||
|
||||
|
|
|
@ -28,7 +28,6 @@ import info.nightscout.androidaps.events.EventTreatmentChange;
|
|||
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||
import info.nightscout.androidaps.plugins.OpenAPSMA.IobTotal;
|
||||
import info.nightscout.androidaps.plugins.Overview.Notification;
|
||||
import info.nightscout.client.data.NSProfile;
|
||||
import info.nightscout.utils.DecimalFormatter;
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ package info.nightscout.utils;
|
|||
import org.json.JSONObject;
|
||||
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.interfaces.TempBasalsInterface;
|
||||
import info.nightscout.androidaps.interfaces.TreatmentsInterface;
|
||||
import info.nightscout.androidaps.plugins.OpenAPSMA.IobTotal;
|
||||
|
|
Loading…
Reference in a new issue