diff --git a/app/build.gradle b/app/build.gradle index 72b483c9fe..16e3bfbe71 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -63,7 +63,7 @@ android { targetSdkVersion 25 multiDexEnabled true versionCode 1500 - version "1.60d-dev" + version "1.60e-dev" buildConfigField "String", "VERSION", '"' + version + '"' buildConfigField "String", "BUILDVERSION", generateGitBuild() testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" diff --git a/app/libs/sightparser-release.aar b/app/libs/sightparser-release.aar index 4e474e608e..0d656738d2 100644 Binary files a/app/libs/sightparser-release.aar and b/app/libs/sightparser-release.aar differ diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 00d59f09bb..ca4bff0dd5 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -15,9 +15,11 @@ - + + + @@ -111,6 +113,14 @@ + + + + + + + + bucketed_data = iobCobCalculatorPlugin.getBucketedData(); - LongSparseArray autosensDataTable = iobCobCalculatorPlugin.getAutosensDataTable(); + LongSparseArray autosensDataTable = IobCobCalculatorPlugin.getPlugin().getAutosensDataTable(); if (bucketed_data == null || bucketed_data.size() < 3) { log.debug("Aborting calculation thread (No bucketed data available): " + from); return; } - long prevDataTime = iobCobCalculatorPlugin.roundUpTime(bucketed_data.get(bucketed_data.size() - 3).date); + long prevDataTime = IobCobCalculatorPlugin.roundUpTime(bucketed_data.get(bucketed_data.size() - 3).date); log.debug("Prev data time: " + new Date(prevDataTime).toLocaleString()); AutosensData previous = autosensDataTable.get(prevDataTime); // start from oldest to be able sub cob for (int i = bucketed_data.size() - 4; i >= 0; i--) { + MainApp.bus().post(new EventIobCalculationProgress(i + "/" + bucketed_data.size())); + if (iobCobCalculatorPlugin.stopCalculationTrigger) { iobCobCalculatorPlugin.stopCalculationTrigger = false; log.debug("Aborting calculation thread (trigger): " + from); @@ -98,10 +107,9 @@ public class IobCobThread extends Thread { } // check if data already exists long bgTime = bucketed_data.get(i).date; - bgTime = iobCobCalculatorPlugin.roundUpTime(bgTime); - if (bgTime > System.currentTimeMillis()) + bgTime = IobCobCalculatorPlugin.roundUpTime(bgTime); + if (bgTime > IobCobCalculatorPlugin.roundUpTime(now())) continue; - Profile profile = MainApp.getConfigBuilder().getProfile(bgTime); AutosensData existing; if ((existing = autosensDataTable.get(bgTime)) != null) { @@ -109,6 +117,7 @@ public class IobCobThread extends Thread { continue; } + Profile profile = MainApp.getConfigBuilder().getProfile(bgTime); if (profile == null) { log.debug("Aborting calculation thread (no profile): " + from); return; // profile not set yet @@ -152,7 +161,7 @@ public class IobCobThread extends Thread { // https://github.com/openaps/oref0/blob/master/lib/determine-basal/cob-autosens.js#L169 if (i < bucketed_data.size() - 16) { // we need 1h of data to calculate minDeviationSlope long hourago = bgTime + 10 * 1000 - 60 * 60 * 1000L; - AutosensData hourAgoData = iobCobCalculatorPlugin.getAutosensData(hourago); + AutosensData hourAgoData = IobCobCalculatorPlugin.getPlugin().getAutosensData(hourago); if (hourAgoData != null) { int initialIndex = autosensDataTable.indexOfKey(hourAgoData.time); if (Config.logAutosensData) @@ -199,18 +208,27 @@ public class IobCobThread extends Thread { if (previous != null && previous.cob > 0) { // calculate sum of min carb impact from all active treatments double totalMinCarbsImpact = 0d; - for (int ii = 0; ii < autosensData.activeCarbsList.size(); ++ii) { - AutosensData.CarbsInPast c = autosensData.activeCarbsList.get(ii); - totalMinCarbsImpact += c.min5minCarbImpact; + if (SensitivityAAPSPlugin.getPlugin().isEnabled(PluginType.SENSITIVITY) || SensitivityWeightedAveragePlugin.getPlugin().isEnabled(PluginType.SENSITIVITY)) { + //when the impact depends on a max time, sum them up as smaller carb sizes make them smaller + for (int ii = 0; ii < autosensData.activeCarbsList.size(); ++ii) { + AutosensData.CarbsInPast c = autosensData.activeCarbsList.get(ii); + totalMinCarbsImpact += c.min5minCarbImpact; + } + } else { + //Oref sensitivity + totalMinCarbsImpact = SP.getDouble(R.string.key_openapsama_min_5m_carbimpact, SMBDefaults.min_5m_carbimpact); } // figure out how many carbs that represents // but always assume at least 3mg/dL/5m (default) absorption per active treatment double ci = Math.max(deviation, totalMinCarbsImpact); + if (ci != deviation) + autosensData.failoverToMinAbsorbtionRate = true; autosensData.absorbed = ci * profile.getIc(bgTime) / sens; // and add that to the running total carbsAbsorbed autosensData.cob = Math.max(previous.cob - autosensData.absorbed, 0d); autosensData.substractAbosorbedCarbs(); + autosensData.usedMinCarbsImpact = totalMinCarbsImpact; } autosensData.removeOldCarbs(bgTime); autosensData.cob += autosensData.carbsFromBolus; @@ -254,6 +272,7 @@ public class IobCobThread extends Thread { log.debug("Finishing calculation thread: " + from); } finally { mWakeLock.release(); + MainApp.bus().post(new EventIobCalculationProgress("")); } } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/IobCobCalculator/events/EventIobCalculationProgress.java b/app/src/main/java/info/nightscout/androidaps/plugins/IobCobCalculator/events/EventIobCalculationProgress.java new file mode 100644 index 0000000000..08f2747e60 --- /dev/null +++ b/app/src/main/java/info/nightscout/androidaps/plugins/IobCobCalculator/events/EventIobCalculationProgress.java @@ -0,0 +1,11 @@ +package info.nightscout.androidaps.plugins.IobCobCalculator.events; + +import info.nightscout.androidaps.events.Event; + +public class EventIobCalculationProgress extends Event { + public String progress; + + public EventIobCalculationProgress(String progress) { + this.progress = progress; + } +} diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/NSClientPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/NSClientPlugin.java index aad81a29ef..004c7646f5 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/NSClientPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/NSClientPlugin.java @@ -24,6 +24,8 @@ import info.nightscout.androidaps.Constants; import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.R; import info.nightscout.androidaps.events.EventAppExit; +import info.nightscout.androidaps.events.EventNetworkChange; +import info.nightscout.androidaps.events.EventPreferenceChange; import info.nightscout.androidaps.interfaces.PluginBase; import info.nightscout.androidaps.interfaces.PluginDescription; import info.nightscout.androidaps.interfaces.PluginType; @@ -31,6 +33,7 @@ import info.nightscout.androidaps.plugins.NSClientInternal.events.EventNSClientN import info.nightscout.androidaps.plugins.NSClientInternal.events.EventNSClientStatus; import info.nightscout.androidaps.plugins.NSClientInternal.events.EventNSClientUpdateGUI; import info.nightscout.androidaps.plugins.NSClientInternal.services.NSClientService; +import info.nightscout.androidaps.receivers.NetworkChangeReceiver; import info.nightscout.utils.SP; import info.nightscout.utils.ToastUtils; @@ -52,13 +55,14 @@ public class NSClientPlugin extends PluginBase { Spanned textLog = Html.fromHtml(""); public boolean paused = false; + public boolean allowed = true; boolean autoscroll = true; public String status = ""; public NSClientService nsClientService = null; - public NSClientPlugin() { + private NSClientPlugin() { super(new PluginDescription() .mainType(PluginType.GENERAL) .fragmentClass(NSClientFragment.class.getName()) @@ -87,6 +91,10 @@ public class NSClientPlugin extends PluginBase { Intent intent = new Intent(context, NSClientService.class); context.bindService(intent, mConnection, Context.BIND_AUTO_CREATE); super.onStart(); + + EventNetworkChange event = NetworkChangeReceiver.grabNetworkStatus(); + if (event != null) + MainApp.bus().post(event); } @Override @@ -111,9 +119,39 @@ public class NSClientPlugin extends PluginBase { } }; - @SuppressWarnings("UnusedParameters") @Subscribe - public void onStatusEvent(final EventAppExit e) { + public void onStatusEvent(EventPreferenceChange ev) { + if (ev.isChanged(R.string.key_ns_wifionly) || + ev.isChanged(R.string.key_ns_wifi_ssids) || + ev.isChanged(R.string.key_ns_allowroaming) + ) { + EventNetworkChange event = NetworkChangeReceiver.grabNetworkStatus(); + if (event != null) + MainApp.bus().post(event); + } + } + + @Subscribe + public void onStatusEvent(final EventNetworkChange ev) { + boolean wifiOnly = SP.getBoolean(R.string.key_ns_wifionly, false); + String allowedSSIDs = SP.getString(R.string.key_ns_wifi_ssids, ""); + boolean allowRoaming = SP.getBoolean(R.string.key_ns_allowroaming, true); + + boolean newAllowedState = true; + + if (!ev.wifiConnected && wifiOnly) newAllowedState = false; + if (ev.wifiConnected && !allowedSSIDs.isEmpty() && !allowedSSIDs.contains(ev.ssid)) + newAllowedState = false; + if (!allowRoaming && ev.roaming) newAllowedState = false; + + if (newAllowedState != allowed) { + allowed = newAllowedState; + MainApp.bus().post(new EventPreferenceChange(R.string.key_nsclientinternal_paused)); + } + } + + @Subscribe + public void onStatusEvent(final EventAppExit ignored) { if (nsClientService != null) MainApp.instance().getApplicationContext().unbindService(mConnection); } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/services/NSClientService.java b/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/services/NSClientService.java index 1d9d832837..445bef32fe 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/services/NSClientService.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/NSClientInternal/services/NSClientService.java @@ -203,7 +203,10 @@ public class NSClientService extends Service { nsAPIhashCode = Hashing.sha1().hashString(nsAPISecret, Charsets.UTF_8).toString(); MainApp.bus().post(new EventNSClientStatus("Initializing")); - if (MainApp.getSpecificPlugin(NSClientPlugin.class).paused) { + if (!MainApp.getSpecificPlugin(NSClientPlugin.class).allowed) { + MainApp.bus().post(new EventNSClientNewLog("NSCLIENT", "not allowed")); + MainApp.bus().post(new EventNSClientStatus("Not allowed")); + } else if (MainApp.getSpecificPlugin(NSClientPlugin.class).paused) { MainApp.bus().post(new EventNSClientNewLog("NSCLIENT", "paused")); MainApp.bus().post(new EventNSClientStatus("Paused")); } else if (!nsEnabled) { @@ -652,7 +655,7 @@ public class NSClientService extends Service { } //MainApp.bus().post(new EventNSClientNewLog("NSCLIENT", "onDataUpdate end"); } finally { - if (wakeLock.isHeld()) wakeLock.release(); + if (wakeLock.isHeld()) wakeLock.release(); } } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSAMA/DetermineBasalAdapterAMAJS.java b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSAMA/DetermineBasalAdapterAMAJS.java index 96e004d996..ed0fa1f0bb 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSAMA/DetermineBasalAdapterAMAJS.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSAMA/DetermineBasalAdapterAMAJS.java @@ -213,8 +213,12 @@ public class DetermineBasalAdapterAMAJS { mProfile.put("current_basal", basalrate); mProfile.put("temptargetSet", tempTargetSet); mProfile.put("autosens_adjust_targets", SP.getBoolean("openapsama_autosens_adjusttargets", true)); - //TODO: align with max-absorption model in AMA sensitivity - mProfile.put("min_5m_carbimpact", SP.getDouble("openapsama_min_5m_carbimpact", SMBDefaults.min_5m_carbimpact)); + //align with max-absorption model in AMA sensitivity + if(mealData.usedMinCarbsImpact > 0){ + mProfile.put("min_5m_carbimpact", mealData.usedMinCarbsImpact); + } else { + mProfile.put("min_5m_carbimpact", SP.getDouble(R.string.key_openapsama_min_5m_carbimpact, SMBDefaults.min_5m_carbimpact)); + } if (units.equals(Constants.MMOL)) { mProfile.put("out_units", "mmol/L"); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSSMB/DetermineBasalAdapterSMBJS.java b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSSMB/DetermineBasalAdapterSMBJS.java index 89bf8431f4..0c665c7f9f 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSSMB/DetermineBasalAdapterSMBJS.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSSMB/DetermineBasalAdapterSMBJS.java @@ -243,9 +243,12 @@ public class DetermineBasalAdapterSMBJS { mProfile.put("half_basal_exercise_target", SMBDefaults.half_basal_exercise_target); mProfile.put("maxCOB", SMBDefaults.maxCOB); mProfile.put("skip_neutral_temps", SMBDefaults.skip_neutral_temps); - //TODO: align with max-absorption model in AMA sensitivity - mProfile.put("min_5m_carbimpact", SP.getDouble("openapsama_min_5m_carbimpact", SMBDefaults.min_5m_carbimpact)); - ; + //align with max-absorption model in AMA sensitivity + if(mealData.usedMinCarbsImpact > 0){ + mProfile.put("min_5m_carbimpact", mealData.usedMinCarbsImpact); + } else { + mProfile.put("min_5m_carbimpact", SP.getDouble(R.string.key_openapsama_min_5m_carbimpact, SMBDefaults.min_5m_carbimpact)); + } mProfile.put("remainingCarbsCap", SMBDefaults.remainingCarbsCap); mProfile.put("enableUAM", SP.getBoolean(R.string.key_use_uam, false)); mProfile.put("A52_risk_enable", SMBDefaults.A52_risk_enable); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewCarbsDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewCarbsDialog.java index bd489971c2..d3e5986f77 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewCarbsDialog.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewCarbsDialog.java @@ -431,7 +431,7 @@ public class NewCarbsDialog extends DialogFragment implements OnClickListener, C carbInfo.context = getContext(); carbInfo.source = Source.USER; carbInfo.notes = notes; - if (ConfigBuilderPlugin.getActivePump().getPumpDescription().storesCarbInfo) { + if (ConfigBuilderPlugin.getActivePump().getPumpDescription().storesCarbInfo && carbInfo.date <= now()) { ConfigBuilderPlugin.getCommandQueue().bolus(carbInfo, new Callback() { @Override public void run() { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewTreatmentDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewTreatmentDialog.java index f21ccac0e2..a315310dc8 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewTreatmentDialog.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewTreatmentDialog.java @@ -35,6 +35,7 @@ import info.nightscout.androidaps.interfaces.Constraint; import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin; import info.nightscout.androidaps.plugins.Treatments.TreatmentsPlugin; import info.nightscout.androidaps.queue.Callback; +import info.nightscout.utils.DecimalFormatter; import info.nightscout.utils.FabricPrivacy; import info.nightscout.utils.NumberPicker; import info.nightscout.utils.SafeParse; @@ -104,7 +105,7 @@ public class NewTreatmentDialog extends DialogFragment implements OnClickListene editInsulin = (NumberPicker) view.findViewById(R.id.treatments_newtreatment_insulinamount); editCarbs.setParams(0d, 0d, (double) maxCarbs, 1d, new DecimalFormat("0"), false, textWatcher); - editInsulin.setParams(0d, 0d, maxInsulin, ConfigBuilderPlugin.getActivePump().getPumpDescription().bolusStep, new DecimalFormat("0.00"), false, textWatcher); + editInsulin.setParams(0d, 0d, maxInsulin, ConfigBuilderPlugin.getActivePump().getPumpDescription().bolusStep, DecimalFormatter.pumpSupportedBolusFormat(), false, textWatcher); recordOnlyCheckbox = (CheckBox) view.findViewById(R.id.newtreatment_record_only); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java index b22d0450e0..8f00c18d75 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java @@ -5,7 +5,6 @@ import android.app.Activity; import android.app.NotificationManager; import android.content.ActivityNotFoundException; import android.content.Context; -import android.content.DialogInterface; import android.content.Intent; import android.content.pm.PackageManager; import android.graphics.Color; @@ -15,10 +14,8 @@ import android.os.Handler; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentManager; -import android.support.v4.content.ContextCompat; import android.support.v4.content.res.ResourcesCompat; import android.support.v7.app.AlertDialog; -import android.support.v7.widget.CardView; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.PopupMenu; import android.support.v7.widget.RecyclerView; @@ -33,7 +30,6 @@ import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; -import android.widget.Button; import android.widget.CheckBox; import android.widget.CompoundButton; import android.widget.ImageButton; @@ -52,8 +48,6 @@ import org.slf4j.LoggerFactory; import java.text.DecimalFormat; import java.util.Calendar; import java.util.Date; -import java.util.List; -import java.util.Objects; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledFuture; @@ -97,9 +91,9 @@ import info.nightscout.androidaps.plugins.ConstraintsObjectives.ObjectivesPlugin import info.nightscout.androidaps.plugins.IobCobCalculator.AutosensData; import info.nightscout.androidaps.plugins.IobCobCalculator.IobCobCalculatorPlugin; import info.nightscout.androidaps.plugins.IobCobCalculator.events.EventAutosensCalculationFinished; +import info.nightscout.androidaps.plugins.IobCobCalculator.events.EventIobCalculationProgress; import info.nightscout.androidaps.plugins.Loop.LoopPlugin; import info.nightscout.androidaps.plugins.Loop.events.EventNewOpenLoopNotification; -import info.nightscout.androidaps.plugins.NSClientInternal.broadcasts.BroadcastAckAlarm; import info.nightscout.androidaps.plugins.NSClientInternal.data.NSDeviceStatus; import info.nightscout.androidaps.plugins.Overview.Dialogs.CalibrationDialog; import info.nightscout.androidaps.plugins.Overview.Dialogs.ErrorHelperActivity; @@ -108,10 +102,8 @@ import info.nightscout.androidaps.plugins.Overview.Dialogs.NewInsulinDialog; import info.nightscout.androidaps.plugins.Overview.Dialogs.NewTreatmentDialog; import info.nightscout.androidaps.plugins.Overview.Dialogs.WizardDialog; import info.nightscout.androidaps.plugins.Overview.activities.QuickWizardListActivity; -import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification; import info.nightscout.androidaps.plugins.Overview.events.EventSetWakeLock; import info.nightscout.androidaps.plugins.Overview.graphData.GraphData; -import info.nightscout.androidaps.plugins.Overview.notifications.Notification; import info.nightscout.androidaps.plugins.Overview.notifications.NotificationRecyclerViewAdapter; import info.nightscout.androidaps.plugins.Overview.notifications.NotificationStore; import info.nightscout.androidaps.plugins.Source.SourceDexcomG5Plugin; @@ -150,6 +142,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener, TextView pumpDeviceStatusView; TextView openapsDeviceStatusView; TextView uploaderDeviceStatusView; + TextView iobCalculationProgressView; LinearLayout loopStatusLayout; LinearLayout pumpStatusLayout; GraphView bgGraph; @@ -191,9 +184,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener, final Object updateSync = new Object(); - public enum CHARTTYPE {PRE, BAS, IOB, COB, DEV, SEN} - - ; + public enum CHARTTYPE {PRE, BAS, IOB, COB, DEV, SEN, DEVSLOPE} private static final ScheduledExecutorService worker = Executors.newSingleThreadScheduledExecutor(); private static ScheduledFuture scheduledUpdate = null; @@ -245,6 +236,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener, pumpDeviceStatusView = (TextView) view.findViewById(R.id.overview_pump); openapsDeviceStatusView = (TextView) view.findViewById(R.id.overview_openaps); uploaderDeviceStatusView = (TextView) view.findViewById(R.id.overview_uploader); + iobCalculationProgressView = (TextView) view.findViewById(R.id.overview_iobcalculationprogess); loopStatusLayout = (LinearLayout) view.findViewById(R.id.overview_looplayout); pumpStatusLayout = (LinearLayout) view.findViewById(R.id.overview_pumpstatuslayout); @@ -416,26 +408,33 @@ public class OverviewFragment extends Fragment implements View.OnClickListener, item.setCheckable(true); item.setChecked(SP.getBoolean("showratios", false)); + if (MainApp.devBranch) { + item = popup.getMenu().add(Menu.NONE, CHARTTYPE.DEVSLOPE.ordinal(), Menu.NONE, "Deviation slope"); + title = item.getTitle(); + s = new SpannableString(title); + s.setSpan(new ForegroundColorSpan(ResourcesCompat.getColor(getResources(), R.color.devslopepos, null)), 0, s.length(), 0); + item.setTitle(s); + item.setCheckable(true); + item.setChecked(SP.getBoolean("showdevslope", false)); + } + popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem item) { if (item.getItemId() == CHARTTYPE.PRE.ordinal()) { SP.putBoolean("showprediction", !item.isChecked()); - } else if (item.getItemId() == CHARTTYPE.BAS.ordinal()) { SP.putBoolean("showbasals", !item.isChecked()); - } else if (item.getItemId() == CHARTTYPE.IOB.ordinal()) { SP.putBoolean("showiob", !item.isChecked()); - } else if (item.getItemId() == CHARTTYPE.COB.ordinal()) { SP.putBoolean("showcob", !item.isChecked()); - } else if (item.getItemId() == CHARTTYPE.DEV.ordinal()) { SP.putBoolean("showdeviations", !item.isChecked()); - } else if (item.getItemId() == CHARTTYPE.SEN.ordinal()) { SP.putBoolean("showratios", !item.isChecked()); + } else if (item.getItemId() == CHARTTYPE.DEVSLOPE.ordinal()) { + SP.putBoolean("showdevslope", !item.isChecked()); } scheduleUpdateGUI("onGraphCheckboxesCheckedChanged"); return true; @@ -911,15 +910,22 @@ public class OverviewFragment extends Fragment implements View.OnClickListener, activity.runOnUiThread(() -> updatePumpStatus(s.textStatus())); } + @Subscribe + public void onStatusEvent(final EventIobCalculationProgress e) { + Activity activity = getActivity(); + if (activity != null) + activity.runOnUiThread(() -> { + if (iobCalculationProgressView != null) + iobCalculationProgressView.setText(e.progress); + }); + } + private void hideTempRecommendation() { Activity activity = getActivity(); if (activity != null) - activity.runOnUiThread(new Runnable() { - @Override - public void run() { - if (acceptTempLayout != null) - acceptTempLayout.setVisibility(View.GONE); - } + activity.runOnUiThread(() -> { + if (acceptTempLayout != null) + acceptTempLayout.setVisibility(View.GONE); }); } @@ -1386,7 +1392,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener, useDevForScale = true; } else if (SP.getBoolean("showratios", false)) { useRatioForScale = true; - } else if (Config.displayDeviationSlope) { + } else if (SP.getBoolean("showdevslope", false)) { useDSForScale = true; } @@ -1398,7 +1404,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener, secondGraphData.addDeviations(fromTime, now, useDevForScale, 1d); if (SP.getBoolean("showratios", false)) secondGraphData.addRatio(fromTime, now, useRatioForScale, 1d); - if (Config.displayDeviationSlope) + if (SP.getBoolean("showdevslope", false)) secondGraphData.addDeviationSlope(fromTime, now, useDSForScale, 1d); // **** NOW line **** @@ -1410,7 +1416,11 @@ public class OverviewFragment extends Fragment implements View.OnClickListener, FragmentActivity activity = getActivity(); if (activity != null) { activity.runOnUiThread(() -> { - if (SP.getBoolean("showiob", true) || SP.getBoolean("showcob", true) || SP.getBoolean("showdeviations", false) || SP.getBoolean("showratios", false) || Config.displayDeviationSlope) { + if (SP.getBoolean("showiob", true) + || SP.getBoolean("showcob", true) + || SP.getBoolean("showdeviations", false) + || SP.getBoolean("showratios", false) + || SP.getBoolean("showdevslope", false)) { iobGraph.setVisibility(View.VISIBLE); } else { iobGraph.setVisibility(View.GONE); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/graphData/GraphData.java b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/graphData/GraphData.java index 9921d236a1..1bf59db4de 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/graphData/GraphData.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/graphData/GraphData.java @@ -108,7 +108,7 @@ public class GraphData { inRangeAreaSeries = new AreaGraphSeries<>(inRangeAreaDataPoints); inRangeAreaSeries.setColor(0); inRangeAreaSeries.setDrawBackground(true); - inRangeAreaSeries.setBackgroundColor(MainApp.sResources.getColor(R.color.inrangebackground)); + inRangeAreaSeries.setBackgroundColor(MainApp.gc(R.color.inrangebackground)); addSeries(inRangeAreaSeries); } @@ -184,14 +184,14 @@ public class GraphData { baseBasal = baseBasalArray.toArray(baseBasal); baseBasalsSeries = new LineGraphSeries<>(baseBasal); baseBasalsSeries.setDrawBackground(true); - baseBasalsSeries.setBackgroundColor(MainApp.sResources.getColor(R.color.basebasal)); + baseBasalsSeries.setBackgroundColor(MainApp.gc(R.color.basebasal)); baseBasalsSeries.setThickness(0); ScaledDataPoint[] tempBasal = new ScaledDataPoint[tempBasalArray.size()]; tempBasal = tempBasalArray.toArray(tempBasal); tempBasalsSeries = new LineGraphSeries<>(tempBasal); tempBasalsSeries.setDrawBackground(true); - tempBasalsSeries.setBackgroundColor(MainApp.sResources.getColor(R.color.tempbasal)); + tempBasalsSeries.setBackgroundColor(MainApp.gc(R.color.tempbasal)); tempBasalsSeries.setThickness(0); ScaledDataPoint[] basalLine = new ScaledDataPoint[basalLineArray.size()]; @@ -201,7 +201,7 @@ public class GraphData { paint.setStyle(Paint.Style.STROKE); paint.setStrokeWidth(MainApp.instance().getApplicationContext().getResources().getDisplayMetrics().scaledDensity * 2); paint.setPathEffect(new DashPathEffect(new float[]{2, 4}, 0)); - paint.setColor(MainApp.sResources.getColor(R.color.basal)); + paint.setColor(MainApp.gc(R.color.basal)); basalsLineSeries.setCustomPaint(paint); ScaledDataPoint[] absoluteBasalLine = new ScaledDataPoint[absoluteBasalLineArray.size()]; @@ -210,7 +210,7 @@ public class GraphData { Paint absolutePaint = new Paint(); absolutePaint.setStyle(Paint.Style.STROKE); absolutePaint.setStrokeWidth(MainApp.instance().getApplicationContext().getResources().getDisplayMetrics().scaledDensity * 2); - absolutePaint.setColor(MainApp.sResources.getColor(R.color.basal)); + absolutePaint.setColor(MainApp.gc(R.color.basal)); absoluteBasalsLineSeries.setCustomPaint(absolutePaint); basalScale.setMultiplier(maxY * scale / maxBasalValueFound); @@ -259,7 +259,7 @@ public class GraphData { targets = targetsSeriesArray.toArray(targets); targetsSeries = new LineGraphSeries<>(targets); targetsSeries.setDrawBackground(false); - targetsSeries.setColor(MainApp.sResources.getColor(R.color.tempTargetBackground)); + targetsSeries.setColor(MainApp.gc(R.color.tempTargetBackground)); targetsSeries.setThickness(2); addSeries(targetsSeries); @@ -351,8 +351,8 @@ public class GraphData { iobData = iobArray.toArray(iobData); iobSeries = new FixedLineGraphSeries<>(iobData); iobSeries.setDrawBackground(true); - iobSeries.setBackgroundColor(0x80FFFFFF & MainApp.sResources.getColor(R.color.iob)); //50% - iobSeries.setColor(MainApp.sResources.getColor(R.color.iob)); + iobSeries.setBackgroundColor(0x80FFFFFF & MainApp.gc(R.color.iob)); //50% + iobSeries.setColor(MainApp.gc(R.color.iob)); iobSeries.setThickness(3); if (useForScale) @@ -365,6 +365,7 @@ public class GraphData { // scale in % of vertical size (like 0.3) public void addCob(long fromTime, long toTime, boolean useForScale, double scale) { + List minFailoverActiveList = new ArrayList<>(); FixedLineGraphSeries cobSeries; List cobArray = new ArrayList<>(); Double maxCobValueFound = 0d; @@ -382,6 +383,10 @@ public class GraphData { maxCobValueFound = Math.max(maxCobValueFound, cob); lastCob = cob; } + if (autosensData.failoverToMinAbsorbtionRate) { + autosensData.setScale(cobScale); + minFailoverActiveList.add(autosensData); + } } } @@ -390,8 +395,8 @@ public class GraphData { cobData = cobArray.toArray(cobData); cobSeries = new FixedLineGraphSeries<>(cobData); cobSeries.setDrawBackground(true); - cobSeries.setBackgroundColor(0xB0FFFFFF & MainApp.sResources.getColor(R.color.cob)); //50% - cobSeries.setColor(MainApp.sResources.getColor(R.color.cob)); + cobSeries.setBackgroundColor(0xB0FFFFFF & MainApp.gc(R.color.cob)); //50% + cobSeries.setColor(MainApp.gc(R.color.cob)); cobSeries.setThickness(3); if (useForScale) @@ -400,6 +405,10 @@ public class GraphData { cobScale.setMultiplier(maxY * scale / maxCobValueFound); addSeries(cobSeries); + + DataPointWithLabelInterface[] minFailover = new DataPointWithLabelInterface[minFailoverActiveList.size()]; + minFailover = minFailoverActiveList.toArray(minFailover); + addSeries(new PointsWithLabelGraphSeries<>(minFailover)); } // scale in % of vertical size (like 0.3) @@ -468,7 +477,7 @@ public class GraphData { ScaledDataPoint[] ratioData = new ScaledDataPoint[ratioArray.size()]; ratioData = ratioArray.toArray(ratioData); ratioSeries = new LineGraphSeries<>(ratioData); - ratioSeries.setColor(MainApp.sResources.getColor(R.color.ratio)); + ratioSeries.setColor(MainApp.gc(R.color.ratio)); ratioSeries.setThickness(3); if (useForScale) @@ -504,13 +513,13 @@ public class GraphData { ScaledDataPoint[] ratioMaxData = new ScaledDataPoint[dsMaxArray.size()]; ratioMaxData = dsMaxArray.toArray(ratioMaxData); dsMaxSeries = new LineGraphSeries<>(ratioMaxData); - dsMaxSeries.setColor(Color.MAGENTA); + dsMaxSeries.setColor(MainApp.gc(R.color.devslopepos)); dsMaxSeries.setThickness(3); ScaledDataPoint[] ratioMinData = new ScaledDataPoint[dsMinArray.size()]; ratioMinData = dsMinArray.toArray(ratioMinData); dsMinSeries = new LineGraphSeries<>(ratioMinData); - dsMinSeries.setColor(Color.YELLOW); + dsMinSeries.setColor(MainApp.gc(R.color.devslopeneg)); dsMinSeries.setThickness(3); if (useForScale) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/graphExtensions/PointsWithLabelGraphSeries.java b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/graphExtensions/PointsWithLabelGraphSeries.java index 9c8e312fb6..8ac3be0ad8 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/graphExtensions/PointsWithLabelGraphSeries.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/graphExtensions/PointsWithLabelGraphSeries.java @@ -3,42 +3,46 @@ package info.nightscout.androidaps.plugins.Overview.graphExtensions; /** * GraphView * Copyright (C) 2014 Jonas Gehring - * + *

* This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, * with the "Linking Exception", which can be found at the license.txt * file in this program. - * + *

* This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + *

* You should have received a copy of the GNU General Public License * with the "Linking Exception" along with this program; if not, * write to the author Jonas Gehring . + *

+ * Added by mike */ /** * Added by mike */ +import android.content.Context; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.Path; import android.graphics.Point; import android.graphics.Rect; import android.graphics.Typeface; -import android.util.TypedValue; -// Added by Rumen for scalable text -import android.content.Context; -import info.nightscout.androidaps.MainApp; + import com.jjoe64.graphview.GraphView; import com.jjoe64.graphview.series.BaseSeries; import java.util.Iterator; +import info.nightscout.androidaps.MainApp; + +// Added by Rumen for scalable text + /** * Series that plots the data as points. * The points can be different shapes or a @@ -74,7 +78,8 @@ public class PointsWithLabelGraphSeries e OPENAPSOFFLINE, EXERCISE, GENERAL, - GENERALWITHDURATION + GENERALWITHDURATION, + COBFAILOVER } /** @@ -148,7 +153,7 @@ public class PointsWithLabelGraphSeries e float scaleX = (float) (graphWidth / diffX); - int i=0; + int i = 0; while (values.hasNext()) { E value = values.next(); @@ -182,7 +187,7 @@ public class PointsWithLabelGraphSeries e } /* Fix a bug that continue to show the DOT after Y axis */ - if(x < 0) { + if (x < 0) { overdraw = true; } @@ -197,10 +202,10 @@ public class PointsWithLabelGraphSeries e // draw data point if (!overdraw) { - if (value.getShape() == Shape.BG) { + if (value.getShape() == Shape.BG || value.getShape() == Shape.COBFAILOVER) { mPaint.setStyle(Paint.Style.FILL); mPaint.setStrokeWidth(0); - canvas.drawCircle(endX, endY, scaledPxSize, mPaint); + canvas.drawCircle(endX, endY, value.getSize() * scaledPxSize, mPaint); } else if (value.getShape() == Shape.PREDICTION) { mPaint.setColor(value.getColor()); mPaint.setStyle(Paint.Style.FILL); @@ -211,20 +216,20 @@ public class PointsWithLabelGraphSeries e mPaint.setStrokeWidth(0); canvas.drawCircle(endX, endY, scaledPxSize / 3, mPaint); } else if (value.getShape() == Shape.RECTANGLE) { - canvas.drawRect(endX-scaledPxSize, endY-scaledPxSize, endX+scaledPxSize, endY+scaledPxSize, mPaint); + canvas.drawRect(endX - scaledPxSize, endY - scaledPxSize, endX + scaledPxSize, endY + scaledPxSize, mPaint); } else if (value.getShape() == Shape.TRIANGLE) { mPaint.setStrokeWidth(0); Point[] points = new Point[3]; - points[0] = new Point((int)endX, (int)(endY-scaledPxSize)); - points[1] = new Point((int)(endX+scaledPxSize), (int)(endY+scaledPxSize*0.67)); - points[2] = new Point((int)(endX-scaledPxSize), (int)(endY+scaledPxSize*0.67)); + points[0] = new Point((int) endX, (int) (endY - scaledPxSize)); + points[1] = new Point((int) (endX + scaledPxSize), (int) (endY + scaledPxSize * 0.67)); + points[2] = new Point((int) (endX - scaledPxSize), (int) (endY + scaledPxSize * 0.67)); drawArrows(points, canvas, mPaint); } else if (value.getShape() == Shape.BOLUS) { mPaint.setStrokeWidth(0); Point[] points = new Point[3]; - points[0] = new Point((int)endX, (int)(endY-scaledPxSize)); - points[1] = new Point((int)(endX+scaledPxSize), (int)(endY+scaledPxSize*0.67)); - points[2] = new Point((int)(endX-scaledPxSize), (int)(endY+scaledPxSize*0.67)); + points[0] = new Point((int) endX, (int) (endY - scaledPxSize)); + points[1] = new Point((int) (endX + scaledPxSize), (int) (endY + scaledPxSize * 0.67)); + points[2] = new Point((int) (endX - scaledPxSize), (int) (endY + scaledPxSize * 0.67)); mPaint.setStyle(Paint.Style.FILL_AND_STROKE); drawArrows(points, canvas, mPaint); if (value.getLabel() != null) { @@ -234,15 +239,15 @@ public class PointsWithLabelGraphSeries e mPaint.setStrokeWidth(2); Point[] points = new Point[3]; float size = value.getSize() * scaledPxSize; - points[0] = new Point((int)endX, (int)(endY-size)); - points[1] = new Point((int)(endX+size), (int)(endY+size*0.67)); - points[2] = new Point((int)(endX-size), (int)(endY+size*0.67)); + points[0] = new Point((int) endX, (int) (endY - size)); + points[1] = new Point((int) (endX + size), (int) (endY + size * 0.67)); + points[2] = new Point((int) (endX - size), (int) (endY + size * 0.67)); mPaint.setStyle(Paint.Style.FILL_AND_STROKE); drawArrows(points, canvas, mPaint); } else if (value.getShape() == Shape.EXTENDEDBOLUS) { mPaint.setStrokeWidth(0); if (value.getLabel() != null) { - Rect bounds = new Rect((int)endX, (int)endY + 3, (int) (xpluslength), (int) endY + 8); + Rect bounds = new Rect((int) endX, (int) endY + 3, (int) (xpluslength), (int) endY + 8); mPaint.setStyle(Paint.Style.FILL_AND_STROKE); canvas.drawRect(bounds, mPaint); mPaint.setTextSize((float) (scaledTextSize)); @@ -254,7 +259,7 @@ public class PointsWithLabelGraphSeries e mPaint.setStrokeWidth(0); if (value.getLabel() != null) { //mPaint.setTextSize((int) (scaledPxSize * 3)); - mPaint.setTextSize((float) (scaledTextSize*1.2)); + mPaint.setTextSize((float) (scaledTextSize * 1.2)); mPaint.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.BOLD)); Rect bounds = new Rect(); mPaint.getTextBounds(value.getLabel(), 0, value.getLabel().length(), bounds); @@ -355,7 +360,7 @@ public class PointsWithLabelGraphSeries e * @param paint paint object */ private void drawArrows(Point[] point, Canvas canvas, Paint paint) { - float [] points = new float[8]; + float[] points = new float[8]; points[0] = point[0].x; points[1] = point[0].y; points[2] = point[1].x; @@ -368,10 +373,10 @@ public class PointsWithLabelGraphSeries e canvas.save(); canvas.drawVertices(Canvas.VertexMode.TRIANGLES, 8, points, 0, null, 0, null, 0, null, 0, 0, paint); Path path = new Path(); - path.moveTo(point[0].x , point[0].y); - path.lineTo(point[1].x,point[1].y); - path.lineTo(point[2].x,point[2].y); - canvas.drawPath(path,paint); + path.moveTo(point[0].x, point[0].y); + path.lineTo(point[1].x, point[1].y); + path.lineTo(point[2].x, point[2].y); + canvas.drawPath(path, paint); canvas.restore(); } @@ -381,7 +386,7 @@ public class PointsWithLabelGraphSeries e float py = endY + scaledPxSize; canvas.save(); canvas.rotate(-45, px, py); - mPaint.setTextSize((float) (scaledTextSize*0.8)); + mPaint.setTextSize((float) (scaledTextSize * 0.8)); mPaint.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.NORMAL)); mPaint.setFakeBoldText(true); mPaint.setTextAlign(Paint.Align.RIGHT); @@ -393,7 +398,7 @@ public class PointsWithLabelGraphSeries e float py = endY - scaledPxSize; canvas.save(); canvas.rotate(-45, px, py); - mPaint.setTextSize((float) (scaledTextSize*0.8)); + mPaint.setTextSize((float) (scaledTextSize * 0.8)); mPaint.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.NORMAL)); mPaint.setFakeBoldText(true); canvas.drawText(value.getLabel(), px + scaledPxSize, py, mPaint); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/AbstractDanaRPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/AbstractDanaRPlugin.java index fc57e72e01..ea83e6d4d6 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/AbstractDanaRPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/AbstractDanaRPlugin.java @@ -304,7 +304,11 @@ public abstract class AbstractDanaRPlugin extends PluginBase implements PumpInte @Override public void getPumpStatus() { - if (sExecutionService != null) sExecutionService.getPumpStatus(); + if (sExecutionService != null) { + sExecutionService.getPumpStatus(); + pumpDescription.basalStep = pump.basalStep; + pumpDescription.bolusStep = pump.bolusStep; + } } @Override 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 cbcf21cd48..280d37c273 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 @@ -18,6 +18,7 @@ import info.nightscout.androidaps.data.Profile; import info.nightscout.androidaps.data.PumpEnactResult; import info.nightscout.androidaps.db.ExtendedBolus; import info.nightscout.androidaps.db.TemporaryBasal; +import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgBolusStartWithSpeed; import info.nightscout.androidaps.plugins.Treatments.Treatment; import info.nightscout.androidaps.events.EventAppExit; import info.nightscout.androidaps.events.EventPreferenceChange; @@ -129,7 +130,7 @@ public class DanaRPlugin extends AbstractDanaRPlugin { // Plugin base interface @Override public String getName() { - return MainApp.instance().getString(R.string.danarpump); + return MainApp.gs(R.string.danarpump); } @Override @@ -158,10 +159,13 @@ public class DanaRPlugin extends AbstractDanaRPlugin { if (detailedBolusInfo.insulin > 0 || detailedBolusInfo.carbs > 0) connectionOK = sExecutionService.bolus(detailedBolusInfo.insulin, (int) detailedBolusInfo.carbs, detailedBolusInfo.carbTime, t); PumpEnactResult result = new PumpEnactResult(); - result.success = connectionOK; + result.success = connectionOK && detailedBolusInfo.insulin == t.insulin; result.bolusDelivered = t.insulin; result.carbsDelivered = detailedBolusInfo.carbs; - result.comment = MainApp.instance().getString(R.string.virtualpump_resultok); + if (!result.success) + result.comment = String.format(MainApp.gs(R.string.boluserrorcode), detailedBolusInfo.insulin, t.insulin, MsgBolusStartWithSpeed.errorCode); + else + result.comment = MainApp.gs(R.string.virtualpump_resultok); if (Config.logPumpActions) log.debug("deliverTreatment: OK. Asked: " + detailedBolusInfo.insulin + " Delivered: " + result.bolusDelivered); detailedBolusInfo.insulin = t.insulin; @@ -173,7 +177,7 @@ public class DanaRPlugin extends AbstractDanaRPlugin { result.success = false; result.bolusDelivered = 0d; result.carbsDelivered = 0d; - result.comment = MainApp.instance().getString(R.string.danar_invalidinput); + result.comment = MainApp.gs(R.string.danar_invalidinput); log.error("deliverTreatment: Invalid input"); return result; } @@ -342,7 +346,7 @@ public class DanaRPlugin extends AbstractDanaRPlugin { PumpEnactResult result = new PumpEnactResult(); result.success = true; result.enacted = false; - result.comment = MainApp.instance().getString(R.string.virtualpump_resultok); + result.comment = MainApp.gs(R.string.virtualpump_resultok); result.isTempCancel = true; return result; } @@ -358,13 +362,13 @@ public class DanaRPlugin extends AbstractDanaRPlugin { if (!pump.isTempBasalInProgress) { result.success = true; result.isTempCancel = true; - result.comment = MainApp.instance().getString(R.string.virtualpump_resultok); + result.comment = MainApp.gs(R.string.virtualpump_resultok); if (Config.logPumpActions) log.debug("cancelRealTempBasal: OK"); return result; } else { result.success = false; - result.comment = MainApp.instance().getString(R.string.danar_valuenotsetproperly); + result.comment = MainApp.gs(R.string.danar_valuenotsetproperly); result.isTempCancel = true; log.error("cancelRealTempBasal: Failed to cancel temp basal"); return result; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/comm/MsgBolusStart.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/comm/MsgBolusStart.java index 9173794199..7586edf825 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/comm/MsgBolusStart.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/comm/MsgBolusStart.java @@ -11,6 +11,8 @@ import info.nightscout.utils.HardLimits; public class MsgBolusStart extends MessageBase { private static Logger log = LoggerFactory.getLogger(MsgBolusStart.class); + public static int errorCode; + public MsgBolusStart() { SetCommand(0x0102); } @@ -29,13 +31,13 @@ public class MsgBolusStart extends MessageBase { @Override public void handleMessage(byte[] bytes) { - int result = intFromBuff(bytes, 0, 1); - if (result != 2) { + errorCode = intFromBuff(bytes, 0, 1); + if (errorCode != 2) { failed = true; - log.debug("Messsage response: " + result + " FAILED!!"); + log.debug("Messsage response: " + errorCode + " FAILED!!"); } else { if (Config.logDanaMessageDetail) - log.debug("Messsage response: " + result); + log.debug("Messsage response: " + errorCode + " OK"); } } } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/comm/MsgBolusStartWithSpeed.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/comm/MsgBolusStartWithSpeed.java index 3a33e9f866..dd4251a350 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/comm/MsgBolusStartWithSpeed.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/comm/MsgBolusStartWithSpeed.java @@ -11,6 +11,8 @@ import info.nightscout.utils.HardLimits; public class MsgBolusStartWithSpeed extends MessageBase { private static Logger log = LoggerFactory.getLogger(MsgBolusStartWithSpeed.class); + public static int errorCode; + public MsgBolusStartWithSpeed() { SetCommand(0x0104); } @@ -30,13 +32,13 @@ public class MsgBolusStartWithSpeed extends MessageBase { @Override public void handleMessage(byte[] bytes) { - int result = intFromBuff(bytes, 0, 1); - if (result != 2) { + errorCode = intFromBuff(bytes, 0, 1); + if (errorCode != 2) { failed = true; - log.debug("Messsage response: " + result + " FAILED!!"); + log.debug("Messsage response: " + errorCode + " FAILED!!"); } else { if (Config.logDanaMessageDetail) - log.debug("Messsage response: " + result); + log.debug("Messsage response: " + errorCode + " OK"); } } } 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 eabf4fc94a..bee8dd1662 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 @@ -339,7 +339,7 @@ public class DanaRExecutionService extends AbstractDanaRExecutionService{ } else { ConfigBuilderPlugin.getCommandQueue().readStatus("bolusOK", null); } - return true; + return !start.failed; } public boolean carbsEntry(int amount) { 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 a3a39a30f1..f2150ebb7d 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 @@ -18,14 +18,15 @@ import info.nightscout.androidaps.data.Profile; import info.nightscout.androidaps.data.PumpEnactResult; import info.nightscout.androidaps.db.ExtendedBolus; import info.nightscout.androidaps.db.TemporaryBasal; -import info.nightscout.androidaps.plugins.Treatments.Treatment; import info.nightscout.androidaps.events.EventAppExit; import info.nightscout.androidaps.events.EventPreferenceChange; import info.nightscout.androidaps.interfaces.Constraint; import info.nightscout.androidaps.interfaces.PluginType; import info.nightscout.androidaps.interfaces.PumpDescription; import info.nightscout.androidaps.plugins.PumpDanaR.AbstractDanaRPlugin; +import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgBolusStart; import info.nightscout.androidaps.plugins.PumpDanaRKorean.services.DanaRKoreanExecutionService; +import info.nightscout.androidaps.plugins.Treatments.Treatment; import info.nightscout.androidaps.plugins.Treatments.TreatmentsPlugin; import info.nightscout.utils.Round; import info.nightscout.utils.SP; @@ -130,7 +131,7 @@ public class DanaRKoreanPlugin extends AbstractDanaRPlugin { // Plugin base interface @Override public String getName() { - return MainApp.instance().getString(R.string.danarkoreanpump); + return MainApp.gs(R.string.danarkoreanpump); } @Override @@ -159,10 +160,13 @@ public class DanaRKoreanPlugin extends AbstractDanaRPlugin { if (detailedBolusInfo.insulin > 0 || detailedBolusInfo.carbs > 0) connectionOK = sExecutionService.bolus(detailedBolusInfo.insulin, (int) detailedBolusInfo.carbs, detailedBolusInfo.carbTime, t); PumpEnactResult result = new PumpEnactResult(); - result.success = connectionOK; + result.success = connectionOK && detailedBolusInfo.insulin == t.insulin; result.bolusDelivered = t.insulin; result.carbsDelivered = detailedBolusInfo.carbs; - result.comment = MainApp.instance().getString(R.string.virtualpump_resultok); + if (!result.success) + result.comment = String.format(MainApp.gs(R.string.boluserrorcode), detailedBolusInfo.insulin, t.insulin, MsgBolusStart.errorCode); + else + result.comment = MainApp.gs(R.string.virtualpump_resultok); if (Config.logPumpActions) log.debug("deliverTreatment: OK. Asked: " + detailedBolusInfo.insulin + " Delivered: " + result.bolusDelivered); detailedBolusInfo.insulin = t.insulin; @@ -174,7 +178,7 @@ public class DanaRKoreanPlugin extends AbstractDanaRPlugin { result.success = false; result.bolusDelivered = 0d; result.carbsDelivered = 0d; - result.comment = MainApp.instance().getString(R.string.danar_invalidinput); + result.comment = MainApp.gs(R.string.danar_invalidinput); log.error("deliverTreatment: Invalid input"); return result; } @@ -343,7 +347,7 @@ public class DanaRKoreanPlugin extends AbstractDanaRPlugin { PumpEnactResult result = new PumpEnactResult(); result.success = true; result.enacted = false; - result.comment = MainApp.instance().getString(R.string.virtualpump_resultok); + result.comment = MainApp.gs(R.string.virtualpump_resultok); result.isTempCancel = true; return result; } @@ -359,13 +363,13 @@ public class DanaRKoreanPlugin extends AbstractDanaRPlugin { if (!pump.isTempBasalInProgress) { result.success = true; result.isTempCancel = true; - result.comment = MainApp.instance().getString(R.string.virtualpump_resultok); + result.comment = MainApp.gs(R.string.virtualpump_resultok); if (Config.logPumpActions) log.debug("cancelRealTempBasal: OK"); return result; } else { result.success = false; - result.comment = MainApp.instance().getString(R.string.danar_valuenotsetproperly); + result.comment = MainApp.gs(R.string.danar_valuenotsetproperly); result.isTempCancel = true; log.error("cancelRealTempBasal: Failed to cancel temp basal"); return result; 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 c136666d5e..2619453df7 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 @@ -286,7 +286,7 @@ public class DanaRKoreanExecutionService extends AbstractDanaRExecutionService { mBolusingTreatment = null; ConfigBuilderPlugin.getCommandQueue().readStatus("bolusOK", null); - return true; + return !start.failed; } public boolean carbsEntry(int amount) { 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 7655c0ff46..a2ec13d184 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,6 +26,7 @@ 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; @@ -178,8 +179,6 @@ public class DanaRSPlugin extends PluginBase implements PumpInterface, DanaRInte final Object o = new Object(); danaRSService.connect(from, mDeviceAddress, o); - pumpDescription.basalStep = pump.basalStep; - pumpDescription.bolusStep = pump.bolusStep; } } @@ -205,8 +204,11 @@ public class DanaRSPlugin extends PluginBase implements PumpInterface, DanaRInte @Override public void getPumpStatus() { - if (danaRSService != null) + if (danaRSService != null) { danaRSService.getPumpStatus(); + pumpDescription.basalStep = pump.basalStep; + pumpDescription.bolusStep = pump.bolusStep; + } } // DanaR interface @@ -368,7 +370,7 @@ public class DanaRSPlugin extends PluginBase implements PumpInterface, DanaRInte } // RS stores end time for bolus, we need to adjust time // default delivery speed is 12 sec/U - detailedBolusInfo.date = DateUtil.now() + (long)(speed * detailedBolusInfo.insulin * 1000); + detailedBolusInfo.date = DateUtil.now() + (long) (speed * detailedBolusInfo.insulin * 1000); // clean carbs to prevent counting them as twice because they will picked up as another record // I don't think it's necessary to copy DetailedBolusInfo right now for carbs records double carbs = detailedBolusInfo.carbs; @@ -384,10 +386,13 @@ public class DanaRSPlugin extends PluginBase implements PumpInterface, DanaRInte if (detailedBolusInfo.insulin > 0 || carbs > 0) connectionOK = danaRSService.bolus(detailedBolusInfo.insulin, (int) carbs, DateUtil.now() + carbTime * 60 * 1000, t); PumpEnactResult result = new PumpEnactResult(); - result.success = connectionOK; + result.success = connectionOK && detailedBolusInfo.insulin == t.insulin; result.bolusDelivered = t.insulin; result.carbsDelivered = detailedBolusInfo.carbs; - result.comment = MainApp.instance().getString(R.string.virtualpump_resultok); + if (!result.success) + result.comment = String.format(MainApp.gs(R.string.boluserrorcode), detailedBolusInfo.insulin, t.insulin, DanaRS_Packet_Bolus_Set_Step_Bolus_Start.errorCode); + else + result.comment = MainApp.gs(R.string.virtualpump_resultok); if (Config.logPumpActions) log.debug("deliverTreatment: OK. Asked: " + detailedBolusInfo.insulin + " Delivered: " + result.bolusDelivered); return result; @@ -396,7 +401,7 @@ public class DanaRSPlugin extends PluginBase implements PumpInterface, DanaRInte result.success = false; result.bolusDelivered = 0d; result.carbsDelivered = 0d; - result.comment = MainApp.instance().getString(R.string.danar_invalidinput); + result.comment = MainApp.gs(R.string.danar_invalidinput); log.error("deliverTreatment: Invalid input"); return result; } @@ -500,7 +505,7 @@ public class DanaRSPlugin extends PluginBase implements PumpInterface, DanaRInte result.isTempCancel = false; result.enacted = false; result.success = false; - result.comment = MainApp.instance().getString(R.string.danar_invalidinput); + result.comment = MainApp.gs(R.string.danar_invalidinput); log.error("setTempBasalPercent: Invalid input"); return result; } @@ -512,7 +517,7 @@ public class DanaRSPlugin extends PluginBase implements PumpInterface, DanaRInte result.enacted = false; result.success = true; result.isTempCancel = false; - result.comment = MainApp.instance().getString(R.string.virtualpump_resultok); + result.comment = MainApp.gs(R.string.virtualpump_resultok); result.duration = pump.tempBasalRemainingMin; result.percent = pump.tempBasalPercent; result.isPercent = true; @@ -530,7 +535,7 @@ public class DanaRSPlugin extends PluginBase implements PumpInterface, DanaRInte if (connectionOK && pump.isTempBasalInProgress && pump.tempBasalPercent == percent) { result.enacted = true; result.success = true; - result.comment = MainApp.instance().getString(R.string.virtualpump_resultok); + result.comment = MainApp.gs(R.string.virtualpump_resultok); result.isTempCancel = false; result.duration = pump.tempBasalRemainingMin; result.percent = pump.tempBasalPercent; @@ -541,7 +546,7 @@ public class DanaRSPlugin extends PluginBase implements PumpInterface, DanaRInte } result.enacted = false; result.success = false; - result.comment = MainApp.instance().getString(R.string.tempbasaldeliveryerror); + result.comment = MainApp.gs(R.string.tempbasaldeliveryerror); log.error("setTempBasalPercent: Failed to set temp basal"); return result; } @@ -552,7 +557,7 @@ public class DanaRSPlugin extends PluginBase implements PumpInterface, DanaRInte if (connectionOK && pump.isTempBasalInProgress && pump.tempBasalPercent == percent) { result.enacted = true; result.success = true; - result.comment = MainApp.instance().getString(R.string.virtualpump_resultok); + result.comment = MainApp.gs(R.string.virtualpump_resultok); result.isTempCancel = false; result.duration = pump.tempBasalRemainingMin; result.percent = pump.tempBasalPercent; @@ -563,7 +568,7 @@ public class DanaRSPlugin extends PluginBase implements PumpInterface, DanaRInte } result.enacted = false; result.success = false; - result.comment = MainApp.instance().getString(R.string.danar_valuenotsetproperly); + result.comment = MainApp.gs(R.string.danar_valuenotsetproperly); log.error("setHighTempBasalPercent: Failed to set temp basal"); return result; } @@ -579,7 +584,7 @@ public class DanaRSPlugin extends PluginBase implements PumpInterface, DanaRInte if (runningEB != null && Math.abs(runningEB.insulin - insulin) < getPumpDescription().extendedBolusStep) { result.enacted = false; result.success = true; - result.comment = MainApp.instance().getString(R.string.virtualpump_resultok); + result.comment = MainApp.gs(R.string.virtualpump_resultok); result.duration = pump.extendedBolusRemainingMinutes; result.absolute = pump.extendedBolusAbsoluteRate; result.isPercent = false; @@ -592,7 +597,7 @@ public class DanaRSPlugin extends PluginBase implements PumpInterface, DanaRInte if (connectionOK && pump.isExtendedInProgress && Math.abs(pump.extendedBolusAbsoluteRate - insulin) < getPumpDescription().extendedBolusStep) { result.enacted = true; result.success = true; - result.comment = MainApp.instance().getString(R.string.virtualpump_resultok); + result.comment = MainApp.gs(R.string.virtualpump_resultok); result.isTempCancel = false; result.duration = pump.extendedBolusRemainingMinutes; result.absolute = pump.extendedBolusAbsoluteRate; @@ -604,7 +609,7 @@ public class DanaRSPlugin extends PluginBase implements PumpInterface, DanaRInte } result.enacted = false; result.success = false; - result.comment = MainApp.instance().getString(R.string.danar_valuenotsetproperly); + result.comment = MainApp.gs(R.string.danar_valuenotsetproperly); log.error("setExtendedBolus: Failed to extended bolus"); return result; } @@ -621,13 +626,13 @@ public class DanaRSPlugin extends PluginBase implements PumpInterface, DanaRInte if (!pump.isTempBasalInProgress) { result.success = true; result.isTempCancel = true; - result.comment = MainApp.instance().getString(R.string.virtualpump_resultok); + result.comment = MainApp.gs(R.string.virtualpump_resultok); if (Config.logPumpActions) log.debug("cancelRealTempBasal: OK"); return result; } else { result.success = false; - result.comment = MainApp.instance().getString(R.string.danar_valuenotsetproperly); + result.comment = MainApp.gs(R.string.danar_valuenotsetproperly); result.isTempCancel = true; log.error("cancelRealTempBasal: Failed to cancel temp basal"); return result; @@ -645,13 +650,13 @@ public class DanaRSPlugin extends PluginBase implements PumpInterface, DanaRInte } if (!pump.isExtendedInProgress) { result.success = true; - result.comment = MainApp.instance().getString(R.string.virtualpump_resultok); + result.comment = MainApp.gs(R.string.virtualpump_resultok); if (Config.logPumpActions) log.debug("cancelExtendedBolus: OK"); return result; } else { result.success = false; - result.comment = MainApp.instance().getString(R.string.danar_valuenotsetproperly); + result.comment = MainApp.gs(R.string.danar_valuenotsetproperly); log.error("cancelExtendedBolus: Failed to cancel extended bolus"); return result; } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRS/comm/DanaRS_Packet_Bolus_Set_Step_Bolus_Start.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRS/comm/DanaRS_Packet_Bolus_Set_Step_Bolus_Start.java index 12f2fa95c6..f90dd77b74 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRS/comm/DanaRS_Packet_Bolus_Set_Step_Bolus_Start.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRS/comm/DanaRS_Packet_Bolus_Set_Step_Bolus_Start.java @@ -7,58 +7,63 @@ import org.slf4j.LoggerFactory; import info.nightscout.androidaps.Config; import info.nightscout.androidaps.MainApp; +import info.nightscout.androidaps.R; import info.nightscout.androidaps.interfaces.Constraint; -import info.nightscout.utils.HardLimits; +import info.nightscout.androidaps.plugins.Overview.notifications.Notification; public class DanaRS_Packet_Bolus_Set_Step_Bolus_Start extends DanaRS_Packet { - private static Logger log = LoggerFactory.getLogger(DanaRS_Packet_Bolus_Set_Step_Bolus_Start.class); + private static Logger log = LoggerFactory.getLogger(DanaRS_Packet_Bolus_Set_Step_Bolus_Start.class); - private double amount; - private int speed; + private double amount; + private int speed; - public boolean failed; + public boolean failed; + public static int errorCode; - public DanaRS_Packet_Bolus_Set_Step_Bolus_Start() { + public DanaRS_Packet_Bolus_Set_Step_Bolus_Start() { super(); opCode = BleCommandUtil.DANAR_PACKET__OPCODE_BOLUS__SET_STEP_BOLUS_START; } // Speed 0 => 12 sec/U, 1 => 30 sec/U, 2 => 60 sec/U - public DanaRS_Packet_Bolus_Set_Step_Bolus_Start(double amount, int speed) { - this(); + public DanaRS_Packet_Bolus_Set_Step_Bolus_Start(double amount, int speed) { + this(); - // HARDCODED LIMIT - amount = MainApp.getConstraintChecker().applyBolusConstraints(new Constraint<>(amount)).value(); + // HARDCODED LIMIT + amount = MainApp.getConstraintChecker().applyBolusConstraints(new Constraint<>(amount)).value(); - this.amount = amount; - this.speed = speed; + this.amount = amount; + this.speed = speed; - if (Config.logDanaMessageDetail) - log.debug("Bolus start : " + amount + " speed: " + speed); - } + if (Config.logDanaMessageDetail) + log.debug("Bolus start : " + amount + " speed: " + speed); + } - @Override - public byte[] getRequestParams() { - int stepBolusRate = (int) (amount * 100); - byte[] request = new byte[3]; - request[0] = (byte) (stepBolusRate & 0xff); - request[1] = (byte) ((stepBolusRate >>> 8) & 0xff); - request[2] = (byte) (speed & 0xff); - return request; - } - @Override - public void handleMessage(byte[] data) { - int result = intFromBuff(data, 0, 1); - if (Config.logDanaMessageDetail) { - if (result == 0) - log.debug("Result OK"); - else - log.error("Result Error: " + result); - } - } + @Override + public byte[] getRequestParams() { + int stepBolusRate = (int) (amount * 100); + byte[] request = new byte[3]; + request[0] = (byte) (stepBolusRate & 0xff); + request[1] = (byte) ((stepBolusRate >>> 8) & 0xff); + request[2] = (byte) (speed & 0xff); + return request; + } - @Override - public String getFriendlyName() { - return "BOLUS__SET_STEP_BOLUS_START"; - } + @Override + public void handleMessage(byte[] data) { + errorCode = intFromBuff(data, 0, 1); + if (Config.logDanaMessageDetail) { + if (errorCode == 0) + log.debug("Result OK"); + else { + failed = true; + log.error("Result Error: " + errorCode); + } + } + } + + @Override + public String getFriendlyName() { + return "BOLUS__SET_STEP_BOLUS_START"; + } } 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 384c1a3772..91859c759a 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 @@ -273,7 +273,7 @@ public class DanaRSService extends Service { MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.disconnecting))); } }); - return true; + return !start.failed; } public void bolusStop() { 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 81c5d4d944..0ea6f192e4 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 @@ -22,6 +22,7 @@ import info.nightscout.androidaps.interfaces.Constraint; import info.nightscout.androidaps.interfaces.PumpDescription; import info.nightscout.androidaps.plugins.ConfigBuilder.DetailedBolusInfoStorage; import info.nightscout.androidaps.plugins.PumpDanaR.AbstractDanaRPlugin; +import info.nightscout.androidaps.plugins.PumpDanaR.comm.MsgBolusStartWithSpeed; import info.nightscout.androidaps.plugins.PumpDanaRv2.services.DanaRv2ExecutionService; import info.nightscout.androidaps.plugins.Treatments.Treatment; import info.nightscout.androidaps.plugins.Treatments.TreatmentsPlugin; @@ -119,7 +120,7 @@ public class DanaRv2Plugin extends AbstractDanaRPlugin { // Plugin base interface @Override public String getName() { - return MainApp.instance().getString(R.string.danarv2pump); + return MainApp.gs(R.string.danarv2pump); } @Override @@ -173,10 +174,13 @@ public class DanaRv2Plugin extends AbstractDanaRPlugin { if (detailedBolusInfo.insulin > 0 || carbs > 0) connectionOK = sExecutionService.bolus(detailedBolusInfo.insulin, (int) carbs, DateUtil.now() + carbTime * 60 * 1000, t); PumpEnactResult result = new PumpEnactResult(); - result.success = connectionOK; + result.success = connectionOK && detailedBolusInfo.insulin == t.insulin; result.bolusDelivered = t.insulin; result.carbsDelivered = detailedBolusInfo.carbs; - result.comment = MainApp.instance().getString(R.string.virtualpump_resultok); + if (!result.success) + result.comment = String.format(MainApp.gs(R.string.boluserrorcode), detailedBolusInfo.insulin, t.insulin, MsgBolusStartWithSpeed.errorCode); + else + result.comment = MainApp.gs(R.string.virtualpump_resultok); if (Config.logPumpActions) log.debug("deliverTreatment: OK. Asked: " + detailedBolusInfo.insulin + " Delivered: " + result.bolusDelivered); // remove carbs because it's get from history seprately @@ -186,7 +190,7 @@ public class DanaRv2Plugin extends AbstractDanaRPlugin { result.success = false; result.bolusDelivered = 0d; result.carbsDelivered = 0d; - result.comment = MainApp.instance().getString(R.string.danar_invalidinput); + result.comment = MainApp.gs(R.string.danar_invalidinput); log.error("deliverTreatment: Invalid input"); return result; } @@ -287,7 +291,7 @@ public class DanaRv2Plugin extends AbstractDanaRPlugin { result.isTempCancel = false; result.enacted = false; result.success = false; - result.comment = MainApp.instance().getString(R.string.danar_invalidinput); + result.comment = MainApp.gs(R.string.danar_invalidinput); log.error("setTempBasalPercent: Invalid input"); return result; } @@ -299,7 +303,7 @@ public class DanaRv2Plugin extends AbstractDanaRPlugin { result.enacted = false; result.success = true; result.isTempCancel = false; - result.comment = MainApp.instance().getString(R.string.virtualpump_resultok); + result.comment = MainApp.gs(R.string.virtualpump_resultok); result.duration = pump.tempBasalRemainingMin; result.percent = pump.tempBasalPercent; result.isPercent = true; @@ -317,7 +321,7 @@ public class DanaRv2Plugin extends AbstractDanaRPlugin { if (connectionOK && pump.isTempBasalInProgress && pump.tempBasalPercent == percent) { result.enacted = true; result.success = true; - result.comment = MainApp.instance().getString(R.string.virtualpump_resultok); + result.comment = MainApp.gs(R.string.virtualpump_resultok); result.isTempCancel = false; result.duration = pump.tempBasalRemainingMin; result.percent = pump.tempBasalPercent; @@ -328,7 +332,7 @@ public class DanaRv2Plugin extends AbstractDanaRPlugin { } result.enacted = false; result.success = false; - result.comment = MainApp.instance().getString(R.string.tempbasaldeliveryerror); + result.comment = MainApp.gs(R.string.tempbasaldeliveryerror); log.error("setTempBasalPercent: Failed to set temp basal"); return result; } @@ -339,7 +343,7 @@ public class DanaRv2Plugin extends AbstractDanaRPlugin { if (connectionOK && pump.isTempBasalInProgress && pump.tempBasalPercent == percent) { result.enacted = true; result.success = true; - result.comment = MainApp.instance().getString(R.string.virtualpump_resultok); + result.comment = MainApp.gs(R.string.virtualpump_resultok); result.isTempCancel = false; result.duration = pump.tempBasalRemainingMin; result.percent = pump.tempBasalPercent; @@ -350,7 +354,7 @@ public class DanaRv2Plugin extends AbstractDanaRPlugin { } result.enacted = false; result.success = false; - result.comment = MainApp.instance().getString(R.string.danar_valuenotsetproperly); + result.comment = MainApp.gs(R.string.danar_valuenotsetproperly); log.error("setHighTempBasalPercent: Failed to set temp basal"); return result; } @@ -367,13 +371,13 @@ public class DanaRv2Plugin extends AbstractDanaRPlugin { if (!pump.isTempBasalInProgress) { result.success = true; result.isTempCancel = true; - result.comment = MainApp.instance().getString(R.string.virtualpump_resultok); + result.comment = MainApp.gs(R.string.virtualpump_resultok); if (Config.logPumpActions) log.debug("cancelRealTempBasal: OK"); return result; } else { result.success = false; - result.comment = MainApp.instance().getString(R.string.danar_valuenotsetproperly); + result.comment = MainApp.gs(R.string.danar_valuenotsetproperly); result.isTempCancel = true; log.error("cancelRealTempBasal: Failed to cancel temp basal"); return result; 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 551c2684c0..25cac9da1c 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 @@ -386,7 +386,7 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService { MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.disconnecting))); } }); - return true; + return !start.failed; } public void bolusStop() { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/history/HistoryIntentAdapter.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/history/HistoryIntentAdapter.java index 1ddc4fd4b7..244537af3e 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/history/HistoryIntentAdapter.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/history/HistoryIntentAdapter.java @@ -161,18 +161,54 @@ class HistoryIntentAdapter { Date date = getDateExtra(intent, HistoryBroadcast.EXTRA_EVENT_TIME); String alertType = intent.getStringExtra(HistoryBroadcast.EXTRA_ALERT_TYPE); if (MainApp.getDbHelper().getCareportalEventFromTimestamp(date.getTime()) != null) return; - try { - JSONObject data = new JSONObject(); - String enteredBy = SP.getString("careportal_enteredby", ""); - if (!enteredBy.equals("")) data.put("enteredBy", enteredBy); - data.put("created_at", DateUtil.toISOString(date)); - data.put("eventType", CareportalEvent.NOTE); - data.put("notes", MainApp.instance().getString(getAlertText(alertType))); - NSUpload.uploadCareportalEntryToNS(data); - } catch (JSONException e) { - e.printStackTrace(); + logNote(date, MainApp.instance().getString(getAlertText(alertType))); + } + } + + void processPumpStatusChangedIntent(Intent intent) { + Date newStatusTime = getDateExtra(intent, HistoryBroadcast.EXTRA_EVENT_TIME); + if (SP.getBoolean("insight_automatic_careportal_events", false)) { + String newStatus = intent.getStringExtra(HistoryBroadcast.EXTRA_NEW_STATUS); + switch (newStatus) { + case "STARTED": + logNote(newStatusTime, MainApp.instance().getString(R.string.pump_started)); + break; + case "STOPPED": + logNote(newStatusTime, MainApp.instance().getString(R.string.pump_stopped)); + break; + case "PAUSED": + logNote(newStatusTime, MainApp.instance().getString(R.string.pump_paused)); + break; } } + if (intent.hasExtra(HistoryBroadcast.EXTRA_OLD_STATUS_TIME)) { + String oldStatus = intent.getStringExtra(HistoryBroadcast.EXTRA_OLD_STATUS); + if (oldStatus.equals("STOPPED")) { + Date oldStatusTime = getDateExtra(intent, HistoryBroadcast.EXTRA_OLD_STATUS_TIME); + int duration = (int) ((newStatusTime.getTime() - oldStatusTime.getTime()) / 60000); + + long serialNumber = Long.parseLong(intent.getStringExtra(HistoryBroadcast.EXTRA_PUMP_SERIAL_NUMBER)); + long recordId = intent.getLongExtra(HistoryBroadcast.EXTRA_EVENT_NUMBER, -1); + long uniqueRecordId = getRecordUniqueID(serialNumber, recordId); + + logAdapter.createTBRrecord(oldStatusTime, 0, duration, uniqueRecordId); + } + } + } + + private void logNote(Date date, String note) { + try { + if (MainApp.getDbHelper().getCareportalEventFromTimestamp(date.getTime()) != null) return; + JSONObject data = new JSONObject(); + String enteredBy = SP.getString("careportal_enteredby", ""); + if (!enteredBy.equals("")) data.put("enteredBy", enteredBy); + data.put("created_at", DateUtil.toISOString(date)); + data.put("eventType", CareportalEvent.NOTE); + data.put("notes", note); + NSUpload.uploadCareportalEntryToNS(data); + } catch (JSONException e) { + e.printStackTrace(); + } } private int getAlertText(String type) { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/history/HistoryReceiver.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/history/HistoryReceiver.java index 0e254e3341..efce8d7a40 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/history/HistoryReceiver.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpInsight/history/HistoryReceiver.java @@ -47,6 +47,7 @@ public class HistoryReceiver { filter.addAction(ACTION_CARTRIDGE_INSERTED); filter.addAction(ACTION_BATTERY_INSERTED); filter.addAction(ACTION_OCCURENCE_OF_ALERT); + filter.addAction(ACTION_PUMP_STATUS_CHANGED); MainApp.instance().registerReceiver(historyReceiver, filter); } @@ -108,6 +109,9 @@ public class HistoryReceiver { case ACTION_OCCURENCE_OF_ALERT: intentAdapter.processOccurenceOfAlertIntent(intent); break; + case ACTION_PUMP_STATUS_CHANGED: + intentAdapter.processPumpStatusChangedIntent(intent); + break; } } }; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Source/SourceXdripPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/Source/SourceXdripPlugin.java index f47d25abb1..bd3d96162e 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Source/SourceXdripPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Source/SourceXdripPlugin.java @@ -35,6 +35,6 @@ public class SourceXdripPlugin extends PluginBase implements BgSourceInterface { } public void setSource(String source) { - this.advancedFiltering = "G5 Native".equals(source); + this.advancedFiltering = source.contains("G5 Native"); } } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/TreatmentsPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/TreatmentsPlugin.java index 8f82f71c35..bc5f4a7835 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/TreatmentsPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/TreatmentsPlugin.java @@ -40,6 +40,8 @@ import info.nightscout.androidaps.plugins.IobCobCalculator.AutosensData; import info.nightscout.androidaps.plugins.IobCobCalculator.IobCobCalculatorPlugin; import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification; import info.nightscout.androidaps.plugins.Overview.notifications.Notification; +import info.nightscout.androidaps.plugins.SensitivityAAPS.SensitivityAAPSPlugin; +import info.nightscout.androidaps.plugins.SensitivityWeightedAverage.SensitivityWeightedAveragePlugin; import info.nightscout.utils.DateUtil; import info.nightscout.utils.NSUpload; import info.nightscout.utils.SP; @@ -211,22 +213,35 @@ public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface if (profile == null) return result; long now = System.currentTimeMillis(); - long dia_ago = now - (Double.valueOf(1.5d * profile.getDia() * T.hours(1).msecs())).longValue(); + long dia_ago = now - (Double.valueOf(profile.getDia() * T.hours(1).msecs())).longValue(); + + double maxAbsorptionHours = Constants.DEFAULT_MAX_ABSORPTION_TIME; + if (SensitivityAAPSPlugin.getPlugin().isEnabled(PluginType.SENSITIVITY) || SensitivityWeightedAveragePlugin.getPlugin().isEnabled(PluginType.SENSITIVITY)) { + maxAbsorptionHours = SP.getDouble(R.string.key_absorption_maxtime, Constants.DEFAULT_MAX_ABSORPTION_TIME); + } else { + maxAbsorptionHours = SP.getDouble(R.string.key_absorption_cutoff, Constants.DEFAULT_MAX_ABSORPTION_TIME); + } + long absorptionTime_ago = now - (Double.valueOf(maxAbsorptionHours * T.hours(1).msecs())).longValue(); synchronized (treatments) { for (Treatment treatment : treatments) { if (!treatment.isValid) continue; long t = treatment.date; + if (t > dia_ago && t <= now) { - if (treatment.carbs >= 1) { - result.carbs += treatment.carbs; - result.lastCarbTime = t; - } if (treatment.insulin > 0 && treatment.mealBolus) { result.boluses += treatment.insulin; } } + + if (t > absorptionTime_ago && t <= now) { + if (treatment.carbs >= 1) { + result.carbs += treatment.carbs; + if(t > result.lastCarbTime) + result.lastCarbTime = t; + } + } } } @@ -235,6 +250,7 @@ public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface result.mealCOB = autosensData.cob; result.slopeFromMinDeviation = autosensData.slopeFromMinDeviation; result.slopeFromMaxDeviation = autosensData.slopeFromMaxDeviation; + result.usedMinCarbsImpact = autosensData.usedMinCarbsImpact; } result.lastBolusTime = getLastBolusTime(); return result; 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 a514a85815..93b6f99db0 100644 --- a/app/src/main/java/info/nightscout/androidaps/queue/CommandQueue.java +++ b/app/src/main/java/info/nightscout/androidaps/queue/CommandQueue.java @@ -205,7 +205,7 @@ public class CommandQueue { // returns true if command is queued public boolean tempBasalAbsolute(double absoluteRate, int durationInMinutes, boolean enforceNew, Profile profile, Callback callback) { - if (isRunning(Command.CommandType.TEMPBASAL)) { + if (!enforceNew && isRunning(Command.CommandType.TEMPBASAL)) { if (callback != null) callback.result(executingNowError()).run(); return false; @@ -226,7 +226,7 @@ public class CommandQueue { // returns true if command is queued public boolean tempBasalPercent(Integer percent, int durationInMinutes, boolean enforceNew, Profile profile, Callback callback) { - if (isRunning(Command.CommandType.TEMPBASAL)) { + if (!enforceNew && isRunning(Command.CommandType.TEMPBASAL)) { if (callback != null) callback.result(executingNowError()).run(); return false; @@ -268,7 +268,7 @@ public class CommandQueue { // returns true if command is queued public boolean cancelTempBasal(boolean enforceNew, Callback callback) { - if (isRunning(Command.CommandType.TEMPBASAL)) { + if (!enforceNew && isRunning(Command.CommandType.TEMPBASAL)) { if (callback != null) callback.result(executingNowError()).run(); return false; diff --git a/app/src/main/java/info/nightscout/androidaps/receivers/NetworkChangeReceiver.java b/app/src/main/java/info/nightscout/androidaps/receivers/NetworkChangeReceiver.java new file mode 100644 index 0000000000..b3a99b66ff --- /dev/null +++ b/app/src/main/java/info/nightscout/androidaps/receivers/NetworkChangeReceiver.java @@ -0,0 +1,67 @@ +package info.nightscout.androidaps.receivers; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.net.ConnectivityManager; +import android.net.NetworkInfo; +import android.net.wifi.SupplicantState; +import android.net.wifi.WifiInfo; +import android.net.wifi.WifiManager; +import android.os.PowerManager; +import android.support.annotation.Nullable; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import info.nightscout.androidaps.MainApp; +import info.nightscout.androidaps.events.EventNetworkChange; + +public class NetworkChangeReceiver extends BroadcastReceiver { + private static Logger log = LoggerFactory.getLogger(NetworkChangeReceiver.class); + + @Override + public void onReceive(final Context context, final Intent intent) { + PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE); + if (pm == null) return; + PowerManager.WakeLock wl = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "NetworkChangeReceiver"); + wl.acquire(10000); + + EventNetworkChange event = grabNetworkStatus(); + if (event != null) + MainApp.bus().post(event); + + wl.release(); + } + + @Nullable + public static EventNetworkChange grabNetworkStatus() { + EventNetworkChange event = new EventNetworkChange(); + + ConnectivityManager cm = (ConnectivityManager) MainApp.instance().getApplicationContext().getSystemService(Context.CONNECTIVITY_SERVICE); + if (cm == null) return null; + NetworkInfo activeNetwork = cm.getActiveNetworkInfo(); + + if (activeNetwork != null) { + if (activeNetwork.getType() == ConnectivityManager.TYPE_WIFI) { + event.wifiConnected = true; + WifiManager wifiManager = (WifiManager) MainApp.instance().getApplicationContext().getSystemService(Context.WIFI_SERVICE); + if (wifiManager != null) { + WifiInfo wifiInfo = wifiManager.getConnectionInfo(); + if (wifiInfo.getSupplicantState() == SupplicantState.COMPLETED) { + event.ssid = wifiInfo.getSSID(); + } + log.debug("NETCHANGE: Wifi connected. SSID: " + event.ssid); + } + } + if (activeNetwork.getType() == ConnectivityManager.TYPE_MOBILE) { + event.mobileConnected = true; + event.roaming = activeNetwork.isRoaming(); + log.debug("NETCHANGE: Mobile connected. Roaming: " + event.roaming); + } + } else { + log.debug("NETCHANGE: Disconnected."); + } + return event; + } +} \ No newline at end of file diff --git a/app/src/main/java/info/nightscout/utils/DecimalFormatter.java b/app/src/main/java/info/nightscout/utils/DecimalFormatter.java index 6709b304d9..0f7164b690 100644 --- a/app/src/main/java/info/nightscout/utils/DecimalFormatter.java +++ b/app/src/main/java/info/nightscout/utils/DecimalFormatter.java @@ -46,13 +46,13 @@ public class DecimalFormatter { } public static String toPumpSupportedBolus(double value) { - return ConfigBuilderPlugin.getActivePump().getPumpDescription().bolusStep <= 0.01 + return ConfigBuilderPlugin.getActivePump().getPumpDescription().bolusStep <= 0.05 ? to2Decimal(value) : to1Decimal(value); } public static DecimalFormat pumpSupportedBolusFormat() { - return ConfigBuilderPlugin.getActivePump().getPumpDescription().bolusStep <= 0.01 + return ConfigBuilderPlugin.getActivePump().getPumpDescription().bolusStep <= 0.05 ? new DecimalFormat("0.00") : new DecimalFormat("0.0"); } diff --git a/app/src/main/res/layout/activity_historybrowse.xml b/app/src/main/res/layout/activity_historybrowse.xml index 88946033f4..1d52560eff 100644 --- a/app/src/main/res/layout/activity_historybrowse.xml +++ b/app/src/main/res/layout/activity_historybrowse.xml @@ -96,6 +96,13 @@ android:paddingTop="5dp" app:srcCompat="@drawable/ic_arrow_drop_down_white_24dp" /> + + - + - + + + @@ -299,8 +306,8 @@ + android:orientation="horizontal" + android:paddingRight="5dp"> + + + + + + Zeit/Datum des abgegebenen Boluses auf der Pumpe erscheint falsch, IOB ist wahrscheinlich nicht korrekt. Bitte prüfe Zeit/Datum der Pumpe. Anzahl TBRs Anzahl Boluse + Pumpe gestoppt + Pumpe gestartet + Pumpe pausiert diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index a0b229946e..4aa21abf19 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -8,6 +8,8 @@ #ffea00 #ff9500 #FFFFFF + #FFFFFF00 + #FFFF00FF #00FF00 #FF0000 #FFFF00 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index b38c086103..551d5b8e6a 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -619,6 +619,8 @@ Sensitivity AAPS Absorption settings absorption_maxtime + absorption_cutoff + Meal max absorption time [h] Time in hours where is expected all carbs from meal will be absorbed rangetodisplay @@ -997,7 +999,29 @@ openapsmb_max_iob Maximum total IOB OpenAPS can\'t go over [U] This value is called Max IOB in OpenAPS context\nOpenAPS will not add more insulin if current IOB is greater than this value + Pump stopped + Pump started + Pump paused + Meal max absorption time [h] + Time at which any meal is considered absorbed. Remaining carbs will be cut off. Time show_notes_entry_dialogs Show notes field in treatment dialogs + openapsama_min_5m_carbimpact + Asked: %.2fU Delivered: %.2fU Error code: %d + First insulin increment + Second insulin increment + Third insulin increment + First carbs increment + Second carbs increment + Third carbs increment + CGM + ns_wifionly + ns_wifi_ssids + ns_allowroaming + Use WiFi connection only + WiFi SSID + Connection settings + Allowed SSIDs (semicolon separated) + Allow connection in roaming diff --git a/app/src/main/res/xml/pref_absorption_aaps.xml b/app/src/main/res/xml/pref_absorption_aaps.xml index f86a21ec88..e5dab3128e 100644 --- a/app/src/main/res/xml/pref_absorption_aaps.xml +++ b/app/src/main/res/xml/pref_absorption_aaps.xml @@ -6,10 +6,10 @@ android:title="@string/absorptionsettings_title"> + android:key="@string/key_openapsama_min_5m_carbimpact" /> + + diff --git a/app/src/main/res/xml/pref_advanced.xml b/app/src/main/res/xml/pref_advanced.xml index 260e2c5135..1ca031a94e 100644 --- a/app/src/main/res/xml/pref_advanced.xml +++ b/app/src/main/res/xml/pref_advanced.xml @@ -5,29 +5,6 @@ android:key="advanced" android:title="@string/advancedsettings_title"> - - - - - - - - - + + - - - - - - - + android:title="@string/nsalarm_urgenthigh" /> + android:title="@string/nsalarm_high" /> - + android:title="@string/nsalarm_low" /> + android:title="@string/nsalarm_urgentlow" /> + android:title="@string/nsalarm_staledata" /> + validate:maxNumber="120" + validate:minNumber="15" + validate:testType="numericRange" /> + android:title="@string/nsalarm_urgentstaledata" /> + validate:maxNumber="180" + validate:minNumber="30" + validate:testType="numericRange" /> + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/xml/pref_overview.xml b/app/src/main/res/xml/pref_overview.xml index 7d2ecc4282..5d08cd671e 100644 --- a/app/src/main/res/xml/pref_overview.xml +++ b/app/src/main/res/xml/pref_overview.xml @@ -1,120 +1,150 @@ + + + + android:title="@string/treatments" /> + + android:title="@string/overview_calculator_label" /> + android:title="@string/configbuilder_insulin" /> + - + + - + + + android:inputType="numberDecimal|numberSigned" + android:key="@string/key_insulin_button_increment_3" + android:maxLines="20" + android:selectAllOnFocus="true" + android:singleLine="true" + android:title="@string/thirdinsulinincrement" + validate:floatmaxNumber="5.0" + validate:floatminNumber="-5.0" + validate:testType="floatNumericRange" /> + android:title="@string/carbs" /> + - + + - + + + android:inputType="numberSigned" + android:key="@string/key_carbs_button_increment_3" + android:maxLines="20" + android:selectAllOnFocus="true" + android:singleLine="true" + android:title="@string/thirdcarbsincrement" + validate:maxNumber="50" + validate:minNumber="-50" + validate:testType="numericRange" /> + android:summary="@string/show_cgm_button_summary" + android:title="@string/cgm" /> + + android:summary="@string/show_calibration_button_summary" + android:title="@string/overview_calibration" /> + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/xml/pref_quickwizard.xml b/app/src/main/res/xml/pref_quickwizard.xml deleted file mode 100644 index d10e40a7e4..0000000000 --- a/app/src/main/res/xml/pref_quickwizard.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - \ No newline at end of file