From dfb78f5f89ea5ee3aeea71a70527b335ffaa6b04 Mon Sep 17 00:00:00 2001 From: Johannes Mockenhaupt Date: Fri, 19 Jan 2018 13:56:24 +0100 Subject: [PATCH] Commands: only check inputs for sanity, not therapy limits. Updated README to ask the user to configure the pump to enforce limits and only make sure inputs to the command are sane since there's no facility in place to report errors back, which is fine given this proactively guards against bugs, not a valid usage scenario. (cherry picked from commit 033ace4) --- README-Combo.md | 3 +++ .../java/de/jotomo/ruffyscripter/commands/BolusCommand.java | 4 ++-- .../java/de/jotomo/ruffyscripter/commands/SetTbrCommand.java | 4 ---- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/README-Combo.md b/README-Combo.md index a13f5af94c..aa3d4baf21 100644 --- a/README-Combo.md +++ b/README-Combo.md @@ -57,6 +57,9 @@ Setup: - Disable end of TBR alert - Set TBR duration step-size to 15 min - Set low cartridge alarm to your liking + - Configure a max bolus suited for your therapy to protect against bugs in the software + - Similarly, configure maximum TBR duration as a safeguard. Allow at least 3 hours, since + the option to disconnect the pump for 3 hours sets a 0% for 3 hours. - Enable keylock (can also be set on the pump directly, see usage section on reasoning) - Get Android Studio 3 https://developer.android.com/studio/index.html - Follow the link http://ruffy.AndroidAPS.org and clone via git (branch `combo-scripter-v2`) diff --git a/ruffyscripter/src/main/java/de/jotomo/ruffyscripter/commands/BolusCommand.java b/ruffyscripter/src/main/java/de/jotomo/ruffyscripter/commands/BolusCommand.java index a3ed3006e2..379e977bf8 100644 --- a/ruffyscripter/src/main/java/de/jotomo/ruffyscripter/commands/BolusCommand.java +++ b/ruffyscripter/src/main/java/de/jotomo/ruffyscripter/commands/BolusCommand.java @@ -39,8 +39,8 @@ public class BolusCommand extends BaseCommand { public List validateArguments() { List violations = new ArrayList<>(); - if (bolus <= 0 || bolus > 25) { - violations.add("Requested bolus " + bolus + " out of limits (0-25)"); + if (bolus <= 0) { + violations.add("Requested bolus non-positive: " + bolus); } return violations; diff --git a/ruffyscripter/src/main/java/de/jotomo/ruffyscripter/commands/SetTbrCommand.java b/ruffyscripter/src/main/java/de/jotomo/ruffyscripter/commands/SetTbrCommand.java index 975eb0f50d..f3bfb87313 100644 --- a/ruffyscripter/src/main/java/de/jotomo/ruffyscripter/commands/SetTbrCommand.java +++ b/ruffyscripter/src/main/java/de/jotomo/ruffyscripter/commands/SetTbrCommand.java @@ -47,10 +47,6 @@ public class SetTbrCommand extends BaseCommand { } } - if (percentage == 0 && duration > 180) { - violations.add("Max allowed zero-temp duration is 3h"); - } - return violations; }