From c73829faa83919abed915406b16b16079497515e Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Mon, 11 Sep 2023 22:37:52 +0200 Subject: [PATCH] DynISF: notify about fallback to SMB --- .../plugins/aps/openAPSSMB/OpenAPSSMBPlugin.kt | 12 ++++++++++++ plugins/aps/src/main/res/values/strings.xml | 1 + 2 files changed, 13 insertions(+) diff --git a/plugins/aps/src/main/java/info/nightscout/plugins/aps/openAPSSMB/OpenAPSSMBPlugin.kt b/plugins/aps/src/main/java/info/nightscout/plugins/aps/openAPSSMB/OpenAPSSMBPlugin.kt index bb75f3bbd9..5d528e4b5d 100644 --- a/plugins/aps/src/main/java/info/nightscout/plugins/aps/openAPSSMB/OpenAPSSMBPlugin.kt +++ b/plugins/aps/src/main/java/info/nightscout/plugins/aps/openAPSSMB/OpenAPSSMBPlugin.kt @@ -237,6 +237,18 @@ open class OpenAPSSMBPlugin @Inject constructor( tddLast4H = tddCalculator.calculateDaily(-4, 0)?.totalAmount tddLast8to4H = tddCalculator.calculateDaily(-8, -4)?.totalAmount + if (tdd1D == null || tdd7D == null || tddLast4H == null || tddLast8to4H == null || tddLast24H == null) { + inputConstraints.copyReasons( + Constraint(false).also { + it.set(aapsLogger, false, rh.gs(R.string.fallback_smb_no_tdd), this) + } + ) + inputConstraints.copyReasons( + Constraint(false).apply { set(aapsLogger, true, "tdd1D=$tdd1D tdd7D=$tdd7D tddLast4H=$tddLast4H tddLast8to4H=$tddLast8to4H tddLast24H=$tddLast24H", this) } + ) + } + + provideDetermineBasalAdapter().also { determineBasalAdapterSMBJS -> determineBasalAdapterSMBJS.setData( profile, maxIob, maxBasal, minBg, maxBg, targetBg, diff --git a/plugins/aps/src/main/res/values/strings.xml b/plugins/aps/src/main/res/values/strings.xml index a88752d080..12ccc60a33 100644 --- a/plugins/aps/src/main/res/values/strings.xml +++ b/plugins/aps/src/main/res/values/strings.xml @@ -148,6 +148,7 @@ SMB set by pump Minimal request change [%] Open Loop will popup new change request only if change is bigger than this value in %. Default value is 20% + Fallback to SMB. Not enough TDD data. \ No newline at end of file