fix merge conflict
This commit is contained in:
commit
e5cc34b975
|
@ -32,6 +32,9 @@ import info.nightscout.androidaps.plugins.ConstraintsObjectives.ObjectivesFragme
|
|||
import info.nightscout.androidaps.plugins.ConstraintsSafety.SafetyPlugin;
|
||||
import info.nightscout.androidaps.plugins.InsulinFastacting.InsulinFastactingFragment;
|
||||
import info.nightscout.androidaps.plugins.InsulinFastactingProlonged.InsulinFastactingProlongedFragment;
|
||||
import info.nightscout.androidaps.plugins.InsulinOrefCurves.InsulinOrefFreePeakFragment;
|
||||
import info.nightscout.androidaps.plugins.InsulinOrefCurves.InsulinOrefRapidActingFragment;
|
||||
import info.nightscout.androidaps.plugins.InsulinOrefCurves.InsulinOrefUltraRapidActingFragment;
|
||||
import info.nightscout.androidaps.plugins.IobCobCalculator.IobCobCalculatorPlugin;
|
||||
import info.nightscout.androidaps.plugins.Loop.LoopFragment;
|
||||
import info.nightscout.androidaps.plugins.NSClientInternal.NSClientInternalFragment;
|
||||
|
@ -114,6 +117,9 @@ public class MainApp extends Application {
|
|||
if (Config.ACTION) pluginsList.add(ActionsFragment.getPlugin());
|
||||
pluginsList.add(InsulinFastactingFragment.getPlugin());
|
||||
pluginsList.add(InsulinFastactingProlongedFragment.getPlugin());
|
||||
pluginsList.add(InsulinOrefRapidActingFragment.getPlugin());
|
||||
pluginsList.add(InsulinOrefUltraRapidActingFragment.getPlugin());
|
||||
pluginsList.add(InsulinOrefFreePeakFragment.getPlugin());
|
||||
pluginsList.add(SensitivityOref0Plugin.getPlugin());
|
||||
pluginsList.add(SensitivityAAPSPlugin.getPlugin());
|
||||
pluginsList.add(SensitivityWeightedAveragePlugin.getPlugin());
|
||||
|
|
|
@ -15,6 +15,7 @@ import info.nightscout.androidaps.events.EventPreferenceChange;
|
|||
import info.nightscout.androidaps.events.EventRefreshGui;
|
||||
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||
import info.nightscout.androidaps.plugins.OpenAPSSMB.OpenAPSSMBPlugin;
|
||||
import info.nightscout.androidaps.plugins.InsulinOrefCurves.InsulinOrefFreePeakPlugin;
|
||||
import info.nightscout.androidaps.plugins.PumpDanaR.BluetoothDevicePreference;
|
||||
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPlugin;
|
||||
import info.nightscout.androidaps.plugins.PumpDanaRKorean.DanaRKoreanPlugin;
|
||||
|
@ -142,6 +143,11 @@ public class PreferencesActivity extends PreferenceActivity implements SharedPre
|
|||
if (virtualPumpPlugin != null && virtualPumpPlugin.isEnabled(PluginBase.PUMP)) {
|
||||
addPreferencesFromResource(R.xml.pref_virtualpump);
|
||||
}
|
||||
InsulinOrefFreePeakPlugin insulinOrefFreePeakPlugin = (InsulinOrefFreePeakPlugin) MainApp.getSpecificPlugin(InsulinOrefFreePeakPlugin.class);
|
||||
if(insulinOrefFreePeakPlugin.isEnabled(PluginBase.INSULIN)){
|
||||
addPreferencesFromResource(R.xml.pref_insulinoreffreepeak);
|
||||
}
|
||||
|
||||
NSClientInternalPlugin nsClientInternalPlugin = (NSClientInternalPlugin) MainApp.getSpecificPlugin(NSClientInternalPlugin.class);
|
||||
if (nsClientInternalPlugin != null && nsClientInternalPlugin.isEnabled(PluginBase.GENERAL)) {
|
||||
addPreferencesFromResource(R.xml.pref_nsclientinternal);
|
||||
|
|
|
@ -31,7 +31,7 @@ public class OverlappingIntervals<T extends Interval> extends Intervals<T> {
|
|||
|
||||
@Nullable
|
||||
public synchronized T getValueByInterval(long time) {
|
||||
for (int index = rawData.size()-1; index > 0; index--) { //begin with newest
|
||||
for (int index = rawData.size()-1; index >= 0; index--) { //begin with newest
|
||||
T cur = rawData.valueAt(index);
|
||||
if (cur.match(time)){
|
||||
return cur;
|
||||
|
|
|
@ -391,4 +391,9 @@ public class Profile {
|
|||
if (units.equals(Constants.MGDL)) return DecimalFormatter.to0Decimal(valueInMgdl);
|
||||
else return DecimalFormatter.to1Decimal(valueInMmol);
|
||||
}
|
||||
|
||||
public static String toTargetRangeString(double low, double high, String units) {
|
||||
if (low == high) return toUnitsString(low, low, units);
|
||||
else return toUnitsString(low, low, units) + " - " + toUnitsString(high, high, units);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,10 @@ import info.nightscout.androidaps.db.Treatment;
|
|||
public interface InsulinInterface {
|
||||
final int FASTACTINGINSULIN = 0;
|
||||
final int FASTACTINGINSULINPROLONGED = 1;
|
||||
final int OREF_RAPID_ACTING = 2;
|
||||
final int OREF_ULTRA_RAPID_ACTING = 3;
|
||||
final int OREF_FREE_PEAK = 4;
|
||||
|
||||
|
||||
int getId();
|
||||
String getFriendlyName();
|
||||
|
|
|
@ -28,7 +28,7 @@ public class DetailedBolusInfoStorage {
|
|||
public static DetailedBolusInfo findDetailedBolusInfo(long bolustime) {
|
||||
DetailedBolusInfo found = null;
|
||||
for (int i = 0; i < store.size(); i++) {
|
||||
long infoTime = store.get(0).date;
|
||||
long infoTime = store.get(i).date;
|
||||
log.debug("Existing info: " + new Date(infoTime).toLocaleString());
|
||||
if (bolustime > infoTime - 60 * 1000 && bolustime < infoTime + 60 * 1000) {
|
||||
found = store.get(i);
|
||||
|
|
|
@ -21,7 +21,6 @@ import info.nightscout.androidaps.interfaces.InsulinInterface;
|
|||
*/
|
||||
|
||||
public class ActivityGraph extends GraphView {
|
||||
|
||||
Context context;
|
||||
|
||||
public ActivityGraph(Context context) {
|
||||
|
@ -35,6 +34,8 @@ public class ActivityGraph extends GraphView {
|
|||
}
|
||||
|
||||
public void show(InsulinInterface insulin) {
|
||||
removeAllSeries();
|
||||
mSecondScale = null;
|
||||
double dia = insulin.getDia();
|
||||
int hours = (int) Math.floor(dia + 1);
|
||||
|
||||
|
|
|
@ -0,0 +1,108 @@
|
|||
package info.nightscout.androidaps.plugins.InsulinOrefCurves;
|
||||
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.data.Iob;
|
||||
import info.nightscout.androidaps.db.Treatment;
|
||||
import info.nightscout.androidaps.interfaces.InsulinInterface;
|
||||
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||
import info.nightscout.androidaps.plugins.Overview.Notification;
|
||||
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
|
||||
|
||||
/**
|
||||
* Created by adrian on 13.08.2017.
|
||||
*/
|
||||
|
||||
public abstract class InsulinOrefBasePlugin implements PluginBase, InsulinInterface {
|
||||
|
||||
public static double MIN_DIA = 5;
|
||||
|
||||
long lastWarned = 0;
|
||||
|
||||
@Override
|
||||
public int getType() {
|
||||
return INSULIN;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNameShort() {
|
||||
return MainApp.sResources.getString(R.string.insulin_shortname);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeHidden(int type) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasFragment() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showInList(int type) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getDia() {
|
||||
double dia = getUserDefinedDia();
|
||||
if(dia >= MIN_DIA){
|
||||
return dia;
|
||||
} else {
|
||||
if((System.currentTimeMillis() - lastWarned) > 60*1000) {
|
||||
lastWarned = System.currentTimeMillis();
|
||||
Notification notification = new Notification(Notification.SHORT_DIA, String.format(MainApp.sResources.getString(R.string.dia_too_short), dia, MIN_DIA), Notification.URGENT);
|
||||
MainApp.bus().post(new EventNewNotification(notification));
|
||||
}
|
||||
return MIN_DIA;
|
||||
}
|
||||
}
|
||||
|
||||
public double getUserDefinedDia() {
|
||||
return MainApp.getConfigBuilder().getProfile() != null ? MainApp.getConfigBuilder().getProfile().getDia() : Constants.defaultDIA;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iob iobCalcForTreatment(Treatment treatment, long time, Double dia) {
|
||||
Iob result = new Iob();
|
||||
|
||||
int peak = getPeak();
|
||||
|
||||
|
||||
if (treatment.insulin != 0d) {
|
||||
|
||||
long bolusTime = treatment.date;
|
||||
double t = (time - bolusTime) / 1000d / 60d;
|
||||
|
||||
double td = getDia()*60; //getDIA() always > 5
|
||||
double tp = peak;
|
||||
|
||||
// force the IOB to 0 if over DIA hours have passed
|
||||
if (t < td) {
|
||||
double tau = tp * (1 - tp / td) / (1 - 2 * tp / td);
|
||||
double a = 2 * tau / td;
|
||||
double S = 1 / (1 - a + (1 + a) * Math.exp(-td / tau));
|
||||
result.activityContrib = treatment.insulin * (S / Math.pow(tau, 2)) * t * (1 - t / td) * Math.exp(-t / tau);
|
||||
result.iobContrib = treatment.insulin * (1 - S * (1 - a) * ((Math.pow(t, 2) / (tau * td * (1 - a)) - t / tau - 1) * Math.exp(-t / tau) + 1));
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getComment() {
|
||||
String comment = commentStandardText();
|
||||
double userDia = getUserDefinedDia();
|
||||
if(userDia < MIN_DIA){
|
||||
comment += "\n" + String.format(MainApp.sResources.getString(R.string.dia_too_short), userDia, MIN_DIA);
|
||||
}
|
||||
return comment;
|
||||
}
|
||||
|
||||
abstract int getPeak();
|
||||
|
||||
abstract String commentStandardText();
|
||||
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
package info.nightscout.androidaps.plugins.InsulinOrefCurves;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.plugins.InsulinFastacting.ActivityGraph;
|
||||
|
||||
/**
|
||||
* Created by adrian on 14/08/17.
|
||||
*/
|
||||
|
||||
public class InsulinOrefFreePeakFragment extends Fragment {
|
||||
|
||||
static InsulinOrefFreePeakPlugin insulinPlugin = new InsulinOrefFreePeakPlugin();
|
||||
|
||||
static public InsulinOrefFreePeakPlugin getPlugin() {
|
||||
return insulinPlugin;
|
||||
}
|
||||
|
||||
TextView insulinName;
|
||||
TextView insulinComment;
|
||||
TextView insulinDia;
|
||||
ActivityGraph insulinGraph;
|
||||
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.insulin_fragment, container, false);
|
||||
|
||||
insulinName = (TextView) view.findViewById(R.id.insulin_name);
|
||||
insulinComment = (TextView) view.findViewById(R.id.insulin_comment);
|
||||
insulinDia = (TextView) view.findViewById(R.id.insulin_dia);
|
||||
insulinGraph = (ActivityGraph) view.findViewById(R.id.insuling_graph);
|
||||
|
||||
updateGUI();
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
updateGUI();
|
||||
}
|
||||
|
||||
private void updateGUI() {
|
||||
insulinName.setText(insulinPlugin.getFriendlyName());
|
||||
insulinComment.setText(insulinPlugin.getComment());
|
||||
insulinDia.setText(MainApp.sResources.getText(R.string.dia) + " " + new Double(insulinPlugin.getDia()).toString() + "h");
|
||||
insulinGraph.show(insulinPlugin);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
package info.nightscout.androidaps.plugins.InsulinOrefCurves;
|
||||
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.utils.SP;
|
||||
|
||||
/**
|
||||
* Created by adrian on 14/08/17.
|
||||
*/
|
||||
|
||||
public class InsulinOrefFreePeakPlugin extends InsulinOrefBasePlugin {
|
||||
|
||||
private static boolean fragmentEnabled = false;
|
||||
private static boolean fragmentVisible = false;
|
||||
|
||||
public static final int DEFAULT_PEAK = 75;
|
||||
|
||||
@Override
|
||||
public int getId() {
|
||||
return OREF_FREE_PEAK;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return MainApp.sResources.getString(R.string.free_peak_oref);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFragmentClass() {
|
||||
return InsulinOrefFreePeakFragment.class.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFriendlyName() {
|
||||
return MainApp.sResources.getString(R.string.free_peak_oref);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String commentStandardText() {
|
||||
return MainApp.sResources.getString(R.string.insulin_peak_time) + ": " + getPeak();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled(int type) {
|
||||
return type == INSULIN && fragmentEnabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisibleInTabs(int type) {
|
||||
return type == INSULIN && fragmentVisible;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFragmentEnabled(int type, boolean fragmentEnabled) {
|
||||
if (type == INSULIN) this.fragmentEnabled = fragmentEnabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFragmentVisible(int type, boolean fragmentVisible) {
|
||||
if (type == INSULIN) this.fragmentVisible = fragmentVisible;
|
||||
}
|
||||
|
||||
@Override
|
||||
int getPeak() {
|
||||
return SP.getInt(R.string.key_insulin_oref_peak, DEFAULT_PEAK);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
package info.nightscout.androidaps.plugins.InsulinOrefCurves;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.plugins.InsulinFastacting.ActivityGraph;
|
||||
|
||||
/**
|
||||
* Created by adrian on 14/08/17.
|
||||
*/
|
||||
|
||||
public class InsulinOrefRapidActingFragment extends Fragment {
|
||||
|
||||
static InsulinOrefRapidActingPlugin insulinPlugin = new InsulinOrefRapidActingPlugin();
|
||||
|
||||
static public InsulinOrefRapidActingPlugin getPlugin() {
|
||||
return insulinPlugin;
|
||||
}
|
||||
|
||||
TextView insulinName;
|
||||
TextView insulinComment;
|
||||
TextView insulinDia;
|
||||
ActivityGraph insulinGraph;
|
||||
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.insulin_fragment, container, false);
|
||||
|
||||
insulinName = (TextView) view.findViewById(R.id.insulin_name);
|
||||
insulinComment = (TextView) view.findViewById(R.id.insulin_comment);
|
||||
insulinDia = (TextView) view.findViewById(R.id.insulin_dia);
|
||||
insulinGraph = (ActivityGraph) view.findViewById(R.id.insuling_graph);
|
||||
|
||||
updateGUI();
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
updateGUI();
|
||||
}
|
||||
|
||||
private void updateGUI() {
|
||||
insulinName.setText(insulinPlugin.getFriendlyName());
|
||||
insulinComment.setText(insulinPlugin.getComment());
|
||||
insulinDia.setText(MainApp.sResources.getText(R.string.dia) + " " + new Double(insulinPlugin.getDia()).toString() + "h");
|
||||
insulinGraph.show(insulinPlugin);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
package info.nightscout.androidaps.plugins.InsulinOrefCurves;
|
||||
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
|
||||
/**
|
||||
* Created by adrian on 14/08/17.
|
||||
*/
|
||||
|
||||
public class InsulinOrefRapidActingPlugin extends InsulinOrefBasePlugin {
|
||||
|
||||
private static boolean fragmentEnabled = false;
|
||||
private static boolean fragmentVisible = false;
|
||||
|
||||
public static final int PEAK = 75;
|
||||
|
||||
@Override
|
||||
public int getId() {
|
||||
return OREF_RAPID_ACTING;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return MainApp.sResources.getString(R.string.rapid_acting_oref);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFragmentClass() {
|
||||
return InsulinOrefRapidActingFragment.class.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFriendlyName() {
|
||||
return MainApp.sResources.getString(R.string.rapid_acting_oref);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String commentStandardText() {
|
||||
return MainApp.sResources.getString(R.string.fastactinginsulincomment);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled(int type) {
|
||||
return type == INSULIN && fragmentEnabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisibleInTabs(int type) {
|
||||
return type == INSULIN && fragmentVisible;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFragmentEnabled(int type, boolean fragmentEnabled) {
|
||||
if (type == INSULIN) this.fragmentEnabled = fragmentEnabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFragmentVisible(int type, boolean fragmentVisible) {
|
||||
if (type == INSULIN) this.fragmentVisible = fragmentVisible;
|
||||
}
|
||||
|
||||
@Override
|
||||
int getPeak() {
|
||||
return PEAK;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
package info.nightscout.androidaps.plugins.InsulinOrefCurves;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.plugins.InsulinFastacting.ActivityGraph;
|
||||
|
||||
/**
|
||||
* Created by adrian on 14/08/17.
|
||||
*/
|
||||
|
||||
public class InsulinOrefUltraRapidActingFragment extends Fragment {
|
||||
|
||||
static InsulinOrefUltraRapidActingPlugin insulinPlugin = new InsulinOrefUltraRapidActingPlugin();
|
||||
|
||||
static public InsulinOrefUltraRapidActingPlugin getPlugin() {
|
||||
return insulinPlugin;
|
||||
}
|
||||
|
||||
TextView insulinName;
|
||||
TextView insulinComment;
|
||||
TextView insulinDia;
|
||||
ActivityGraph insulinGraph;
|
||||
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.insulin_fragment, container, false);
|
||||
|
||||
insulinName = (TextView) view.findViewById(R.id.insulin_name);
|
||||
insulinComment = (TextView) view.findViewById(R.id.insulin_comment);
|
||||
insulinDia = (TextView) view.findViewById(R.id.insulin_dia);
|
||||
insulinGraph = (ActivityGraph) view.findViewById(R.id.insuling_graph);
|
||||
|
||||
updateGUI();
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
updateGUI();
|
||||
}
|
||||
|
||||
private void updateGUI() {
|
||||
insulinName.setText(insulinPlugin.getFriendlyName());
|
||||
insulinComment.setText(insulinPlugin.getComment());
|
||||
insulinDia.setText(MainApp.sResources.getText(R.string.dia) + " " + new Double(insulinPlugin.getDia()).toString() + "h");
|
||||
insulinGraph.show(insulinPlugin);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
package info.nightscout.androidaps.plugins.InsulinOrefCurves;
|
||||
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
|
||||
/**
|
||||
* Created by adrian on 14/08/17.
|
||||
*/
|
||||
|
||||
public class InsulinOrefUltraRapidActingPlugin extends InsulinOrefBasePlugin {
|
||||
|
||||
private static boolean fragmentEnabled = false;
|
||||
private static boolean fragmentVisible = false;
|
||||
|
||||
public static final int PEAK = 55;
|
||||
|
||||
@Override
|
||||
public int getId() {
|
||||
return OREF_ULTRA_RAPID_ACTING;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return MainApp.sResources.getString(R.string.ultrarapid_oref);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFragmentClass() {
|
||||
return InsulinOrefUltraRapidActingFragment.class.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFriendlyName() {
|
||||
return MainApp.sResources.getString(R.string.ultrarapid_oref);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String commentStandardText() {
|
||||
return MainApp.sResources.getString(R.string.ultrafastactinginsulincomment);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled(int type) {
|
||||
return type == INSULIN && fragmentEnabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisibleInTabs(int type) {
|
||||
return type == INSULIN && fragmentVisible;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFragmentEnabled(int type, boolean fragmentEnabled) {
|
||||
if (type == INSULIN) this.fragmentEnabled = fragmentEnabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFragmentVisible(int type, boolean fragmentVisible) {
|
||||
if (type == INSULIN) this.fragmentVisible = fragmentVisible;
|
||||
}
|
||||
|
||||
@Override
|
||||
int getPeak() {
|
||||
return PEAK;
|
||||
}
|
||||
}
|
|
@ -208,7 +208,7 @@ public class DetermineBasalAdapterAMAJS {
|
|||
|
||||
mProfile = new V8Object(mV8rt);
|
||||
mProfile.add("max_iob", maxIob);
|
||||
mProfile.add("dia", profile.getDia());
|
||||
mProfile.add("dia", Math.min(profile.getDia(), 3d));
|
||||
mProfile.add("type", "current");
|
||||
mProfile.add("max_daily_basal", profile.getMaxDailyBasal());
|
||||
mProfile.add("max_basal", maxBasal);
|
||||
|
|
|
@ -231,7 +231,7 @@ public class DetermineBasalAdapterMAJS {
|
|||
String units = profile.getUnits();
|
||||
|
||||
mProfile.add("max_iob", maxIob);
|
||||
mProfile.add("dia", profile.getDia());
|
||||
mProfile.add("dia", Math.min(profile.getDia(), 3d));
|
||||
mProfile.add("type", "current");
|
||||
mProfile.add("max_daily_basal", profile.getMaxDailyBasal());
|
||||
mProfile.add("max_basal", maxBasal);
|
||||
|
|
|
@ -47,6 +47,8 @@ public class Notification {
|
|||
public static final int NSANNOUNCEMENT = 18;
|
||||
public static final int NSALARM = 19;
|
||||
public static final int NSURGENTALARM = 20;
|
||||
public static final int SHORT_DIA = 21;
|
||||
|
||||
|
||||
public int id;
|
||||
public Date date;
|
||||
|
|
|
@ -952,19 +952,11 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
tempTargetView.setTextColor(Color.BLACK);
|
||||
tempTargetView.setBackgroundColor(MainApp.sResources.getColor(R.color.tempTargetBackground));
|
||||
tempTargetView.setVisibility(View.VISIBLE);
|
||||
if (tempTarget.low == tempTarget.high)
|
||||
tempTargetView.setText(Profile.toUnitsString(tempTarget.low, Profile.fromMgdlToUnits(tempTarget.low, units), units));
|
||||
else
|
||||
tempTargetView.setText(Profile.toUnitsString(tempTarget.low, Profile.fromMgdlToUnits(tempTarget.low, units), units) + " - " + Profile.toUnitsString(tempTarget.high, Profile.fromMgdlToUnits(tempTarget.high, units), units));
|
||||
tempTargetView.setText(Profile.toTargetRangeString(tempTarget.low, tempTarget.high, units));
|
||||
} else {
|
||||
tempTargetView.setTextColor(Color.WHITE);
|
||||
tempTargetView.setBackgroundColor(MainApp.sResources.getColor(R.color.tempTargetDisabledBackground));
|
||||
double low = MainApp.getConfigBuilder().getProfile().getTargetLow();
|
||||
double high = MainApp.getConfigBuilder().getProfile().getTargetHigh();
|
||||
if (low == high)
|
||||
tempTargetView.setText("" + low);
|
||||
else
|
||||
tempTargetView.setText(low + " - " + high);
|
||||
tempTargetView.setText(Profile.toTargetRangeString(profile.getTargetLow(), profile.getTargetHigh(), units));
|
||||
tempTargetView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
if (Config.NSCLIENT && tempTarget == null) {
|
||||
|
|
|
@ -500,9 +500,13 @@ public class CircadianPercentageProfileFragment extends SubscriberFragment {
|
|||
activity.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!MainApp.getConfigBuilder().isInitialized() || MainApp.getConfigBuilder().isSuspended() || !MainApp.getConfigBuilder().getPumpDescription().isSetBasalProfileCapable) {
|
||||
if (!MainApp.getConfigBuilder().isInitialized() || MainApp.getConfigBuilder().isSuspended()) {
|
||||
profileswitchButton.setVisibility(View.GONE);
|
||||
} else if (!MainApp.getConfigBuilder().getPumpDescription().isSetBasalProfileCapable) {
|
||||
profileswitchButton.setText(MainApp.instance().getText(R.string.activate_profile));
|
||||
profileswitchButton.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
profileswitchButton.setText(MainApp.instance().getText(R.string.send_to_pump));
|
||||
profileswitchButton.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -148,9 +148,13 @@ public class LocalProfileFragment extends SubscriberFragment {
|
|||
activity.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!MainApp.getConfigBuilder().isInitialized() || MainApp.getConfigBuilder().isSuspended() || !MainApp.getConfigBuilder().getPumpDescription().isSetBasalProfileCapable) {
|
||||
if (!MainApp.getConfigBuilder().isInitialized() || MainApp.getConfigBuilder().isSuspended()) {
|
||||
profileswitchButton.setVisibility(View.GONE);
|
||||
} else if (!MainApp.getConfigBuilder().getPumpDescription().isSetBasalProfileCapable) {
|
||||
profileswitchButton.setText(MainApp.instance().getText(R.string.activate_profile));
|
||||
profileswitchButton.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
profileswitchButton.setText(MainApp.instance().getText(R.string.send_to_pump));
|
||||
profileswitchButton.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -156,9 +156,13 @@ public class SimpleProfileFragment extends SubscriberFragment {
|
|||
activity.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!MainApp.getConfigBuilder().isInitialized() || MainApp.getConfigBuilder().isSuspended() || !MainApp.getConfigBuilder().getPumpDescription().isSetBasalProfileCapable) {
|
||||
if (!MainApp.getConfigBuilder().isInitialized() || MainApp.getConfigBuilder().isSuspended()) {
|
||||
profileswitchButton.setVisibility(View.GONE);
|
||||
} else if (!MainApp.getConfigBuilder().getPumpDescription().isSetBasalProfileCapable) {
|
||||
profileswitchButton.setText(MainApp.instance().getText(R.string.activate_profile));
|
||||
profileswitchButton.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
profileswitchButton.setText(MainApp.instance().getText(R.string.send_to_pump));
|
||||
profileswitchButton.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,9 +13,11 @@ import info.nightscout.androidaps.Config;
|
|||
|
||||
public class MsgSetTime extends MessageBase {
|
||||
private static Logger log = LoggerFactory.getLogger(MsgSetTime.class);
|
||||
private static Date time;
|
||||
|
||||
public MsgSetTime(Date time) {
|
||||
SetCommand(0x330a);
|
||||
this.time = time;
|
||||
AddParamDateTime(time);
|
||||
}
|
||||
|
||||
|
@ -23,6 +25,6 @@ public class MsgSetTime extends MessageBase {
|
|||
int result = intFromBuff(bytes, 0, 1);
|
||||
|
||||
if (Config.logDanaMessageDetail)
|
||||
log.debug("Result: " + result);
|
||||
log.debug("Result of setting time: " + time + " is " + result);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ public class MsgSettingPumpTime extends MessageBase {
|
|||
);
|
||||
|
||||
if (Config.logDanaMessageDetail)
|
||||
log.debug("Pump time: " + time);
|
||||
log.debug("Pump time: " + time + " Phone time: " + new Date());
|
||||
|
||||
DanaRPump.getInstance().pumpTime = time;
|
||||
}
|
||||
|
|
|
@ -326,11 +326,18 @@ public class DanaRExecutionService extends Service {
|
|||
//0x3201
|
||||
mSerialIOThread.sendMessage(new MsgSettingMaxValues());
|
||||
mSerialIOThread.sendMessage(new MsgSettingGlucose());
|
||||
mSerialIOThread.sendMessage(new MsgSettingPumpTime());
|
||||
mSerialIOThread.sendMessage(new MsgSettingActiveProfile());
|
||||
mSerialIOThread.sendMessage(new MsgSettingProfileRatios());
|
||||
mSerialIOThread.sendMessage(new MsgSettingProfileRatiosAll());
|
||||
mSerialIOThread.sendMessage(new MsgSetTime(new Date()));
|
||||
mSerialIOThread.sendMessage(new MsgSettingPumpTime());
|
||||
long timeDiff = (danaRPump.pumpTime.getTime() - System.currentTimeMillis()) / 1000L;
|
||||
log.debug("Pump time difference: " + timeDiff + " seconds");
|
||||
if (Math.abs(timeDiff) > 10) {
|
||||
mSerialIOThread.sendMessage(new MsgSetTime(new Date()));
|
||||
mSerialIOThread.sendMessage(new MsgSettingPumpTime());
|
||||
timeDiff = (danaRPump.pumpTime.getTime() - System.currentTimeMillis()) / 1000L;
|
||||
log.debug("Pump time difference: " + timeDiff + " seconds");
|
||||
}
|
||||
danaRPump.lastSettingsRead = now;
|
||||
}
|
||||
|
||||
|
|
|
@ -322,9 +322,15 @@ public class DanaRKoreanExecutionService extends Service {
|
|||
//0x3201
|
||||
mSerialIOThread.sendMessage(new MsgSettingMaxValues());
|
||||
mSerialIOThread.sendMessage(new MsgSettingGlucose());
|
||||
mSerialIOThread.sendMessage(new MsgSettingPumpTime());
|
||||
mSerialIOThread.sendMessage(new MsgSettingProfileRatios());
|
||||
mSerialIOThread.sendMessage(new MsgSetTime(new Date()));
|
||||
long timeDiff = (danaRPump.pumpTime.getTime() - System.currentTimeMillis()) / 1000L;
|
||||
log.debug("Pump time difference: " + timeDiff + " seconds");
|
||||
if (Math.abs(timeDiff) > 10) {
|
||||
mSerialIOThread.sendMessage(new MsgSetTime(new Date()));
|
||||
mSerialIOThread.sendMessage(new MsgSettingPumpTime());
|
||||
timeDiff = (danaRPump.pumpTime.getTime() - System.currentTimeMillis()) / 1000L;
|
||||
log.debug("Pump time difference: " + timeDiff + " seconds");
|
||||
}
|
||||
danaRPump.lastSettingsRead = now;
|
||||
}
|
||||
|
||||
|
|
|
@ -297,11 +297,18 @@ public class DanaRv2ExecutionService extends Service {
|
|||
//0x3201
|
||||
mSerialIOThread.sendMessage(new MsgSettingMaxValues());
|
||||
mSerialIOThread.sendMessage(new MsgSettingGlucose());
|
||||
mSerialIOThread.sendMessage(new MsgSettingPumpTime());
|
||||
mSerialIOThread.sendMessage(new MsgSettingActiveProfile());
|
||||
mSerialIOThread.sendMessage(new MsgSettingProfileRatios());
|
||||
mSerialIOThread.sendMessage(new MsgSettingProfileRatiosAll());
|
||||
mSerialIOThread.sendMessage(new MsgSetTime(new Date()));
|
||||
mSerialIOThread.sendMessage(new MsgSettingPumpTime());
|
||||
long timeDiff = (danaRPump.pumpTime.getTime() - System.currentTimeMillis()) / 1000L;
|
||||
log.debug("Pump time difference: " + timeDiff + " seconds");
|
||||
if (Math.abs(timeDiff) > 10) {
|
||||
mSerialIOThread.sendMessage(new MsgSetTime(new Date()));
|
||||
mSerialIOThread.sendMessage(new MsgSettingPumpTime());
|
||||
timeDiff = (danaRPump.pumpTime.getTime() - System.currentTimeMillis()) / 1000L;
|
||||
log.debug("Pump time difference: " + timeDiff + " seconds");
|
||||
}
|
||||
danaRPump.lastSettingsRead = now;
|
||||
}
|
||||
|
||||
|
|
|
@ -472,7 +472,7 @@ public class ActionStringHandler {
|
|||
//Check for Temp-Target:
|
||||
TempTarget tempTarget = MainApp.getConfigBuilder().getTempTargetFromHistory(System.currentTimeMillis());
|
||||
if (tempTarget != null) {
|
||||
ret += "Temp Target: " + Profile.toUnitsString(tempTarget.low, Profile.fromMgdlToUnits(tempTarget.low, profile.getUnits()), profile.getUnits()) + " - " + Profile.toUnitsString(tempTarget.high, Profile.fromMgdlToUnits(tempTarget.high, profile.getUnits()), profile.getUnits());
|
||||
ret += "Temp Target: " + Profile.toTargetRangeString(tempTarget.low, tempTarget.low, profile.getUnits());
|
||||
ret += "\nuntil: " + DateUtil.timeString(tempTarget.originalEnd());
|
||||
ret += "\n\n";
|
||||
}
|
||||
|
|
4
app/src/main/res/values-nl/strings.xml
Normal file
4
app/src/main/res/values-nl/strings.xml
Normal file
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="app_name">AndroidAPS</string>
|
||||
</resources>
|
|
@ -581,4 +581,5 @@
|
|||
<string name="sms_delta">Delta:</string>
|
||||
<string name="sms_iob">IOB:</string>
|
||||
<string name="sms_minago" formatted="false">%dmin sedan</string>
|
||||
<string name="app_name">AndroidAPS</string>
|
||||
</resources>
|
|
@ -15,6 +15,7 @@
|
|||
<item>@string/bg_lang</item>
|
||||
<item>@string/cs_lang</item>
|
||||
<item>@string/de_lang</item>
|
||||
<item>@string/nl_lang</item>
|
||||
<item>@string/es_lang</item>
|
||||
<item>@string/el_lang</item>
|
||||
<item>@string/it_lang</item>
|
||||
|
@ -27,6 +28,7 @@
|
|||
<item>bg</item>
|
||||
<item>cs</item>
|
||||
<item>de</item>
|
||||
<item>nl</item>
|
||||
<item>es</item>
|
||||
<item>el</item>
|
||||
<item>it</item>
|
||||
|
|
|
@ -203,6 +203,7 @@
|
|||
<string name="filenotfound">File not found</string>
|
||||
<string name="nav_export">Export settings</string>
|
||||
<string name="nav_import">Import settings</string>
|
||||
<string name="nl_lang">Dutch</string>
|
||||
<string name="de_lang">German</string>
|
||||
<string name="es_lang">Spanish</string>
|
||||
<string name="el_lang">Greek</string>
|
||||
|
@ -580,6 +581,7 @@
|
|||
<string name="configbuilder_insulin">Insulin</string>
|
||||
<string name="fastactinginsulin">Fast Acting Insulin</string>
|
||||
<string name="fastactinginsulincomment">Novorapid, Novolog, Humalog</string>
|
||||
<string name="ultrafastactinginsulincomment">Fiasp</string>
|
||||
<string name="insulin_shortname">INS</string>
|
||||
<string name="fastactinginsulinprolonged">Fast Acting Insulin Prolonged</string>
|
||||
<string name="key_usesuperbolus" translatable="false">key_usersuperbolus</string>
|
||||
|
@ -697,5 +699,13 @@
|
|||
<string name="enablesmb">Enable SMB</string>
|
||||
<string name="enablesmb_summary">Use Super Micro Boluses instead of temp basal for faster action</string>
|
||||
<string name="enableuam_summary">Detection of Unannounced meals</string>
|
||||
<string name="key_insulin_oref_peak" translatable="false">insulin_oref_peak</string>
|
||||
<string name="insulin_oref_peak">IOB Curve Peak Time</string>
|
||||
<string name="insulin_peak_time">Peak Time [min]</string>
|
||||
<string name="free_peak_oref">Free-Peak Oref</string>
|
||||
<string name="rapid_acting_oref">Rapid-Acting Oref</string>
|
||||
<string name="ultrarapid_oref">Ultra-Rapid Oref</string>
|
||||
<string name="dia_too_short" formatted="false">"DIA of %s too short - using %s instead!"</string>
|
||||
<string name="activate_profile">ACTIVATE PROFILE</string>
|
||||
</resources>
|
||||
|
||||
|
|
21
app/src/main/res/xml/pref_insulinoreffreepeak.xml
Normal file
21
app/src/main/res/xml/pref_insulinoreffreepeak.xml
Normal file
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:validate="http://schemas.android.com/apk/res-auto">
|
||||
<PreferenceCategory
|
||||
android:key="InsulinOrefFreePeak"
|
||||
android:title="@string/insulin_oref_peak">
|
||||
|
||||
<com.andreabaccega.widget.ValidatingEditTextPreference
|
||||
validate:testType="numericRange"
|
||||
validate:minNumber="35"
|
||||
validate:maxNumber="120"
|
||||
android:digits="0123456789"
|
||||
android:defaultValue="75"
|
||||
android:selectAllOnFocus="true"
|
||||
android:inputType="number"
|
||||
android:maxLines="20"
|
||||
android:title="@string/insulin_peak_time"
|
||||
android:key="@string/key_insulin_oref_peak" />
|
||||
</PreferenceCategory>
|
||||
|
||||
</PreferenceScreen>
|
Loading…
Reference in a new issue