From b180569695b6b71cc74500482757f45d71cb47b7 Mon Sep 17 00:00:00 2001 From: Andrew Warrington Date: Mon, 18 Dec 2017 21:58:02 +0100 Subject: [PATCH] Show watch basal rates, whether temporary or normal. --- .../wearintegration/WatchUpdaterService.java | 16 +++++++++------- .../androidaps/watchfaces/BaseWatchFace.java | 2 +- 2 files changed, 10 insertions(+), 8 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 944774baaa..d87ac2e69c 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 @@ -533,7 +533,7 @@ public class WatchUpdaterService extends WearableListenerService implements String iobSum = DecimalFormatter.to2Decimal(bolusIob.iob + basalIob.basaliob); String iobDetail = "(" + DecimalFormatter.to2Decimal(bolusIob.iob) + "|" + DecimalFormatter.to2Decimal(basalIob.basaliob) + ")"; String cobString = generateCOBString(); - String tempBasal = generateBasalString(treatmentsInterface); + String currentBasal = generateBasalString(treatmentsInterface); //bgi String bgiString = ""; @@ -543,7 +543,7 @@ public class WatchUpdaterService extends WearableListenerService implements bgiString = "" + ((bgi >= 0) ? "+" : "") + DecimalFormatter.to1Decimal(bgi); } - String status = generateStatusString(profile, tempBasal,iobSum, iobDetail, bgiString); + String status = generateStatusString(profile, currentBasal,iobSum, iobDetail, bgiString); //batteries int phoneBattery = getBatteryLevel(getApplicationContext()); @@ -567,7 +567,7 @@ public class WatchUpdaterService extends WearableListenerService implements dataMapRequest.getDataMap().putString("iobDetail", iobDetail); dataMapRequest.getDataMap().putBoolean("detailedIob", mPrefs.getBoolean("wear_detailediob", false)); dataMapRequest.getDataMap().putString("cob", cobString); - dataMapRequest.getDataMap().putString("tempBasal", tempBasal); + dataMapRequest.getDataMap().putString("currentBasal", currentBasal); dataMapRequest.getDataMap().putString("battery", "" + phoneBattery); dataMapRequest.getDataMap().putString("rigBattery", rigBattery); dataMapRequest.getDataMap().putLong("openApsStatus", openApsStatus); @@ -598,7 +598,7 @@ public class WatchUpdaterService extends WearableListenerService implements } @NonNull - private String generateStatusString(Profile profile, String tempBasal, String iobSum, String iobDetail, String bgiString) { + private String generateStatusString(Profile profile, String currentBasal, String iobSum, String iobDetail, String bgiString) { String status = ""; @@ -623,7 +623,7 @@ public class WatchUpdaterService extends WearableListenerService implements iobString = iobSum + "U"; } - status += tempBasal + " " + iobString; + status += currentBasal + " " + iobString; //add BGI if shown, otherwise return if (mPrefs.getBoolean("wear_showbgi", false)) { @@ -636,10 +636,12 @@ public class WatchUpdaterService extends WearableListenerService implements @NonNull private String generateBasalString(TreatmentsInterface treatmentsInterface) { - String basalStringResult = "-.--U/h"; + String basalStringResult; TemporaryBasal activeTemp = treatmentsInterface.getTempBasalFromHistory(System.currentTimeMillis()); if (activeTemp != null) { - basalStringResult = activeTemp.toStringShort(); + basalStringResult = activeTemp.toStringVeryShort(); + } else { + basalStringResult = DecimalFormatter.to2Decimal(MainApp.getConfigBuilder().getProfile().getBasal()) + "U/h"; } return basalStringResult; } diff --git a/wear/src/main/java/info/nightscout/androidaps/watchfaces/BaseWatchFace.java b/wear/src/main/java/info/nightscout/androidaps/watchfaces/BaseWatchFace.java index cb82daf3eb..c4b7c3c5f0 100644 --- a/wear/src/main/java/info/nightscout/androidaps/watchfaces/BaseWatchFace.java +++ b/wear/src/main/java/info/nightscout/androidaps/watchfaces/BaseWatchFace.java @@ -257,7 +257,7 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferen if (layoutSet && bundle != null) { DataMap dataMap = DataMap.fromBundle(bundle); wakeLock.acquire(50); - sBasalRate = dataMap.getString("tempBasal"); + sBasalRate = dataMap.getString("currentBasal"); sUploaderBattery = dataMap.getString("battery"); sRigBattery = dataMap.getString("rigBattery"); detailedIOB = dataMap.getBoolean("detailedIob");