From 5e597f03d0c7fa1a451a3cb63e57670edf19e56e Mon Sep 17 00:00:00 2001 From: Roumen Georgiev Date: Tue, 5 Dec 2017 09:23:57 +0200 Subject: [PATCH 1/7] Added profile's target BG in NSClient mode --- .../androidaps/plugins/Overview/OverviewFragment.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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 8e3c2cb29e..29d6f9c75f 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 @@ -976,7 +976,13 @@ public class OverviewFragment extends Fragment implements View.OnClickListener, tempTargetView.setVisibility(View.VISIBLE); } if ((Config.NSCLIENT || Config.G5UPLOADER) && tempTarget == null) { - tempTargetView.setVisibility(View.GONE); + //tempTargetView.setVisibility(View.GONE); + tempTargetView.setTextColor(Color.WHITE); + tempTargetView.setBackgroundColor(MainApp.sResources.getColor(R.color.tempTargetDisabledBackground)); + if(Profile.toTargetRangeString(profile.getTargetLow(), profile.getTargetHigh(), units, units) != null) { + tempTargetView.setText(Profile.toTargetRangeString(profile.getTargetLow(), profile.getTargetHigh(), units, units)); + } else tempTargetView.setText(getContext().getString(R.string.temptarget)); + tempTargetView.setVisibility(View.VISIBLE); } // **** Temp button **** From 242ed7217ae3fe484c0ddb1842e82a0a82ac9539 Mon Sep 17 00:00:00 2001 From: Roumen Georgiev Date: Thu, 7 Dec 2017 10:08:26 +0200 Subject: [PATCH 2/7] fix of extended bolus size --- .../graphExtensions/PointsWithLabelGraphSeries.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 f264a22382..7606a71f17 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 @@ -230,7 +230,7 @@ public class PointsWithLabelGraphSeries e 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((int) (scaledTextSize * 2.5)); + mPaint.setTextSize((float) (scaledTextSize)); mPaint.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.NORMAL)); mPaint.setFakeBoldText(true); canvas.drawText(value.getLabel(), endX, endY, mPaint); @@ -282,7 +282,7 @@ public class PointsWithLabelGraphSeries e mPaint.setStrokeWidth(0); if (value.getLabel() != null) { mPaint.setStrokeWidth(0); - mPaint.setTextSize((int) (scaledTextSize * 3)); + 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); @@ -312,7 +312,7 @@ public class PointsWithLabelGraphSeries e mPaint.setStrokeWidth(0); if (value.getLabel() != null) { mPaint.setStrokeWidth(0); - mPaint.setTextSize(scaledTextSize * 3); + mPaint.setTextSize((float) (scaledTextSize * 1.5)); mPaint.setTypeface(Typeface.create(Typeface.DEFAULT, Typeface.BOLD)); Rect bounds = new Rect(); mPaint.getTextBounds(value.getLabel(), 0, value.getLabel().length(), bounds); From aea47420e112f645d7e27d268030163ec75fae35 Mon Sep 17 00:00:00 2001 From: AdrianLxM Date: Thu, 7 Dec 2017 10:40:00 +0100 Subject: [PATCH 3/7] fix NPE when profile not loaded --- .../plugins/Wear/wearintegration/WatchUpdaterService.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Wear/wearintegration/WatchUpdaterService.java b/app/src/main/java/info/nightscout/androidaps/plugins/Wear/wearintegration/WatchUpdaterService.java index 7acdd15d72..944774baaa 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Wear/wearintegration/WatchUpdaterService.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Wear/wearintegration/WatchUpdaterService.java @@ -538,8 +538,10 @@ public class WatchUpdaterService extends WearableListenerService implements //bgi String bgiString = ""; Profile profile = MainApp.getConfigBuilder().getProfile(); - double bgi = -(bolusIob.activity + basalIob.activity) * 5 * profile.getIsf(); - bgiString = "" + ((bgi >= 0) ? "+" : "") + DecimalFormatter.to1Decimal(bgi); + if(profile!=null) { + double bgi = -(bolusIob.activity + basalIob.activity) * 5 * profile.getIsf(); + bgiString = "" + ((bgi >= 0) ? "+" : "") + DecimalFormatter.to1Decimal(bgi); + } String status = generateStatusString(profile, tempBasal,iobSum, iobDetail, bgiString); From 1d8dd5e35e40dd4bba85a46918ec4b0e8efb837f Mon Sep 17 00:00:00 2001 From: Roumen Georgiev Date: Thu, 7 Dec 2017 17:11:54 +0200 Subject: [PATCH 4/7] removing the whole if() statement --- .../androidaps/plugins/Overview/OverviewFragment.java | 9 --------- 1 file changed, 9 deletions(-) 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 29d6f9c75f..344804cf7f 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 @@ -975,15 +975,6 @@ public class OverviewFragment extends Fragment implements View.OnClickListener, tempTargetView.setText(Profile.toTargetRangeString(profile.getTargetLow(), profile.getTargetHigh(), units, units)); tempTargetView.setVisibility(View.VISIBLE); } - if ((Config.NSCLIENT || Config.G5UPLOADER) && tempTarget == null) { - //tempTargetView.setVisibility(View.GONE); - tempTargetView.setTextColor(Color.WHITE); - tempTargetView.setBackgroundColor(MainApp.sResources.getColor(R.color.tempTargetDisabledBackground)); - if(Profile.toTargetRangeString(profile.getTargetLow(), profile.getTargetHigh(), units, units) != null) { - tempTargetView.setText(Profile.toTargetRangeString(profile.getTargetLow(), profile.getTargetHigh(), units, units)); - } else tempTargetView.setText(getContext().getString(R.string.temptarget)); - tempTargetView.setVisibility(View.VISIBLE); - } // **** Temp button **** if (acceptTempLayout != null) { From 9d7e2f1becef16df44c3bd77bdf01c23a2657f3b Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Thu, 7 Dec 2017 18:48:05 +0100 Subject: [PATCH 5/7] RS report unsupported firmware --- .../plugins/Overview/notifications/Notification.java | 1 + .../comm/DanaRS_Packet_General_Get_Pump_Check.java | 8 ++++++++ app/src/main/res/values/strings.xml | 1 + 3 files changed, 10 insertions(+) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/notifications/Notification.java b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/notifications/Notification.java index 34ba82c27e..30f6fdd328 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/notifications/Notification.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/notifications/Notification.java @@ -55,6 +55,7 @@ public class Notification { public static final int WRONG_DRIVER = 24; public static final int PUMP_UNREACHABLE = 26; public static final int BG_READINGS_MISSED = 27; + public static final int UNSUPPORTED_FIRMWARE = 28; public int id; public Date date; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRS/comm/DanaRS_Packet_General_Get_Pump_Check.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRS/comm/DanaRS_Packet_General_Get_Pump_Check.java index 4818f4481d..a9bb7157af 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRS/comm/DanaRS_Packet_General_Get_Pump_Check.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRS/comm/DanaRS_Packet_General_Get_Pump_Check.java @@ -6,6 +6,10 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import info.nightscout.androidaps.Config; +import info.nightscout.androidaps.MainApp; +import info.nightscout.androidaps.R; +import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification; +import info.nightscout.androidaps.plugins.Overview.notifications.Notification; import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPump; public class DanaRS_Packet_General_Get_Pump_Check extends DanaRS_Packet { @@ -37,6 +41,10 @@ public class DanaRS_Packet_General_Get_Pump_Check extends DanaRS_Packet { log.debug("Protocol: " + String.format("%02X ", pump.protocol)); log.debug("Product Code: " + String.format("%02X ", pump.productCode)); } + + if (pump.productCode < 2) { + MainApp.bus().post(new EventNewNotification(new Notification(Notification.UNSUPPORTED_FIRMWARE, MainApp.sResources.getString(R.string.unsupportedfirmware), Notification.URGENT))); + } } @Override diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index e8918979b3..282299fdd0 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -784,5 +784,6 @@ Customized APK for download Show detailed delta Show delta with one more decimal place + Unsupported pump firmware From 874915e7b412fb3c046492d6a46b4c8a6b0ed8d6 Mon Sep 17 00:00:00 2001 From: AdrianLxM Date: Thu, 7 Dec 2017 12:30:58 +0100 Subject: [PATCH 6/7] adapt wear actions to command queue --- .../androidaps/plugins/Wear/ActionStringHandler.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Wear/ActionStringHandler.java b/app/src/main/java/info/nightscout/androidaps/plugins/Wear/ActionStringHandler.java index 6511cedbdf..da01d2103e 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Wear/ActionStringHandler.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Wear/ActionStringHandler.java @@ -3,6 +3,7 @@ package info.nightscout.androidaps.plugins.Wear; import android.os.Handler; import android.os.HandlerThread; import android.support.annotation.NonNull; +import android.view.View; import java.text.DateFormat; import java.text.DecimalFormat; @@ -296,11 +297,10 @@ public class ActionStringHandler { rMessage += MainApp.instance().getString(R.string.pumpbusy); } else { rMessage += "trying to fetch data from pump."; - Handler handler = new Handler(handlerThread.getLooper()); - handler.post(new Runnable() { + + ConfigBuilderPlugin.getCommandQueue().loadHistory(RecordTypes.RECORD_TYPE_DAILY, new Callback() { @Override public void run() { - ((DanaRInterface) pump).loadHistory(RecordTypes.RECORD_TYPE_DAILY); List dummies = new LinkedList(); List historyList = getTDDList(dummies); if (isOldData(historyList)) { @@ -308,8 +308,8 @@ public class ActionStringHandler { } else { sendStatusmessage("TDD", generateTDDMessage(historyList, dummies)); } - } - }); + } + }); } } else { // if up to date: prepare, send (check if CPP is activated -> add CPP stats) From 21f91b9b29168c02c4abacf56e8f86e424a1e9eb Mon Sep 17 00:00:00 2001 From: AdrianLxM Date: Fri, 8 Dec 2017 14:58:13 +0100 Subject: [PATCH 7/7] remove unused imports --- .../androidaps/plugins/Wear/ActionStringHandler.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Wear/ActionStringHandler.java b/app/src/main/java/info/nightscout/androidaps/plugins/Wear/ActionStringHandler.java index da01d2103e..db94fbe740 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Wear/ActionStringHandler.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Wear/ActionStringHandler.java @@ -1,9 +1,7 @@ package info.nightscout.androidaps.plugins.Wear; -import android.os.Handler; import android.os.HandlerThread; import android.support.annotation.NonNull; -import android.view.View; import java.text.DateFormat; import java.text.DecimalFormat; @@ -27,7 +25,6 @@ import info.nightscout.androidaps.db.ProfileSwitch; import info.nightscout.androidaps.db.Source; import info.nightscout.androidaps.db.TempTarget; import info.nightscout.androidaps.interfaces.APSInterface; -import info.nightscout.androidaps.interfaces.DanaRInterface; import info.nightscout.androidaps.interfaces.PluginBase; import info.nightscout.androidaps.interfaces.ProfileInterface; import info.nightscout.androidaps.interfaces.PumpInterface;