From ab89e16acd972d252c7ce596ff6810e48a295307 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Sun, 7 Jan 2018 12:09:23 +0100 Subject: [PATCH 01/10] PARTIAL_WAKE_LOCK for NSClientService --- .../services/NSClientService.java | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) 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 abd0f2b26b..1ef71c2f75 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 @@ -114,6 +114,18 @@ public class NSClientService extends Service { initialize(); } + @Override + public void onCreate() { + super.onCreate(); + mWakeLock.acquire(); + } + + @Override + public void onDestroy() { + super.onDestroy(); + mWakeLock.release(); + } + public class LocalBinder extends Binder { public NSClientService getServiceInstance() { return NSClientService.this; @@ -182,8 +194,6 @@ public class NSClientService extends Service { public void initialize() { dataCounter = 0; - NSClientService.mWakeLock.acquire(); - readPreferences(); if (!nsAPISecret.equals("")) @@ -221,7 +231,6 @@ public class NSClientService extends Service { MainApp.bus().post(new EventNSClientNewLog("NSCLIENT", "No NS URL specified")); MainApp.bus().post(new EventNSClientStatus("Not configured")); } - NSClientService.mWakeLock.release(); } private Emitter.Listener onConnect = new Emitter.Listener() { @@ -242,6 +251,15 @@ public class NSClientService extends Service { public void destroy() { if (mSocket != null) { + mSocket.off(Socket.EVENT_CONNECT); + mSocket.off(Socket.EVENT_DISCONNECT); + mSocket.off(Socket.EVENT_PING); + mSocket.off("dataUpdate"); + mSocket.off("announcement"); + mSocket.off("alarm"); + mSocket.off("urgent_alarm"); + mSocket.off("clear_alarm"); + MainApp.bus().post(new EventNSClientNewLog("NSCLIENT", "destroy")); isConnected = false; hasWriteAuth = false; From 1ff99c4814881c80cafb69c0ac7c592474d9b1b7 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Sun, 7 Jan 2018 15:29:50 +0100 Subject: [PATCH 02/10] prefill profile switch JSON from local store if not exists --- .../androidaps/db/DatabaseHelper.java | 18 ++++++++++++++++++ .../Overview/notifications/Notification.java | 1 + app/src/main/res/values/strings.xml | 1 + 3 files changed, 20 insertions(+) diff --git a/app/src/main/java/info/nightscout/androidaps/db/DatabaseHelper.java b/app/src/main/java/info/nightscout/androidaps/db/DatabaseHelper.java index dc8e921e88..d961336293 100644 --- a/app/src/main/java/info/nightscout/androidaps/db/DatabaseHelper.java +++ b/app/src/main/java/info/nightscout/androidaps/db/DatabaseHelper.java @@ -30,7 +30,9 @@ import java.util.concurrent.TimeUnit; import info.nightscout.androidaps.Config; import info.nightscout.androidaps.Constants; import info.nightscout.androidaps.MainApp; +import info.nightscout.androidaps.R; import info.nightscout.androidaps.data.Profile; +import info.nightscout.androidaps.data.ProfileStore; import info.nightscout.androidaps.events.EventCareportalEventChange; import info.nightscout.androidaps.events.EventExtendedBolusChange; import info.nightscout.androidaps.events.EventFoodDatabaseChanged; @@ -43,7 +45,10 @@ import info.nightscout.androidaps.events.EventReloadTreatmentData; import info.nightscout.androidaps.events.EventTempBasalChange; import info.nightscout.androidaps.events.EventTempTargetChange; import info.nightscout.androidaps.events.EventTreatmentChange; +import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin; import info.nightscout.androidaps.plugins.IobCobCalculator.events.EventNewHistoryData; +import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification; +import info.nightscout.androidaps.plugins.Overview.notifications.Notification; import info.nightscout.androidaps.plugins.PumpDanaR.activities.DanaRNSHistorySync; import info.nightscout.androidaps.plugins.PumpVirtual.VirtualPumpPlugin; import info.nightscout.utils.PercentageSplitter; @@ -1674,6 +1679,19 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper { profileSwitch.percentage = trJson.getInt("percentage"); if (trJson.has("profileJson")) profileSwitch.profileJson = trJson.getString("profileJson"); + else { + ProfileStore store = ConfigBuilderPlugin.getActiveProfileInterface().getProfile(); + Profile profile = store.getSpecificProfile(profileSwitch.profileName); + if (profile != null) { + profileSwitch.profileJson = profile.getData().toString(); + log.debug("Profile switch prefilled with JSON from local store"); + } else { + Notification notification = new Notification(Notification.NO_LOCALE_PROFILE_FOUND, MainApp.sResources.getString(R.string.nolocaleprofilefound), Notification.URGENT); + MainApp.bus().post(new EventNewNotification(notification)); + log.debug("JSON for profile switch doesn't exist. Ignoring ..."); + return; + } + } if (trJson.has("profilePlugin")) profileSwitch.profilePlugin = trJson.getString("profilePlugin"); createOrUpdate(profileSwitch); 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 7f8b94cfa9..d32c5959e9 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 @@ -59,6 +59,7 @@ public class Notification { public static final int MINIMAL_BASAL_VALUE_REPLACED = 29; public static final int BASAL_PROFILE_NOT_ALIGNED_TO_HOURS = 30; public static final int ZERO_VALUE_IN_PROFILE = 31; + public static final int NO_LOCALE_PROFILE_FOUND = 32; public int id; public Date date; diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 8e6f6617ee..510f7cf80d 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -809,5 +809,6 @@ BG available from selected source Basal values not aligned to hours Zero value in profile + Received profile switch from NS but profile doesn\'t exist localy From 22c774830cc66f4933806ec2b4cfe4a1b5dec82a Mon Sep 17 00:00:00 2001 From: Johannes Mockenhaupt Date: Sun, 7 Jan 2018 21:26:40 +0100 Subject: [PATCH 03/10] README-Combo: add note on Quick info. --- README-Combo.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README-Combo.md b/README-Combo.md index 08ea75b271..931e1510c2 100644 --- a/README-Combo.md +++ b/README-Combo.md @@ -49,6 +49,7 @@ Setup: menus/actions on the pump and hide those which are unsupported (extended/multiwave bolus, multiple basal rates), which cause the loop functionality to be restricted when used because it's not possible to run the loop in a safe manner when used. + - Verify the _Quick Info Text_ is set to "QUICK INFO" (without the quotes, found under _Insulin Pump Options_). - Set maximum TBR to 500% - Disable end of TBR alert - Set TBR duration step-size to 15 min From e5b21ccc3e5a348a392d1993aab86992742b8653 Mon Sep 17 00:00:00 2001 From: kuchjir Date: Sun, 7 Jan 2018 22:16:08 +0100 Subject: [PATCH 04/10] added BolusWizardTest --- app/build.gradle | 4 + .../nightscout/utils/BolusWizardTest.java | 85 +++++++++++++++++++ 2 files changed, 89 insertions(+) create mode 100644 app/src/test/java/info/nightscout/utils/BolusWizardTest.java diff --git a/app/build.gradle b/app/build.gradle index 00abdd64a0..207a9831df 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -174,6 +174,10 @@ dependencies { compile 'junit:junit:4.12' testCompile 'org.json:json:20140107' testCompile 'org.mockito:mockito-core:2.7.22' + testCompile 'org.powermock:powermock-api-mockito2:1.7.3' + testCompile 'org.powermock:powermock-module-junit4-rule-agent:1.7.3' + testCompile 'org.powermock:powermock-module-junit4-rule:1.7.3' + testCompile 'org.powermock:powermock-module-junit4:1.7.3' androidTestCompile 'org.mockito:mockito-core:2.7.22' androidTestCompile 'com.google.dexmaker:dexmaker:1.2' androidTestCompile 'com.google.dexmaker:dexmaker-mockito:1.2' diff --git a/app/src/test/java/info/nightscout/utils/BolusWizardTest.java b/app/src/test/java/info/nightscout/utils/BolusWizardTest.java new file mode 100644 index 0000000000..21872f47bc --- /dev/null +++ b/app/src/test/java/info/nightscout/utils/BolusWizardTest.java @@ -0,0 +1,85 @@ +package info.nightscout.utils; + +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.powermock.api.mockito.PowerMockito; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.modules.junit4.PowerMockRunner; + +import info.nightscout.androidaps.MainApp; +import info.nightscout.androidaps.data.GlucoseStatus; +import info.nightscout.androidaps.data.IobTotal; +import info.nightscout.androidaps.data.Profile; +import info.nightscout.androidaps.db.Treatment; +import info.nightscout.androidaps.interfaces.PumpInterface; +import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin; +import info.nightscout.androidaps.plugins.PumpMDI.MDIPlugin; + +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +/** + * Created by kuchjir on 12/12/2017. + */ +@RunWith(PowerMockRunner.class) +@PrepareForTest( { MainApp.class, GlucoseStatus.class, ConfigBuilderPlugin.class }) +public class BolusWizardTest { + private static final double PUMP_BOLUS_STEP = 0.1; + + @Test + /** Should calculate the same bolus when different blood glucose but both in target range */ + public void shuldCalculateTheSameBolusWhenBGsInRange() throws Exception { + BolusWizard bw = new BolusWizard(); + Profile profile = setupProfile(4d, 8d, 20d, 12d); + + Double bolusForBg42 = bw.doCalc(profile, null, 20, 0.0,4.2, 0d, 100d, true, true, false, false); + Double bolusForBg54 = bw.doCalc(profile, null, 20, 0.0,5.4, 0d, 100d, true, true, false, false); + Assert.assertEquals(bolusForBg42, bolusForBg54); + } + + @Test + public void shuldCalculateHigherBolusWhenHighBG() throws Exception { + BolusWizard bw = new BolusWizard(); + Profile profile = setupProfile(4d, 8d, 20d, 12d); + + Double bolusForHighBg = bw.doCalc(profile, null, 20, 0d,9.8, 0d, 100d, true, true, false, false); + Double bolusForBgInRange = bw.doCalc(profile, null, 20, 0.0,5.4, 0d, 100d, true, true, false, false); + Assert.assertTrue(bolusForHighBg > bolusForBgInRange); + } + + @Test + public void shuldCalculateLowerBolusWhenLowBG() throws Exception { + BolusWizard bw = new BolusWizard(); + Profile profile = setupProfile(4d, 8d, 20d, 12d); + + Double bolusForLowBg = bw.doCalc(profile, null, 20, 0d,3.6, 0d, 100d, true, true, false, false); + Double bolusForBgInRange = bw.doCalc(profile, null, 20, 0.0,5.4, 0d, 100d, true, true, false, false); + Assert.assertTrue(bolusForLowBg < bolusForBgInRange); + } + + private Profile setupProfile(Double targetLow, Double targetHigh, Double insulinSensitivityFactor, Double insulinToCarbRatio) { + Profile profile = mock(Profile.class); + when(profile.getTargetLow()).thenReturn(targetLow); + when(profile.getTargetHigh()).thenReturn(targetHigh); + when(profile.getIsf()).thenReturn(insulinSensitivityFactor); + when(profile.getIc()).thenReturn(insulinToCarbRatio); + + PowerMockito.mockStatic(GlucoseStatus.class); + when(GlucoseStatus.getGlucoseStatusData()).thenReturn(null); + + ConfigBuilderPlugin treatment = mock(ConfigBuilderPlugin.class); + IobTotal iobTotalZero = new IobTotal(System.currentTimeMillis()); + when(treatment.getLastCalculationTreatments()).thenReturn(iobTotalZero); + when(treatment.getLastCalculationTempBasals()).thenReturn(iobTotalZero); + PowerMockito.mockStatic(MainApp.class); + when(MainApp.getConfigBuilder()).thenReturn(treatment); + + PowerMockito.mockStatic(ConfigBuilderPlugin.class); + PumpInterface pump = MDIPlugin.getPlugin(); + pump.getPumpDescription().bolusStep = PUMP_BOLUS_STEP; + when(ConfigBuilderPlugin.getActivePump()).thenReturn(pump); + + return profile; + } +} \ No newline at end of file From d7dfe8942eb872a2ee9f66f091d8cc02ed687066 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Mon, 8 Jan 2018 14:27:27 +0100 Subject: [PATCH 05/10] prevent basal updated messages on virtual pump --- .../androidaps/plugins/PumpVirtual/VirtualPumpPlugin.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpVirtual/VirtualPumpPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpVirtual/VirtualPumpPlugin.java index 7c777a5652..cb05517cfc 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpVirtual/VirtualPumpPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpVirtual/VirtualPumpPlugin.java @@ -227,7 +227,7 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface { @Override public boolean isThisProfileSet(Profile profile) { - return false; + return true; } @Override From ba8dd8c3c6f7c26533e3bb2a7fd341b84caf32c7 Mon Sep 17 00:00:00 2001 From: Savek-CC Date: Mon, 8 Jan 2018 21:20:04 +0100 Subject: [PATCH 06/10] Update README-Combo.md Android 8.1 is also supported --- README-Combo.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README-Combo.md b/README-Combo.md index 931e1510c2..86ad5a73b2 100644 --- a/README-Combo.md +++ b/README-Combo.md @@ -11,7 +11,7 @@ Hardware requirements: Software to configure the pump. Roche sends out Smartpix devices and the configuration software free of charge to their customers upon request. -- A compatible phone: An Android phone with a phone running LineageOS 14.1 (formerly CyanogenMod) +- A compatible phone: An Android phone with a phone running LineageOS 14.1 (formerly CyanogenMod) or Android 8.1 (Oreo) - To build AndroidAPS with Combo support you need the latest Android Studio 3 version Limitations: From bdd1a85d26c014d50d8d3d6336993562583eac34 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Tue, 9 Jan 2018 19:44:42 +0100 Subject: [PATCH 07/10] fix canceling temp in open loop mode. credits to @warstar2187 --- .../androidaps/plugins/OpenAPSAMA/OpenAPSAMAPlugin.java | 6 ++++-- .../androidaps/plugins/OpenAPSMA/OpenAPSMAPlugin.java | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSAMA/OpenAPSAMAPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSAMA/OpenAPSAMAPlugin.java index 4dcb174209..4c14f33533 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSAMA/OpenAPSAMAPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSAMA/OpenAPSAMAPlugin.java @@ -248,9 +248,11 @@ public class OpenAPSAMAPlugin implements PluginBase, APSInterface { determineBasalResultAMA.changeRequested = false; // limit requests on openloop mode if (!MainApp.getConfigBuilder().isClosedModeEnabled()) { - if (MainApp.getConfigBuilder().isTempBasalInProgress() && Math.abs(determineBasalResultAMA.rate - MainApp.getConfigBuilder().getTempBasalAbsoluteRateHistory()) < 0.1) + if (MainApp.getConfigBuilder().isTempBasalInProgress() && determineBasalResultAMA.rate == 0 && determineBasalResultAMA.duration == 0) { + // going to cancel + } else if (MainApp.getConfigBuilder().isTempBasalInProgress() && Math.abs(determineBasalResultAMA.rate - MainApp.getConfigBuilder().getTempBasalAbsoluteRateHistory()) < 0.1) { determineBasalResultAMA.changeRequested = false; - if (!MainApp.getConfigBuilder().isTempBasalInProgress() && Math.abs(determineBasalResultAMA.rate - ConfigBuilderPlugin.getActivePump().getBaseBasalRate()) < 0.1) + } else if (!MainApp.getConfigBuilder().isTempBasalInProgress() && Math.abs(determineBasalResultAMA.rate - ConfigBuilderPlugin.getActivePump().getBaseBasalRate()) < 0.1) determineBasalResultAMA.changeRequested = false; } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSMA/OpenAPSMAPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSMA/OpenAPSMAPlugin.java index ac360d4ec8..d56dc44b89 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSMA/OpenAPSMAPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSMA/OpenAPSMAPlugin.java @@ -232,9 +232,11 @@ public class OpenAPSMAPlugin implements PluginBase, APSInterface { determineBasalResultMA.changeRequested = false; // limit requests on openloop mode if (!MainApp.getConfigBuilder().isClosedModeEnabled()) { - if (MainApp.getConfigBuilder().isTempBasalInProgress() && Math.abs(determineBasalResultMA.rate - MainApp.getConfigBuilder().getTempBasalAbsoluteRateHistory()) < 0.1) + if (MainApp.getConfigBuilder().isTempBasalInProgress() && determineBasalResultMA.rate == 0 && determineBasalResultMA.duration == 0) { + // going to cancel + } else if (MainApp.getConfigBuilder().isTempBasalInProgress() && Math.abs(determineBasalResultMA.rate - MainApp.getConfigBuilder().getTempBasalAbsoluteRateHistory()) < 0.1) { determineBasalResultMA.changeRequested = false; - if (!MainApp.getConfigBuilder().isTempBasalInProgress() && Math.abs(determineBasalResultMA.rate - ConfigBuilderPlugin.getActivePump().getBaseBasalRate()) < 0.1) + } else if (!MainApp.getConfigBuilder().isTempBasalInProgress() && Math.abs(determineBasalResultMA.rate - ConfigBuilderPlugin.getActivePump().getBaseBasalRate()) < 0.1) determineBasalResultMA.changeRequested = false; } From 2df19b85a55d18ed3a7f6a009fbe46f04c20a9ca Mon Sep 17 00:00:00 2001 From: Simon Pauwels Date: Tue, 9 Jan 2018 21:16:37 +0100 Subject: [PATCH 08/10] typo and added dutch translations --- app/src/main/res/values-nl/strings.xml | 101 +++++++++++++++++++++---- 1 file changed, 85 insertions(+), 16 deletions(-) diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index a9151cde59..6c49e4fb4c 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -1,6 +1,5 @@ - AndroidAPS Glimp MM640g Absoluut @@ -13,7 +12,7 @@ Volwassene Uitgebreide instellingen Herstart je telefoon of herstart AndroidAPS vanuit de systeem instellingen a.u.b. anders zal AndroidAPS geen logboek hebben (Belangrijk om te controleren of de algoritmes correct werken)! - Nuttig wanneer gevens van niet gefilterde bronnes zoals Xdrip wispelturig zijn + Nuttig wanneer gegevens van niet gedempte bronnen zoals Xdrip wispelturig zijn AndroidAPS gestart Insuline daglimiet bereikt APS Mode @@ -40,17 +39,17 @@ VIRTUELE POMP Toon Upload status naar NS - Tijdelijk basaal + Tijdelijk basaal SQL Storing VP Virtuele pomp instellingen OK - Reservoir - Laatste verbinding + Reservoir + Laatste verbinding Firmware EXT Vertraagde bolus - Batterij + Batterij Virtuele Pomp Uploaden UPLD @@ -92,7 +91,7 @@ CGM & OPENAPS CGM Sens. ingebracht CGM Sens. Start - Multiwave bolus + Multiwave bolus Correctie bolus Sport Ouderdom insuline @@ -175,7 +174,7 @@ Activeer vertraagde bolussen op de pomp Storing glucose - Geschiedenis + Historiek Alarm Herstart Resultaat @@ -275,7 +274,7 @@ OpenAPS OAPS OpenAPS AMA - Laatste bolus + Laatste bolus Pomp wachtwoord DanaR pomp instellingen Hervullen @@ -454,7 +453,7 @@ Maximaal basaal IOB OpenAPS kan toedienen [E] Profiel Waarde %s is buiten de toegestane limieten - Basis basale dosis + Basis basale dosis Laatse berekening Laatste uitvoering Glucose gegevens @@ -462,7 +461,6 @@ Berekende gegevens IOB gegevens DIt is de maximale waarde waarop het basaal door OpenAPS ingesteld kan worden - Profiel wissel NS Profiel NSPROFIEL Pomp @@ -510,9 +508,9 @@ Verwijder Wijzig Home - Geldigheid: + Beschikbaarheid: Koolhydraten: - Knop tekst: + Naam: Kalibratie Bolus wizard E bolus @@ -566,7 +564,7 @@ DOEL Afsluiting Lopende berichten - Opene instellingen op Wear + Open instellingen op Wear Maximale E/u dat OpenAPS kan toedienen Verschil instellingen Bereik voor visualisatie @@ -592,8 +590,8 @@ Pomp uitschakelen Pomp onderbreken Pomp onderbroken. Klik om de status te vernieuwen - Instelassisten - Instelassistent instellingen + Vaste maaltijd + Vaste maaltijd instellingen SEN Verwijder gegeven: Verzend alle gegevens opnieuw @@ -679,4 +677,75 @@ Bedieningen via horloge Ampull leeg Wachten op koppelen van de pomp + Storingen + Wijzigingen van profiel + Bluetooth + Voeding + Waarschuwing bij niet bereikbare pomp + Een bolus met dezelfde hoeveelheid was gevraagd binnen de minuut. Om accidentiële of door bugs veroorzaakte dubbele bolussen te vermijden is deze bolus geannuleerd + estopt Bolus toediening wordt + Vet + Bolus toediening gestopt + Gebruik systeem notificaties voor waarschuwingen + Toon gedetaillieerde delta + Niet ondersteune pomp firmware + DexcomG5 App (aangepast) + g + kJ + En + Prot + INFO + BT Watchdog + Desactiveert de bluetooth functie van de telefoon gedurende een ogenblik. Dit kan op sommige gsm\'s een vastgelopen bluetooth service verhelpen. + Geen BG metingen + Uitvoeren van gebeurtenis + Pomp niet beschikbaar + Pomp niet beschikbaar sinds [min] + Pomp service gecorrigeerd + Lokaal gegenereerde waarschuwingen + Bolus toediening gestart + Toon delta met eenextra decimaal punt + Wacht op complete bolus toediening Resterend %d sec. + Dringend alarm + TT + Gebruik systeem notficaties voor waarchuwingen en notificaties + Opdracht is nu uitgevoerd + Alarm als er geen BG gegevens ontvangen zijn + Aangepaste APK downloaden + Upload BG gegevens naar NS + G5 Upload instellingen + Loop Actief + Ja + Nee + In xDrip+ kies 640g/Eversense data bron + NSClient BG + Basaal IOB meerekenen + APS geslecteerd + Stuur BG data naar xDrip+ + Basale waarde vervangen door minimaal ondersteunde waarde + Tijdelijk doel berekenen + Superbolus berekening + NSClient heeft schrijf rechten + Activeren van extra functies tijdes de dag zoals SMB + BG meerekenen + Bolus IOB meerekenen + Closed modus actief + COB berekening + ]]> + ]]> + AndroidAPS + Nul waarde in basaal profiel + BG beschikbaar op gekozen bron + Enkel positief + Enkel negatief + Maximum IOB juist ingesteld + Basis basaal patroon + Tijdelijk basaal + Batterij + Reservoir + Multiwave bolus + Laatste bolus: + Laatste verbinding + Trend berekening + Profiel wiissel ontvangen via NS maar dit profiel bestaat niet op gsm From 9ece407f32bfa3a8c9b1f26ac83d87e97258c89e Mon Sep 17 00:00:00 2001 From: Johannes Mockenhaupt Date: Wed, 10 Jan 2018 11:33:30 +0100 Subject: [PATCH 09/10] Integrate dutch translation with Combo changes. The lesson to learn here: don't rename string resources in a long- running branch, but do it after the merge. Note that Multiwave is a Combo-specific term, the more general term to describe the combination of a bolus and an extended bolus is combo bolus, ironically and confusingly ;-) --- app/src/main/res/values-nl/strings.xml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index 6c49e4fb4c..f819247fb0 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -91,7 +91,6 @@ CGM & OPENAPS CGM Sens. ingebracht CGM Sens. Start - Multiwave bolus Correctie bolus Sport Ouderdom insuline @@ -739,13 +738,6 @@ Enkel positief Enkel negatief Maximum IOB juist ingesteld - Basis basaal patroon - Tijdelijk basaal - Batterij - Reservoir - Multiwave bolus - Laatste bolus: - Laatste verbinding Trend berekening Profiel wiissel ontvangen via NS maar dit profiel bestaat niet op gsm From b4998feee11d63418ed1ce288eed7a820529e723 Mon Sep 17 00:00:00 2001 From: Johannes Mockenhaupt Date: Wed, 10 Jan 2018 15:04:38 +0100 Subject: [PATCH 10/10] Disable reading reservoir level units. --- .../plugins/PumpCombo/ComboFragment.java | 6 ++--- .../plugins/PumpCombo/ComboPlugin.java | 22 +++++++------------ .../plugins/PumpCombo/ComboPump.java | 1 - app/src/main/res/values-de/strings.xml | 1 - app/src/main/res/values/strings.xml | 1 - 5 files changed, 11 insertions(+), 20 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboFragment.java index 7b72ee5d04..506bce7be5 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboFragment.java @@ -172,17 +172,17 @@ public class ComboFragment extends SubscriberFragment implements View.OnClickLis } // reservoir - int reservoirLevel = plugin.getPump().reservoirLevel; - reservoirView.setText(reservoirLevel == -1 ? "" : "" + reservoirLevel + " " - + MainApp.sResources.getString(R.string.treatments_wizard_unit_label)); if (ps.insulinState == PumpState.LOW) { reservoirView.setTextColor(Color.YELLOW); + reservoirView.setText(R.string.combo_reservoir_low); reservoirView.setTypeface(null, Typeface.BOLD); } else if (ps.insulinState == PumpState.EMPTY) { reservoirView.setTextColor(Color.RED); + reservoirView.setText(R.string.combo_reservoir_empty); reservoirView.setTypeface(null, Typeface.BOLD); } else { reservoirView.setTextColor(Color.WHITE); + reservoirView.setText(R.string.combo_reservoir_normal); reservoirView.setTypeface(null, Typeface.NORMAL); } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboPlugin.java index 93b2e0af8c..bc27a3ebbc 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboPlugin.java @@ -339,7 +339,7 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf if (!pump.initialized) { initializePump(); } else { - runCommand(MainApp.sResources.getString(R.string.combo_pump_action_refreshing), 1, ruffyScripter::readReservoirLevelAndLastBolus); + runCommand(MainApp.sResources.getString(R.string.combo_pump_action_refreshing), 1, ruffyScripter::readPumpState); } } @@ -379,13 +379,10 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf MainApp.bus().post(new EventInitializationChanged()); // ComboFragment updates state fully only after the pump has initialized, so run this manually here - updateLocalData(runCommand(null, 1, ruffyScripter::readReservoirLevelAndLastBolus)); + updateLocalData(readBasalResult); } private void updateLocalData(CommandResult result) { - if (result.reservoirLevel != PumpState.UNKNOWN) { - pump.reservoirLevel = result.reservoirLevel; - } if (result.state.menu != null) { pump.state = result.state; } @@ -470,18 +467,13 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf } lastRequestedBolus = new Bolus(System.currentTimeMillis(), detailedBolusInfo.insulin, true); - CommandResult stateResult = runCommand(null, 1, ruffyScripter::readReservoirLevelAndLastBolus); + CommandResult stateResult = runCommand(null, 1, ruffyScripter::readPumpState); long pumpTimeWhenBolusWasRequested = stateResult .state.pumpTime; if (!stateResult.success || pumpTimeWhenBolusWasRequested == 0) { return new PumpEnactResult().success(false).enacted(false) .comment(MainApp.sResources.getString(R.string.combo_error_no_bolus_delivered)); } - if (stateResult.reservoirLevel < detailedBolusInfo.insulin) { - return new PumpEnactResult().success(false).enacted(false) - .comment(MainApp.sResources.getString(R.string.combo_reservoir_level_insufficient_for_bolus)); - } - try { pump.activity = MainApp.sResources.getString(R.string.combo_pump_action_bolusing, detailedBolusInfo.insulin); MainApp.bus().post(new EventComboPumpUpdateGUI()); @@ -1034,9 +1026,11 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf try { JSONObject pumpJson = new JSONObject(); pumpJson.put("clock", DateUtil.toISOString(pump.lastSuccessfulCmdTime)); - if (pump.reservoirLevel != -1) { - pumpJson.put("reservoir", pump.reservoirLevel); - } + + int level = 150; + if (pump.state.insulinState == PumpState.LOW) level = 8; + else if (pump.state.insulinState == PumpState.EMPTY) level = 0; + pumpJson.put("reservoir", level); JSONObject statusJson = new JSONObject(); statusJson.put("status", getStateSummary()); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboPump.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboPump.java index 0455fa3ada..5980cf11eb 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboPump.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpCombo/ComboPump.java @@ -17,7 +17,6 @@ class ComboPump { public volatile String activity; @NonNull volatile PumpState state = new PumpState(); - volatile int reservoirLevel = -1; @NonNull volatile BasalProfile basalProfile = new BasalProfile(); diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 9438e06d19..8edea19afe 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -778,5 +778,4 @@ Standarwert: 2\nBolus snooze (\"Bolus-Schlummer\") bremst den Loop nach einem Mahleiten-Bolus, damit dieser nicht mit niedrigen TBR reagiert, wenn Du gerade gegessen hast. Beispiel: Der Standardwert 2 bewirkt, dass bei einem 3 Stunden DIA der Bolus snooze während 1.5 Stunden nach dem Bolus linear ausläuft (3 h Dia / 2 = 1.5 h Bolus snooze). Standardwert: 3.0\nDies ist eine Einstellung für die Standard-Kohlenhydrat-Absorptionswirkung pro 5 Minuten. Der Standardwert ist 3mg/dl/5min. Dies wirkt sich darauf aus, wie schnell der COB-Wert fällt und wieviel KH-Absorption bei der Berechnung des vorhergesagten BZ angenommen wird, wenn der BZ stärker als erwartet fällt oder nicht so stark wie erwartet steigt. Achtung! Normalerweise musst Du diese Werte nicht ändern. Bitte KLICKE HIER und LESE den Text. Verändere Werte erst, wenn Du den Inhalt des Textes verstanden hast. - Nicht mehr genug Insulin im Reservoir für den Bolus diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 5cfb588165..100d35e2d4 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -865,6 +865,5 @@ Only %.2f U of the requested bolus of %.2f U was delivered due to an error. Please check the pump to verify this and take appropriate actions. Delivering the bolus and verifying the pump\'s history failed, please check the pump and manually create a bolus record using the Careportal tab if a bolus was delivered. Recovering from connection loss - Not enough insulin left in reservoir for bolus