From 7c04f528cc94e0e8315ff30abbeb90aedac1d893 Mon Sep 17 00:00:00 2001 From: Johannes Mockenhaupt Date: Wed, 20 Dec 2017 18:03:21 +0100 Subject: [PATCH] Revert "Handle edge case of setting basal rate in range 0.00 - 0.05." This reverts commit 2054e76cde491c4d0d0197983aa734e065e94938. --- README-Combo.md | 2 -- .../plugins/PumpCombo/ComboPlugin.java | 4 ---- .../de/jotomo/ruffyscripter/RuffyScripter.java | 2 +- .../commands/SetBasalProfileCommand.java | 16 ++++------------ 4 files changed, 5 insertions(+), 19 deletions(-) diff --git a/README-Combo.md b/README-Combo.md index ced0a5e726..b4c42f30aa 100644 --- a/README-Combo.md +++ b/README-Combo.md @@ -39,8 +39,6 @@ Limitations: pump solely through AAPS. Checking history, reservoir level etc on the pump causes no issues but should be avoided when the Bluetooth icon is displayed on the display, indicating that AAPS is communicating with the pump. -- Setting basal rates where U/h exceeds 10 are currently not supported. Values between 0.01 to 0.04 are rounded - to 0.05, values above have a granularity of 0.05 and values above 1.00 have a granularity of 0.10. Setup: - Configure pump using 360 config software. 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 d79b2737c9..3df159b876 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 @@ -81,10 +81,6 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf pumpDescription.isSetBasalProfileCapable = true; - // this applies to range >= 0.05 U/h && < 1.00 U/h, - // above 1.00 U/h step size is 0.05, - // above 10 U/h, step size is 0.1, - // the smallest non-zero amount is 0.05 U/h, so 0.00 U/h jumps to 0.05 U/h during input pumpDescription.basalStep = 0.01d; pumpDescription.basalMinimumRate = 0.0d; diff --git a/ruffyscripter/src/main/java/de/jotomo/ruffyscripter/RuffyScripter.java b/ruffyscripter/src/main/java/de/jotomo/ruffyscripter/RuffyScripter.java index 5ca23cee05..18604cb7b6 100644 --- a/ruffyscripter/src/main/java/de/jotomo/ruffyscripter/RuffyScripter.java +++ b/ruffyscripter/src/main/java/de/jotomo/ruffyscripter/RuffyScripter.java @@ -283,7 +283,7 @@ public class RuffyScripter implements RuffyCommands { // the disconnected and then return the command as failed (the caller // can retry if needed). log.debug("Connection unusable (ruffy connection: " + ruffyService.isConnected() + ", " - + "time since last menu update: " + (System.currentTimeMillis() - menuLastUpdated) + " ms), " + + "time since last menu update: " + (System.currentTimeMillis() - menuLastUpdated) + " ms, " + "aborting command and attempting reconnect ..."); cmdThread.interrupt(); activeCmd.getResult().success = false; diff --git a/ruffyscripter/src/main/java/de/jotomo/ruffyscripter/commands/SetBasalProfileCommand.java b/ruffyscripter/src/main/java/de/jotomo/ruffyscripter/commands/SetBasalProfileCommand.java index 61114246b8..a5e42014b6 100644 --- a/ruffyscripter/src/main/java/de/jotomo/ruffyscripter/commands/SetBasalProfileCommand.java +++ b/ruffyscripter/src/main/java/de/jotomo/ruffyscripter/commands/SetBasalProfileCommand.java @@ -30,7 +30,6 @@ public class SetBasalProfileCommand extends BaseCommand { scripter.verifyMenuIsDisplayed(MenuType.BASAL_1_MENU); scripter.pressCheckKey(); - Double requestedTotal = 0d; // summary screen is shown; press menu to page through hours, wraps around to summary; scripter.verifyMenuIsDisplayed(MenuType.BASAL_TOTAL); for (int i = 0; i < 24; i++) { @@ -44,11 +43,6 @@ public class SetBasalProfileCommand extends BaseCommand { scripter.verifyMenuIsDisplayed(MenuType.BASAL_SET); double requestedRate = basalProfile.hourlyRates[i]; - if (requestedRate > 0 && requestedRate < 0.05) { - log.debug("rounding requested rate of " + requestedRate + " to supported value 0.05"); - requestedRate = 0.05; - } - requestedTotal += requestedRate; long change = inputBasalRate(requestedRate); if (change != 0) { verifyDisplayedRate(requestedRate, change); @@ -63,6 +57,10 @@ public class SetBasalProfileCommand extends BaseCommand { // check total basal total on pump matches requested total Double pumpTotal = (Double) scripter.getCurrentMenu().getAttribute(MenuAttribute.BASAL_TOTAL); + Double requestedTotal = 0d; + for (int i = 0; i < 24; i++) { + requestedTotal += basalProfile.hourlyRates[i]; + } if (Math.abs(pumpTotal - requestedTotal) > 0.001) { throw new CommandException("Basal total of " + pumpTotal + " differs from requested total of " + requestedTotal); } @@ -77,17 +75,11 @@ public class SetBasalProfileCommand extends BaseCommand { private long inputBasalRate(double requestedRate) { double currentRate = scripter.readBlinkingValue(Double.class, MenuAttribute.BASAL_RATE); log.debug("Current rate: " + currentRate + ", requested: " + requestedRate); - // the pump changes steps size from 0.01 to 0.05 when crossing 1.00 U long steps = stepsToOne(currentRate) - stepsToOne(requestedRate); if (steps == 0) { return 0; } - - // edge case: 0.00 to 0.05 (or back) is one step, not 5. - if (currentRate == 0 && requestedRate > 0) steps -= 4; - else if (currentRate > 0 && requestedRate == 0) steps += 4; - log.debug("Pressing " + (steps > 0 ? "up" : "down") + " " + Math.abs(steps) + " times"); for (int i = 0; i < Math.abs(steps); i++) { scripter.verifyMenuIsDisplayed(MenuType.BASAL_SET);