From 4f41890add4b00dca59abffee5edad8068840c78 Mon Sep 17 00:00:00 2001 From: Philoul Date: Sat, 23 May 2020 16:30:03 +0200 Subject: [PATCH] Add additionnal setting for automated deliveries and add both in pumpcontrol pref - previous setting is for manual bolus and extended bolus - This new setting is for SMB and temp basal with TBR emulation You can change settings name and summary if you find better... --- .../plugins/pump/insight/LocalInsightPlugin.java | 11 ++++++----- app/src/main/res/values/strings.xml | 8 ++++++-- app/src/main/res/xml/pref_insight_local_full.xml | 8 +++++++- .../main/res/xml/pref_insight_local_pumpcontrol.xml | 12 ++++++++++++ 4 files changed, 31 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/insight/LocalInsightPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/insight/LocalInsightPlugin.java index 51c6337df1..1b4e537f0c 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/insight/LocalInsightPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/insight/LocalInsightPlugin.java @@ -597,7 +597,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements PumpInterface, bolusMessage.setDuration(0); bolusMessage.setExtendedAmount(0); bolusMessage.setImmediateAmount(insulin); - bolusMessage.setVibration(sp.getBoolean("insight_disable_vibration",false)); + bolusMessage.setVibration(sp.getBoolean(detailedBolusInfo.isSMB ? R.string.key_disable_vibration_auto : R.string.key_disable_vibration ,false)); bolusID = connectionService.requestMessage(bolusMessage).await().getBolusId(); bolusCancelled = false; } @@ -721,7 +721,8 @@ public class LocalInsightPlugin extends PumpPluginBase implements PumpInterface, PumpEnactResult cancelTBRResult = cancelTempBasalOnly(); if (cancelTBRResult.success) { PumpEnactResult ebResult = setExtendedBolusOnly((absoluteRate - getBaseBasalRate()) / 60D - * ((double) durationInMinutes), durationInMinutes); + * ((double) durationInMinutes), durationInMinutes, + sp.getBoolean(R.string.key_disable_vibration_auto,false)); if (ebResult.success) { result.success = true; result.enacted = true; @@ -799,7 +800,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements PumpInterface, @NonNull @Override public PumpEnactResult setExtendedBolus(Double insulin, Integer durationInMinutes) { PumpEnactResult result = cancelExtendedBolusOnly(); - if (result.success) result = setExtendedBolusOnly(insulin, durationInMinutes); + if (result.success) result = setExtendedBolusOnly(insulin, durationInMinutes, sp.getBoolean(R.string.key_disable_vibration,false)); try { fetchStatus(); readHistory(); @@ -813,7 +814,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements PumpInterface, return result; } - public PumpEnactResult setExtendedBolusOnly(Double insulin, Integer durationInMinutes) { + public PumpEnactResult setExtendedBolusOnly(Double insulin, Integer durationInMinutes, boolean disableVibration) { PumpEnactResult result = new PumpEnactResult(getInjector()); try { DeliverBolusMessage bolusMessage = new DeliverBolusMessage(); @@ -821,7 +822,7 @@ public class LocalInsightPlugin extends PumpPluginBase implements PumpInterface, bolusMessage.setDuration(durationInMinutes); bolusMessage.setExtendedAmount(insulin); bolusMessage.setImmediateAmount(0); - bolusMessage.setVibration(sp.getBoolean("insight_disable_vibration",false)); + bolusMessage.setVibration(disableVibration); int bolusID = connectionService.requestMessage(bolusMessage).await().getBolusId(); InsightBolusID insightBolusID = new InsightBolusID(); insightBolusID.bolusID = bolusID; diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 8033c82057..c9530266e8 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1016,8 +1016,12 @@ Log alerts Enable TBR emulation Use extended boluses instead of TBRs to bypass the 250%% limit - Disable vibrations on bolus delivery - This setting is only available with Insight firmware 3.x + insight_disable_vibration + Disable vibrations on manual bolus delivery + For bolus and extended bolus (only available with Insight firmware 3.x) + insight_disable_vibration_auto + Disable vibrations on automated bolus delivery + For SMB and Temp Basal with TBR emulation (only available with Insight firmware 3.x) Disconnect delay [s] Serial number Release software version diff --git a/app/src/main/res/xml/pref_insight_local_full.xml b/app/src/main/res/xml/pref_insight_local_full.xml index 761016b287..820c12d422 100644 --- a/app/src/main/res/xml/pref_insight_local_full.xml +++ b/app/src/main/res/xml/pref_insight_local_full.xml @@ -50,10 +50,16 @@ + + + + + +