diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index f47c284915..9f7af3102b 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -49,6 +49,7 @@
android:theme="@style/Theme.AppCompat.Translucent" />
+
diff --git a/app/src/main/java/info/nightscout/androidaps/db/ProfileSwitch.java b/app/src/main/java/info/nightscout/androidaps/db/ProfileSwitch.java
index 40c8e50c6d..6022525afb 100644
--- a/app/src/main/java/info/nightscout/androidaps/db/ProfileSwitch.java
+++ b/app/src/main/java/info/nightscout/androidaps/db/ProfileSwitch.java
@@ -103,11 +103,14 @@ public class ProfileSwitch implements Interval, DataPointWithLabelInterface {
if(LocalProfilePlugin.LOCAL_PROFILE.equals(name)){
name = DecimalFormatter.to2Decimal(getProfileObject().percentageBasalSum()) + "U ";
}
- if (isCPP) {
- name += "(" + percentage + "%";
- if (timeshift != 0)
- name += "," + timeshift + "h";
- name += ")";
+ //Test if name is already containing percentage or timeshift
+ if (!name.endsWith("h)") || !name.endsWith("%)")) {
+ if (isCPP) {
+ name += "(" + percentage + "%";
+ if (timeshift != 0)
+ name += "," + timeshift + "h";
+ name += ")";
+ }
}
return name;
}
diff --git a/app/src/main/java/info/nightscout/androidaps/interfaces/DanaRInterface.java b/app/src/main/java/info/nightscout/androidaps/interfaces/DanaRInterface.java
index 1c5ee83834..374d96890a 100644
--- a/app/src/main/java/info/nightscout/androidaps/interfaces/DanaRInterface.java
+++ b/app/src/main/java/info/nightscout/androidaps/interfaces/DanaRInterface.java
@@ -9,4 +9,5 @@ import info.nightscout.androidaps.data.PumpEnactResult;
public interface DanaRInterface {
PumpEnactResult loadHistory(byte type); // for history browser
PumpEnactResult loadEvents(); // events history to build treatments from
+ PumpEnactResult setUserOptions(); // like AnyDana does
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/DanaRFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/DanaRFragment.java
index 068ad3ae1f..8d18ca4f04 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/DanaRFragment.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/DanaRFragment.java
@@ -11,6 +11,7 @@ import android.text.Spanned;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
+import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;
@@ -29,11 +30,14 @@ import info.nightscout.androidaps.db.ExtendedBolus;
import info.nightscout.androidaps.events.EventExtendedBolusChange;
import info.nightscout.androidaps.events.EventPumpStatusChanged;
import info.nightscout.androidaps.events.EventTempBasalChange;
+import info.nightscout.androidaps.interfaces.PluginType;
import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.PumpDanaR.Dialogs.ProfileViewDialog;
import info.nightscout.androidaps.plugins.PumpDanaR.activities.DanaRHistoryActivity;
+import info.nightscout.androidaps.plugins.PumpDanaR.activities.DanaRUserOptionsActivity;
import info.nightscout.androidaps.plugins.PumpDanaR.events.EventDanaRNewStatus;
+import info.nightscout.androidaps.plugins.PumpDanaRKorean.DanaRKoreanPlugin;
import info.nightscout.androidaps.plugins.Treatments.TreatmentsPlugin;
import info.nightscout.androidaps.queue.events.EventQueueChanged;
import info.nightscout.utils.DateUtil;
@@ -88,6 +92,8 @@ public class DanaRFragment extends SubscriberFragment {
LinearLayout pumpStatusLayout;
@BindView(R.id.overview_pumpstatus)
TextView pumpStatusView;
+ @BindView(R.id.danar_user_options)
+ Button danar_user_options;
public DanaRFragment() {
}
@@ -138,6 +144,9 @@ public class DanaRFragment extends SubscriberFragment {
startActivity(new Intent(getContext(), TDDStatsActivity.class));
}
+ @OnClick(R.id.danar_user_options)
+ void onUserOptionsClick() { startActivity(new Intent(getContext(), DanaRUserOptionsActivity.class)); }
+
@OnClick(R.id.danar_btconnection)
void onBtConnectionClick() {
log.debug("Clicked connect to pump");
@@ -268,6 +277,11 @@ public class DanaRFragment extends SubscriberFragment {
queueView.setText(status);
}
}
+ //hide user options button if not an RS pump
+ boolean isKorean = MainApp.getSpecificPlugin(DanaRKoreanPlugin.class) != null && MainApp.getSpecificPlugin(DanaRKoreanPlugin.class).isEnabled(PluginType.PUMP);
+ if (isKorean ) {
+ danar_user_options.setVisibility(View.GONE);
+ }
}
});
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/DanaRPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/DanaRPlugin.java
index 279a93340f..b1b0f3d9ce 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/DanaRPlugin.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/DanaRPlugin.java
@@ -379,4 +379,9 @@ public class DanaRPlugin extends AbstractDanaRPlugin {
public PumpEnactResult loadEvents() {
return null; // no history, not needed
}
+
+ @Override
+ public PumpEnactResult setUserOptions() {
+ return sExecutionService.setUserOptions();
+ }
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/DanaRPump.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/DanaRPump.java
index 1e346695e3..d9bc947b84 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/DanaRPump.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/DanaRPump.java
@@ -161,7 +161,7 @@ public class DanaRPump {
public int lowReservoirRate;
public int cannulaVolume;
public int refillAmount;
-
+ public byte[] userOptionsFrompump;
public double initialBolusAmount;
// Bolus settings
public int bolusCalculationOption;
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/activities/DanaRUserOptionsActivity.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/activities/DanaRUserOptionsActivity.java
new file mode 100644
index 0000000000..571f1a20e1
--- /dev/null
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/activities/DanaRUserOptionsActivity.java
@@ -0,0 +1,196 @@
+package info.nightscout.androidaps.plugins.PumpDanaR.activities;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.widget.Button;
+import android.widget.RadioButton;
+import android.widget.RadioGroup;
+import android.widget.Switch;
+
+import com.squareup.otto.Subscribe;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.text.DecimalFormat;
+
+import info.nightscout.androidaps.Constants;
+import info.nightscout.androidaps.MainApp;
+import info.nightscout.androidaps.R;
+import info.nightscout.androidaps.events.EventInitializationChanged;
+import info.nightscout.androidaps.interfaces.PluginType;
+import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPlugin;
+import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump;
+import info.nightscout.androidaps.plugins.PumpDanaRS.DanaRSPlugin;
+import info.nightscout.androidaps.plugins.PumpDanaRv2.DanaRv2Plugin;
+import info.nightscout.utils.NumberPicker;
+
+/**
+ * Created by Rumen Georgiev on 5/31/2018.
+ */
+
+public class DanaRUserOptionsActivity extends Activity {
+ private static Logger log = LoggerFactory.getLogger(DanaRUserOptionsActivity.class);
+
+ Switch timeFormat;
+ Switch buttonScroll;
+ Switch beep;
+ RadioGroup pumpAlarm;
+ RadioButton pumpAlarmSound;
+ RadioButton pumpAlarmVibrate;
+ RadioButton pumpAlarmBoth;
+ Switch pumpUnits;
+ NumberPicker screenTimeout;
+ NumberPicker backlightTimeout;
+ NumberPicker shutdown;
+ NumberPicker lowReservoir;
+ Button saveToPumpButton;
+
+ @Override
+ protected void onResume() {
+ super.onResume();
+ MainApp.bus().register(this);
+ }
+
+ @Override
+ protected void onPause() {
+ super.onPause();
+ MainApp.bus().unregister(this);
+ }
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.danar_user_options);
+
+ timeFormat = (Switch) findViewById(R.id.danar_timeformat);
+ buttonScroll = (Switch) findViewById(R.id.danar_buttonscroll);
+ beep = (Switch) findViewById(R.id.danar_beep);
+ pumpAlarm = (RadioGroup) findViewById(R.id.danar_pumpalarm);
+ pumpAlarmSound = (RadioButton) findViewById(R.id.danar_pumpalarm_sound);
+ pumpAlarmVibrate = (RadioButton) findViewById(R.id.danar_pumpalarm_vibrate);
+ pumpAlarmBoth = (RadioButton) findViewById(R.id.danar_pumpalarm_both);
+ screenTimeout = (NumberPicker) findViewById(R.id.danar_screentimeout);
+ backlightTimeout = (NumberPicker) findViewById(R.id.danar_backlight);
+ pumpUnits = (Switch) findViewById(R.id.danar_units);
+ shutdown = (NumberPicker) findViewById(R.id.danar_shutdown);
+ lowReservoir = (NumberPicker) findViewById(R.id.danar_lowreservoir);
+ saveToPumpButton = (Button) findViewById(R.id.save_user_options);
+
+ saveToPumpButton.setOnClickListener(v -> onSaveClick());
+
+ DanaRPump pump = DanaRPump.getInstance();
+ //used for debugging
+ log.debug("UserOptionsLoaded:" + (System.currentTimeMillis() - pump.lastConnection) / 1000 + " s ago"
+ + "\ntimeDisplayType:" + pump.timeDisplayType
+ + "\nbuttonScroll:" + pump.buttonScrollOnOff
+ + "\ntimeDisplayType:" + pump.timeDisplayType
+ + "\nlcdOnTimeSec:" + pump.lcdOnTimeSec
+ + "\nbacklight:" + pump.backlightOnTimeSec
+ + "\npumpUnits:" + pump.units
+ + "\nlowReservoir:" + pump.lowReservoirRate);
+
+ screenTimeout.setParams((double) pump.lcdOnTimeSec, 5d, 240d, 5d, new DecimalFormat("1"), false);
+ backlightTimeout.setParams((double) pump.backlightOnTimeSec, 1d, 60d, 1d, new DecimalFormat("1"), false);
+ shutdown.setParams((double) pump.shutdownHour, 0d, 24d, 1d, new DecimalFormat("1"), true);
+ lowReservoir.setParams((double) pump.lowReservoirRate, 10d, 60d, 10d, new DecimalFormat("10"), false);
+ switch (pump.beepAndAlarm) {
+ case 1: pumpAlarmSound.setChecked(true);
+ break;
+ case 2: pumpAlarmVibrate.setChecked(true);
+ break;
+ case 3: pumpAlarmBoth.setChecked(true);
+ break;
+ case 5: pumpAlarmSound.setChecked(true);
+ beep.setChecked(true);
+ break;
+ case 6: pumpAlarmVibrate.setChecked(true);
+ beep.setChecked(true);
+ break;
+ case 7: pumpAlarmBoth.setChecked(true);
+ beep.setChecked(true);
+ break;
+ }
+ if (pump.lastSettingsRead == 0)
+ log.debug("No settings loaded from pump!");
+ else
+ setData();
+ }
+
+ public void setData() {
+ DanaRPump pump = DanaRPump.getInstance();
+
+ timeFormat.setChecked(pump.timeDisplayType != 0);
+ buttonScroll.setChecked(pump.buttonScrollOnOff != 0);
+ beep.setChecked(pump.beepAndAlarm > 4);
+ screenTimeout.setValue((double) pump.lcdOnTimeSec);
+ backlightTimeout.setValue((double) pump.backlightOnTimeSec);
+ pumpUnits.setChecked(pump.getUnits() != null && pump.getUnits().equals(Constants.MMOL));
+ shutdown.setValue((double) pump.shutdownHour);
+ lowReservoir.setValue((double) pump.lowReservoirRate);
+ }
+
+ @Subscribe
+ public void onEventInitializationChanged(EventInitializationChanged ignored) {
+ runOnUiThread(this::setData);
+ }
+
+ public void onSaveClick() {
+ boolean isRS = MainApp.getSpecificPlugin(DanaRSPlugin.class) != null && MainApp.getSpecificPlugin(DanaRSPlugin.class).isEnabled(PluginType.PUMP);
+ boolean isDanaR = MainApp.getSpecificPlugin(DanaRPlugin.class) != null && MainApp.getSpecificPlugin(DanaRPlugin.class).isEnabled(PluginType.PUMP);
+ boolean isDanaRv2 = MainApp.getSpecificPlugin(DanaRv2Plugin.class) != null && MainApp.getSpecificPlugin(DanaRv2Plugin.class).isEnabled(PluginType.PUMP);
+ if (!isRS && !isDanaR && !isDanaRv2) {
+ //exit if pump is not DanaRS, Dana!, or DanaR with upgraded firmware
+ return;
+ }
+ DanaRPump pump = DanaRPump.getInstance();
+
+ if (timeFormat.isChecked())
+ pump.timeDisplayType = 1;
+ else
+ pump.timeDisplayType = 0;
+ if (buttonScroll.isChecked())
+ pump.buttonScrollOnOff = 1;
+ else
+ pump.buttonScrollOnOff = 0;
+
+ pump.beepAndAlarm = 1; // default
+ if (pumpAlarmSound.isChecked()) pump.beepAndAlarm = 1;
+ else if (pumpAlarmVibrate.isChecked()) pump.beepAndAlarm = 2;
+ else if (pumpAlarmBoth.isChecked()) pump.beepAndAlarm = 3;
+ if (beep.isChecked()) pump.beepAndAlarm += 4;
+
+
+ // step is 5 seconds
+ int screenTimeoutValue = !screenTimeout.getText().isEmpty() ? (Integer.parseInt(screenTimeout.getText().toString()) / 5) * 5: 5;
+ if (screenTimeoutValue > 4 && screenTimeoutValue < 241) {
+ pump.lcdOnTimeSec = screenTimeoutValue;
+ } else {
+ pump.lcdOnTimeSec = 5;
+ }
+ int backlightTimeoutValue = !backlightTimeout.getText().isEmpty() ? Integer.parseInt(backlightTimeout.getText().toString()): 1;
+ if (backlightTimeoutValue > 0 && backlightTimeoutValue < 61) {
+ pump.backlightOnTimeSec = backlightTimeoutValue;
+ }
+ if (pumpUnits.isChecked()) {
+ pump.units = 1;
+ } else {
+ pump.units = 0;
+ }
+ int shutDownValue = !shutdown.getText().isEmpty() ? Integer.parseInt(shutdown.getText().toString()) : 0;
+ if (shutDownValue > -1 && shutDownValue < 25) {
+ pump.shutdownHour = shutDownValue;
+ } else {
+ pump.shutdownHour = 0;
+ }
+ int lowReservoirValue = !lowReservoir.getText().isEmpty() ? (Integer.parseInt(lowReservoir.getText().toString()) * 10) / 10 : 10;
+ if (lowReservoirValue > 9 && lowReservoirValue < 51) {
+ pump.lowReservoirRate = lowReservoirValue;
+ } else
+ pump.lowReservoirRate = 10;
+
+ MainApp.getConfigBuilder().getCommandQueue().setUserOptions(null);
+ finish();
+ }
+
+}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/comm/MessageHashTable.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/comm/MessageHashTable.java
index 10d2c0b091..4b90b8f02d 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/comm/MessageHashTable.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/comm/MessageHashTable.java
@@ -60,6 +60,7 @@ public class MessageHashTable {
put(new MsgSettingProfileRatiosAll()); // 0x320D CMD_SETTING_V_CIR_CF_VALUE
put(new MsgSetSingleBasalProfile()); // 0x3302 CMD_SETTING_BASAL_INS_S
put(new MsgSetBasalProfile()); // 0x3306 CMD_SETTING_BASAL_PROFILE_S
+ put(new MsgSetUserOptions()); // 0x330B CMD_SETTING_USER_OPTIONS_S
put(new MsgSetActivateBasalProfile()); // 0x330C CMD_SETTING_PROFILE_NUMBER_S
put(new MsgHistoryAllDone()); // 0x41F1 CMD_HISTORY_ALL_DONE
put(new MsgHistoryAll()); // 0x41F2 CMD_HISTORY_ALL
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/comm/MsgSetUserOptions.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/comm/MsgSetUserOptions.java
new file mode 100644
index 0000000000..407b19da8d
--- /dev/null
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/comm/MsgSetUserOptions.java
@@ -0,0 +1,52 @@
+package info.nightscout.androidaps.plugins.PumpDanaR.comm;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import android.support.v4.internal.view.SupportMenu;
+
+import info.nightscout.androidaps.Config;
+import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump;
+
+/**
+ * Created by mike on 05.07.2016.
+ */
+public class MsgSetUserOptions extends MessageBase {
+
+ private static Logger log = LoggerFactory.getLogger(MsgSetUserOptions.class);
+
+ public boolean done;
+
+ public MsgSetUserOptions() {
+ SetCommand(0x330B);
+ DanaRPump pump = DanaRPump.getInstance();
+ if (pump.userOptionsFrompump == null) {
+ // No options set -> Exitting
+ log.debug("NO USER OPTIONS LOADED EXITTING!");
+ return;
+ }
+ pump.userOptionsFrompump[0] = (byte) (pump.timeDisplayType == 1 ? 0 : 1);
+ pump.userOptionsFrompump[1] = (byte) pump.buttonScrollOnOff;
+ pump.userOptionsFrompump[2] = (byte) pump.beepAndAlarm;
+ pump.userOptionsFrompump[3] = (byte) pump.lcdOnTimeSec;
+ pump.userOptionsFrompump[4] = (byte) pump.backlightOnTimeSec;
+ pump.userOptionsFrompump[5] = (byte) pump.selectedLanguage;
+ pump.userOptionsFrompump[8] = (byte) pump.units;
+ pump.userOptionsFrompump[9] = (byte) pump.shutdownHour;
+ pump.userOptionsFrompump[27] = (byte) pump.lowReservoirRate;
+ for(int i=0; i 24h 0 -> 12h
+ pump.buttonScrollOnOff = bytes[1] == (byte) 1 ? 1 : 0; // 1 -> ON, 0-> OFF
+ pump.beepAndAlarm = bytes[2]; // 1 -> Sound on alarm 2-> Vibrate on alarm 3-> Both on alarm 5-> Sound + beep 6-> vibrate + beep 7-> both + beep Beep adds 4
+ pump.lcdOnTimeSec = bytes[3] & 255;
+ pump.backlightOnTimeSec = bytes[4] & 255;
+ pump.selectedLanguage = bytes[5]; // on DanaRv2 is that needed ?
+ pump.units = bytes[8];
+ pump.shutdownHour = bytes[9];
+ pump.lowReservoirRate = bytes[32] & 255;
+ /* int selectableLanguage1 = bytes[10];
+ int selectableLanguage2 = bytes[11];
+ int selectableLanguage3 = bytes[12];
+ int selectableLanguage4 = bytes[13];
+ int selectableLanguage5 = bytes[14];
+ */
+ if (Config.logDanaMessageDetail) {
+
+ log.debug("timeDisplayType: " + pump.timeDisplayType);
+ log.debug("Button scroll: " + pump.buttonScrollOnOff);
+ log.debug("BeepAndAlarm: " + pump.beepAndAlarm);
+ log.debug("screen timeout: " + pump.lcdOnTimeSec);
+ log.debug("Backlight: " + pump.backlightOnTimeSec);
+ log.debug("Selected language: " + pump.selectedLanguage);
+ log.debug("Units: " + pump.getUnits());
+ log.debug("Shutdown: " + pump.shutdownHour);
+ log.debug("Low reservoir: " + pump.lowReservoirRate);
+ }
}
+ public static byte[] getDataBytes(byte[] bytes, int start, int len) {
+ if (bytes == null) {
+ return null;
+ }
+ byte[] ret = new byte[len];
+ System.arraycopy(bytes, start + 6, ret, 0, len);
+ return ret;
+ }
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/services/AbstractDanaRExecutionService.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/services/AbstractDanaRExecutionService.java
index 17db916dae..e4c2933d43 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/services/AbstractDanaRExecutionService.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/services/AbstractDanaRExecutionService.java
@@ -92,6 +92,7 @@ public abstract class AbstractDanaRExecutionService extends Service {
public abstract boolean extendedBolusStop();
+ public abstract PumpEnactResult setUserOptions();
protected BroadcastReceiver receiver = new BroadcastReceiver() {
@Override
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/services/DanaRExecutionService.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/services/DanaRExecutionService.java
index 3d4245fb2a..7976430b77 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/services/DanaRExecutionService.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/services/DanaRExecutionService.java
@@ -18,6 +18,8 @@ import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.data.Profile;
import info.nightscout.androidaps.data.PumpEnactResult;
+import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSettingUserOptions;
+import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSetUserOptions;
import info.nightscout.androidaps.plugins.Treatments.Treatment;
import info.nightscout.androidaps.events.EventAppExit;
import info.nightscout.androidaps.events.EventInitializationChanged;
@@ -62,7 +64,6 @@ import info.nightscout.androidaps.plugins.PumpDanaR.events.EventDanaRNewStatus;
import info.nightscout.androidaps.queue.Callback;
import info.nightscout.utils.NSUpload;
import info.nightscout.utils.SP;
-import info.nightscout.utils.ToastUtils;
public class DanaRExecutionService extends AbstractDanaRExecutionService{
@@ -177,6 +178,7 @@ public class DanaRExecutionService extends AbstractDanaRExecutionService{
mSerialIOThread.sendMessage(new MsgSettingActiveProfile());
mSerialIOThread.sendMessage(new MsgSettingProfileRatios());
mSerialIOThread.sendMessage(new MsgSettingProfileRatiosAll());
+ mSerialIOThread.sendMessage(new MsgSettingUserOptions());
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingpumptime)));
mSerialIOThread.sendMessage(new MsgSettingPumpTime());
long timeDiff = (mDanaRPump.pumpTime.getTime() - System.currentTimeMillis()) / 1000L;
@@ -397,4 +399,13 @@ public class DanaRExecutionService extends AbstractDanaRExecutionService{
log.debug("EventAppExit finished");
}
+ public PumpEnactResult setUserOptions() {
+ if (!isConnected())
+ return new PumpEnactResult().success(false);
+ SystemClock.sleep(300);
+ MsgSetUserOptions msg = new MsgSetUserOptions();
+ mSerialIOThread.sendMessage(msg);
+ SystemClock.sleep(200);
+ return new PumpEnactResult().success(!msg.failed);
+ }
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRKorean/DanaRKoreanPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRKorean/DanaRKoreanPlugin.java
index 092febec61..b7b100a3a6 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRKorean/DanaRKoreanPlugin.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRKorean/DanaRKoreanPlugin.java
@@ -380,4 +380,9 @@ public class DanaRKoreanPlugin extends AbstractDanaRPlugin {
public PumpEnactResult loadEvents() {
return null; // no history, not needed
}
+
+ @Override
+ public PumpEnactResult setUserOptions() {
+ return null;
+ }
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRKorean/services/DanaRKoreanExecutionService.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRKorean/services/DanaRKoreanExecutionService.java
index e46e3d6caf..7854426b5d 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRKorean/services/DanaRKoreanExecutionService.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRKorean/services/DanaRKoreanExecutionService.java
@@ -327,4 +327,9 @@ public class DanaRKoreanExecutionService extends AbstractDanaRExecutionService {
return true;
}
+ @Override
+ public PumpEnactResult setUserOptions() {
+ return null;
+ }
+
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRS/DanaRSPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRS/DanaRSPlugin.java
index bf44745f4a..b6d9d1721e 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRS/DanaRSPlugin.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRS/DanaRSPlugin.java
@@ -26,8 +26,6 @@ import info.nightscout.androidaps.data.ProfileStore;
import info.nightscout.androidaps.data.PumpEnactResult;
import info.nightscout.androidaps.db.ExtendedBolus;
import info.nightscout.androidaps.db.TemporaryBasal;
-import info.nightscout.androidaps.plugins.PumpDanaRS.comm.DanaRS_Packet_Bolus_Set_Step_Bolus_Start;
-import info.nightscout.androidaps.plugins.Treatments.Treatment;
import info.nightscout.androidaps.events.EventAppExit;
import info.nightscout.androidaps.interfaces.Constraint;
import info.nightscout.androidaps.interfaces.ConstraintsInterface;
@@ -46,8 +44,10 @@ import info.nightscout.androidaps.plugins.ProfileNS.NSProfilePlugin;
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRFragment;
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump;
import info.nightscout.androidaps.plugins.PumpDanaR.comm.RecordTypes;
+import info.nightscout.androidaps.plugins.PumpDanaRS.comm.DanaRS_Packet_Bolus_Set_Step_Bolus_Start;
import info.nightscout.androidaps.plugins.PumpDanaRS.events.EventDanaRSDeviceChange;
import info.nightscout.androidaps.plugins.PumpDanaRS.services.DanaRSService;
+import info.nightscout.androidaps.plugins.Treatments.Treatment;
import info.nightscout.androidaps.plugins.Treatments.TreatmentsPlugin;
import info.nightscout.utils.DateUtil;
import info.nightscout.utils.DecimalFormatter;
@@ -224,6 +224,11 @@ public class DanaRSPlugin extends PluginBase implements PumpInterface, DanaRInte
return danaRSService.loadEvents();
}
+ @Override
+ public PumpEnactResult setUserOptions() {
+ return danaRSService.setUserSettings();
+ }
+
// Constraints interface
@Override
@@ -759,4 +764,5 @@ public class DanaRSPlugin extends PluginBase implements PumpInterface, DanaRInte
public PumpEnactResult loadTDDs() {
return loadHistory(RecordTypes.RECORD_TYPE_DAILY);
}
+
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRS/comm/DanaRS_Packet_Option_Set_User_Option.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRS/comm/DanaRS_Packet_Option_Set_User_Option.java
index e5d9374f32..40577aaa5d 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRS/comm/DanaRS_Packet_Option_Set_User_Option.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRS/comm/DanaRS_Packet_Option_Set_User_Option.java
@@ -23,7 +23,14 @@ public class DanaRS_Packet_Option_Set_User_Option extends DanaRS_Packet {
@Override
public byte[] getRequestParams() {
DanaRPump pump = DanaRPump.getInstance();
-
+ log.debug("UserOptions:"+(System.currentTimeMillis() - pump.lastConnection)/1000+" s ago"
+ +"\ntimeDisplayType:"+pump.timeDisplayType
+ +"\nbuttonScroll:"+pump.buttonScrollOnOff
+ +"\ntimeDisplayType:"+pump.timeDisplayType
+ +"\nlcdOnTimeSec:"+pump.lcdOnTimeSec
+ +"\nbacklight:"+pump.backlightOnTimeSec
+ +"\npumpUnits:"+pump.units
+ +"\nlowReservoir:"+pump.lowReservoirRate);
byte[] request = new byte[13];
request[0] = (byte) (pump.timeDisplayType & 0xff);
request[1] = (byte) (pump.buttonScrollOnOff & 0xff);
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRS/services/DanaRSService.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRS/services/DanaRSService.java
index 856b95492d..63035d64d0 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRS/services/DanaRSService.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRS/services/DanaRSService.java
@@ -19,6 +19,7 @@ import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.data.Profile;
import info.nightscout.androidaps.data.PumpEnactResult;
+import info.nightscout.androidaps.plugins.PumpDanaRS.comm.DanaRS_Packet_Option_Get_User_Option;
import info.nightscout.androidaps.plugins.Treatments.Treatment;
import info.nightscout.androidaps.events.EventAppExit;
import info.nightscout.androidaps.events.EventInitializationChanged;
@@ -70,6 +71,7 @@ import info.nightscout.androidaps.plugins.PumpDanaRS.comm.DanaRS_Packet_Notify_D
import info.nightscout.androidaps.plugins.PumpDanaRS.comm.DanaRS_Packet_Notify_Delivery_Rate_Display;
import info.nightscout.androidaps.plugins.PumpDanaRS.comm.DanaRS_Packet_Option_Get_Pump_Time;
import info.nightscout.androidaps.plugins.PumpDanaRS.comm.DanaRS_Packet_Option_Set_Pump_Time;
+import info.nightscout.androidaps.plugins.PumpDanaRS.comm.DanaRS_Packet_Option_Set_User_Option;
import info.nightscout.androidaps.queue.Callback;
import info.nightscout.utils.DateUtil;
import info.nightscout.utils.NSUpload;
@@ -146,6 +148,7 @@ public class DanaRSService extends Service {
bleComm.sendMessage(new DanaRS_Packet_Bolus_Get_CIR_CF_Array());
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingpumptime)));
bleComm.sendMessage(new DanaRS_Packet_Option_Get_Pump_Time());
+ bleComm.sendMessage(new DanaRS_Packet_Option_Get_User_Option()); // Getting user options
long timeDiff = (danaRPump.pumpTime.getTime() - System.currentTimeMillis()) / 1000L;
log.debug("Pump time difference: " + timeDiff + " seconds");
if (Math.abs(timeDiff) > 3) {
@@ -202,6 +205,13 @@ public class DanaRSService extends Service {
}
+ public PumpEnactResult setUserSettings() {
+ bleComm.sendMessage(new DanaRS_Packet_Option_Set_User_Option());
+ bleComm.sendMessage(new DanaRS_Packet_Option_Get_User_Option());
+ return new PumpEnactResult().success(true);
+ }
+
+
public boolean bolus(final double insulin, int carbs, long carbtime, Treatment t) {
if (!isConnected()) return false;
if (BolusProgressDialog.stopPressed) return false;
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRv2/DanaRv2Plugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRv2/DanaRv2Plugin.java
index 7c13707949..b4004fecb3 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRv2/DanaRv2Plugin.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRv2/DanaRv2Plugin.java
@@ -389,4 +389,8 @@ public class DanaRv2Plugin extends AbstractDanaRPlugin {
return sExecutionService.loadEvents();
}
+ @Override
+ public PumpEnactResult setUserOptions() {
+ return sExecutionService.setUserOptions();
+ }
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRv2/comm/MessageHashTable_v2.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRv2/comm/MessageHashTable_v2.java
index cafba32239..8d1cd12be1 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRv2/comm/MessageHashTable_v2.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRv2/comm/MessageHashTable_v2.java
@@ -66,6 +66,7 @@ public class MessageHashTable_v2 {
put(new MsgSettingProfileRatiosAll()); // 0x320D CMD_SETTING_V_CIR_CF_VALUE
put(new MsgSetSingleBasalProfile()); // 0x3302 CMD_SETTING_BASAL_INS_S
put(new MsgSetBasalProfile()); // 0x3306 CMD_SETTING_BASAL_PROFILE_S
+ put(new MsgSetUserOptions()); // 0x330B CMD_SETTING_USER_OPTIONS_S
put(new MsgSetActivateBasalProfile()); // 0x330C CMD_SETTING_PROFILE_NUMBER_S
put(new MsgHistoryAllDone()); // 0x41F1 CMD_HISTORY_ALL_DONE
put(new MsgHistoryAll()); // 0x41F2 CMD_HISTORY_ALL
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRv2/services/DanaRv2ExecutionService.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRv2/services/DanaRv2ExecutionService.java
index 2e27122abb..1ada4c629d 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRv2/services/DanaRv2ExecutionService.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRv2/services/DanaRv2ExecutionService.java
@@ -18,6 +18,8 @@ import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.data.Profile;
import info.nightscout.androidaps.data.PumpEnactResult;
+import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSettingUserOptions;
+import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgSetUserOptions;
import info.nightscout.androidaps.plugins.Treatments.Treatment;
import info.nightscout.androidaps.events.EventAppExit;
import info.nightscout.androidaps.events.EventInitializationChanged;
@@ -68,7 +70,6 @@ import info.nightscout.utils.DateUtil;
import info.nightscout.utils.NSUpload;
import info.nightscout.utils.SP;
import info.nightscout.utils.T;
-import info.nightscout.utils.ToastUtils;
public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
@@ -199,6 +200,7 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
mSerialIOThread.sendMessage(new MsgSettingGlucose());
mSerialIOThread.sendMessage(new MsgSettingActiveProfile());
mSerialIOThread.sendMessage(new MsgSettingProfileRatios());
+ mSerialIOThread.sendMessage(new MsgSettingUserOptions());
mSerialIOThread.sendMessage(new MsgSettingProfileRatiosAll());
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingpumptime)));
mSerialIOThread.sendMessage(new MsgSettingPumpTime());
@@ -471,4 +473,15 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
SystemClock.sleep(Math.min(timeToWholeMinute, 100));
}
}
+
+ public PumpEnactResult setUserOptions() {
+ if (!isConnected())
+ return new PumpEnactResult().success(false);
+ SystemClock.sleep(300);
+ MsgSetUserOptions msg = new MsgSetUserOptions();
+ mSerialIOThread.sendMessage(msg);
+ SystemClock.sleep(200);
+ return new PumpEnactResult().success(!msg.failed);
+ }
+
}
diff --git a/app/src/main/java/info/nightscout/androidaps/queue/CommandQueue.java b/app/src/main/java/info/nightscout/androidaps/queue/CommandQueue.java
index cc28eb28a0..9f2fdf7eee 100644
--- a/app/src/main/java/info/nightscout/androidaps/queue/CommandQueue.java
+++ b/app/src/main/java/info/nightscout/androidaps/queue/CommandQueue.java
@@ -37,6 +37,7 @@ import info.nightscout.androidaps.queue.commands.CommandLoadTDDs;
import info.nightscout.androidaps.queue.commands.CommandReadStatus;
import info.nightscout.androidaps.queue.commands.CommandSMBBolus;
import info.nightscout.androidaps.queue.commands.CommandSetProfile;
+import info.nightscout.androidaps.queue.commands.CommandSetUserSettings;
import info.nightscout.androidaps.queue.commands.CommandTempBasalAbsolute;
import info.nightscout.androidaps.queue.commands.CommandTempBasalPercent;
@@ -403,6 +404,25 @@ public class CommandQueue {
return true;
}
+ // returns true if command is queued
+ public boolean setUserOptions(Callback callback) {
+ if (isRunning(Command.CommandType.SETUSERSETTINGS)) {
+ if (callback != null)
+ callback.result(executingNowError()).run();
+ return false;
+ }
+
+ // remove all unfinished
+ removeAll(Command.CommandType.SETUSERSETTINGS);
+
+ // add new command to queue
+ add(new CommandSetUserSettings(callback));
+
+ notifyAboutNewCommand();
+
+ return true;
+ }
+
// returns true if command is queued
public boolean loadTDDs(Callback callback) {
if (isRunning(Command.CommandType.LOADHISTORY)) {
diff --git a/app/src/main/java/info/nightscout/androidaps/queue/commands/Command.java b/app/src/main/java/info/nightscout/androidaps/queue/commands/Command.java
index b865fac86e..7156a72f25 100644
--- a/app/src/main/java/info/nightscout/androidaps/queue/commands/Command.java
+++ b/app/src/main/java/info/nightscout/androidaps/queue/commands/Command.java
@@ -18,7 +18,8 @@ public abstract class Command {
BASALPROFILE,
READSTATUS,
LOADHISTORY, // TDDs and so far only Dana specific
- LOADEVENTS // so far only Dana specific
+ LOADEVENTS, // so far only Dana specific
+ SETUSERSETTINGS // so far only Dana specific
}
public CommandType commandType;
diff --git a/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandSetUserSettings.java b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandSetUserSettings.java
new file mode 100644
index 0000000000..f3d9fe2a4b
--- /dev/null
+++ b/app/src/main/java/info/nightscout/androidaps/queue/commands/CommandSetUserSettings.java
@@ -0,0 +1,45 @@
+package info.nightscout.androidaps.queue.commands;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import info.nightscout.androidaps.MainApp;
+import info.nightscout.androidaps.data.PumpEnactResult;
+import info.nightscout.androidaps.interfaces.DanaRInterface;
+import info.nightscout.androidaps.interfaces.PluginType;
+import info.nightscout.androidaps.interfaces.PumpInterface;
+import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
+import info.nightscout.androidaps.plugins.PumpDanaRv2.DanaRv2Plugin;
+import info.nightscout.androidaps.queue.Callback;
+
+/**
+ * Created by mike on 10.11.2017.
+ */
+
+public class CommandSetUserSettings extends Command {
+ private static Logger log = LoggerFactory.getLogger(CommandSetUserSettings.class);
+ public CommandSetUserSettings(Callback callback) {
+ commandType = CommandType.SETUSERSETTINGS;
+ this.callback = callback;
+ }
+
+ @Override
+ public void execute() {
+ PumpInterface pump = ConfigBuilderPlugin.getActivePump();
+ if (pump instanceof DanaRInterface) {
+ DanaRInterface danaPump = (DanaRInterface) pump;
+ boolean isDanaRv2 = MainApp.getSpecificPlugin(DanaRv2Plugin.class) != null && MainApp.getSpecificPlugin(DanaRv2Plugin.class).isEnabled(PluginType.PUMP);
+ if(isDanaRv2){
+ log.debug("MsgSetUserOptions detected for DanaRv2");
+ }
+ PumpEnactResult r = danaPump.setUserOptions();
+ if (callback != null)
+ callback.result(r).run();
+ }
+ }
+
+ @Override
+ public String status() {
+ return "SETUSERSETTINGS";
+ }
+}
diff --git a/app/src/main/res/drawable-hdpi/icon_danar_useropthdpi.png b/app/src/main/res/drawable-hdpi/icon_danar_useropthdpi.png
new file mode 100644
index 0000000000..ee3ab7725e
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/icon_danar_useropthdpi.png differ
diff --git a/app/src/main/res/drawable-hdpi/icon_local_activatehdpi.png b/app/src/main/res/drawable-hdpi/icon_local_activatehdpi.png
new file mode 100644
index 0000000000..4ef567ffb6
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/icon_local_activatehdpi.png differ
diff --git a/app/src/main/res/drawable-hdpi/icon_local_resethdpi.png b/app/src/main/res/drawable-hdpi/icon_local_resethdpi.png
new file mode 100644
index 0000000000..7d38cf0b50
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/icon_local_resethdpi.png differ
diff --git a/app/src/main/res/drawable-hdpi/icon_local_savehdpi.png b/app/src/main/res/drawable-hdpi/icon_local_savehdpi.png
new file mode 100644
index 0000000000..e5c1d5cedc
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/icon_local_savehdpi.png differ
diff --git a/app/src/main/res/drawable-mdpi/icon_danar_useroptmdpi.png b/app/src/main/res/drawable-mdpi/icon_danar_useroptmdpi.png
new file mode 100644
index 0000000000..1fadcd446b
Binary files /dev/null and b/app/src/main/res/drawable-mdpi/icon_danar_useroptmdpi.png differ
diff --git a/app/src/main/res/drawable-mdpi/icon_local_activatemdpi.png b/app/src/main/res/drawable-mdpi/icon_local_activatemdpi.png
new file mode 100644
index 0000000000..b39c72b407
Binary files /dev/null and b/app/src/main/res/drawable-mdpi/icon_local_activatemdpi.png differ
diff --git a/app/src/main/res/drawable-mdpi/icon_local_resetmdpi.png b/app/src/main/res/drawable-mdpi/icon_local_resetmdpi.png
new file mode 100644
index 0000000000..ad2e0eaf6d
Binary files /dev/null and b/app/src/main/res/drawable-mdpi/icon_local_resetmdpi.png differ
diff --git a/app/src/main/res/drawable-mdpi/icon_local_savemdpi.png b/app/src/main/res/drawable-mdpi/icon_local_savemdpi.png
new file mode 100644
index 0000000000..843beed523
Binary files /dev/null and b/app/src/main/res/drawable-mdpi/icon_local_savemdpi.png differ
diff --git a/app/src/main/res/drawable-xhdpi/icon_danar_useroptxhdpi.png b/app/src/main/res/drawable-xhdpi/icon_danar_useroptxhdpi.png
new file mode 100644
index 0000000000..126122a570
Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/icon_danar_useroptxhdpi.png differ
diff --git a/app/src/main/res/drawable-xhdpi/icon_local_activatexhdpi.png b/app/src/main/res/drawable-xhdpi/icon_local_activatexhdpi.png
new file mode 100644
index 0000000000..75e9af38ed
Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/icon_local_activatexhdpi.png differ
diff --git a/app/src/main/res/drawable-xhdpi/icon_local_resetxhdpi.png b/app/src/main/res/drawable-xhdpi/icon_local_resetxhdpi.png
new file mode 100644
index 0000000000..2813cb448d
Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/icon_local_resetxhdpi.png differ
diff --git a/app/src/main/res/drawable-xhdpi/icon_local_savexhdpi.png b/app/src/main/res/drawable-xhdpi/icon_local_savexhdpi.png
new file mode 100644
index 0000000000..0cf81430cc
Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/icon_local_savexhdpi.png differ
diff --git a/app/src/main/res/drawable-xxhdpi/icon_danar_useroptxxhdpi.png b/app/src/main/res/drawable-xxhdpi/icon_danar_useroptxxhdpi.png
new file mode 100644
index 0000000000..b2a8eb9313
Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/icon_danar_useroptxxhdpi.png differ
diff --git a/app/src/main/res/drawable-xxhdpi/icon_local_activatexxhdpi.png b/app/src/main/res/drawable-xxhdpi/icon_local_activatexxhdpi.png
new file mode 100644
index 0000000000..600e6ee61c
Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/icon_local_activatexxhdpi.png differ
diff --git a/app/src/main/res/drawable-xxhdpi/icon_local_resetxxhdpi.png b/app/src/main/res/drawable-xxhdpi/icon_local_resetxxhdpi.png
new file mode 100644
index 0000000000..dc9d659dd7
Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/icon_local_resetxxhdpi.png differ
diff --git a/app/src/main/res/drawable-xxhdpi/icon_local_savexxhdpi.png b/app/src/main/res/drawable-xxhdpi/icon_local_savexxhdpi.png
new file mode 100644
index 0000000000..20448e4bf9
Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/icon_local_savexxhdpi.png differ
diff --git a/app/src/main/res/drawable-xxxhdpi/icon_danar_useroptxxxhdpi.png b/app/src/main/res/drawable-xxxhdpi/icon_danar_useroptxxxhdpi.png
new file mode 100644
index 0000000000..52f952ced4
Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/icon_danar_useroptxxxhdpi.png differ
diff --git a/app/src/main/res/drawable-xxxhdpi/icon_local_activatexxxhdpi.png b/app/src/main/res/drawable-xxxhdpi/icon_local_activatexxxhdpi.png
new file mode 100644
index 0000000000..2de9ce9d4d
Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/icon_local_activatexxxhdpi.png differ
diff --git a/app/src/main/res/drawable-xxxhdpi/icon_local_resetxxxhdpi.png b/app/src/main/res/drawable-xxxhdpi/icon_local_resetxxxhdpi.png
new file mode 100644
index 0000000000..ec54479149
Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/icon_local_resetxxxhdpi.png differ
diff --git a/app/src/main/res/drawable-xxxhdpi/icon_local_savexxxhdpi.png b/app/src/main/res/drawable-xxxhdpi/icon_local_savexxxhdpi.png
new file mode 100644
index 0000000000..f2ecc45ac0
Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/icon_local_savexxxhdpi.png differ
diff --git a/app/src/main/res/drawable/icon_danar_useropt.png b/app/src/main/res/drawable/icon_danar_useropt.png
new file mode 100644
index 0000000000..1fadcd446b
Binary files /dev/null and b/app/src/main/res/drawable/icon_danar_useropt.png differ
diff --git a/app/src/main/res/layout/danar_fragment.xml b/app/src/main/res/layout/danar_fragment.xml
index fc2d298d35..8951344820 100644
--- a/app/src/main/res/layout/danar_fragment.xml
+++ b/app/src/main/res/layout/danar_fragment.xml
@@ -702,7 +702,7 @@
android:id="@+id/danar_viewprofile"
style="@style/ButtonSmallFontStyle"
android:layout_width="match_parent"
- android:layout_height="wrap_content"
+ android:layout_height="match_parent"
android:layout_weight="1"
android:drawableTop="@drawable/icon_danarprofile"
android:paddingLeft="0dp"
@@ -714,7 +714,7 @@
android:id="@+id/danar_history"
style="@style/ButtonSmallFontStyle"
android:layout_width="match_parent"
- android:layout_height="wrap_content"
+ android:layout_height="match_parent"
android:layout_weight="1"
android:drawableTop="@drawable/icon_danarhistory"
android:paddingLeft="0dp"
@@ -725,13 +725,24 @@
android:id="@+id/danar_stats"
style="@style/ButtonSmallFontStyle"
android:layout_width="match_parent"
- android:layout_height="wrap_content"
+ android:layout_height="match_parent"
android:layout_weight="1"
android:drawableTop="@drawable/icon_danarstats"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:text="@string/danar_stats" />
+
+
diff --git a/app/src/main/res/layout/danar_user_options.xml b/app/src/main/res/layout/danar_user_options.xml
new file mode 100644
index 0000000000..6fa8b93b26
--- /dev/null
+++ b/app/src/main/res/layout/danar_user_options.xml
@@ -0,0 +1,406 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index eb9e2cc36c..2c42f8aa05 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -1137,6 +1137,22 @@
Request
Configure Insulin plugin
Exit
+ User options
+ Display time format
+ Button scroll
+ Beep on button press
+ Alarm
+ Sound
+ Vibrate
+ Both
+ LCD on time(seconds)
+ Backlight on time(seconds)
+ Glucose units
+ Shutdown(hours)
+ Low reservoir (Units)
+ Save options to pump
+ On
+ Off
Open navigation
Close navigation
Plugin preferences