From e68d2d080d0abff1877299c1563578b020f4952d Mon Sep 17 00:00:00 2001 From: Philoul Date: Mon, 18 Oct 2021 19:59:24 +0200 Subject: [PATCH 1/3] Fix #746 --- .../androidaps/plugins/general/wear/ActionStringHandler.kt | 5 ----- 1 file changed, 5 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/ActionStringHandler.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/ActionStringHandler.kt index 7708c382b8..72bcab6b7b 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/ActionStringHandler.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/ActionStringHandler.kt @@ -507,11 +507,6 @@ class ActionStringHandler @Inject constructor( val duration = SafeParse.stringToInt(act[2]) var low = SafeParse.stringToDouble(act[3]) var high = SafeParse.stringToDouble(act[4]) - val isMGDL = java.lang.Boolean.parseBoolean(act[1]) - if (!isMGDL) { - low *= Constants.MMOLL_TO_MGDL - high *= Constants.MMOLL_TO_MGDL - } generateTempTarget(duration, low, high) } else if ("wizard2" == act[0]) { if (lastBolusWizard != null) { //use last calculation as confirmed string matches From 9db587269a8df04834670f1dde154a5e5f42c279 Mon Sep 17 00:00:00 2001 From: Philoul Date: Mon, 18 Oct 2021 20:17:52 +0200 Subject: [PATCH 2/3] Remove second one finally to be consistent with master 2.8.2 --- .../plugins/general/wear/ActionStringHandler.kt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/ActionStringHandler.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/ActionStringHandler.kt index 72bcab6b7b..adaa43e8c9 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/ActionStringHandler.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/ActionStringHandler.kt @@ -507,6 +507,11 @@ class ActionStringHandler @Inject constructor( val duration = SafeParse.stringToInt(act[2]) var low = SafeParse.stringToDouble(act[3]) var high = SafeParse.stringToDouble(act[4]) + val isMGDL = java.lang.Boolean.parseBoolean(act[1]) + if (!isMGDL) { + low *= Constants.MMOLL_TO_MGDL + high *= Constants.MMOLL_TO_MGDL + } generateTempTarget(duration, low, high) } else if ("wizard2" == act[0]) { if (lastBolusWizard != null) { //use last calculation as confirmed string matches @@ -571,8 +576,8 @@ class ActionStringHandler @Inject constructor( timestamp = System.currentTimeMillis(), duration = TimeUnit.MINUTES.toMillis(duration.toLong()), reason = TemporaryTarget.Reason.WEAR, - lowTarget = Profile.toMgdl(low, profileFunction.getUnits()), - highTarget = Profile.toMgdl(high, profileFunction.getUnits()) + lowTarget = low, + highTarget = high )).subscribe({ result -> result.inserted.forEach { aapsLogger.debug(LTag.DATABASE, "Inserted temp target $it") } result.updated.forEach { aapsLogger.debug(LTag.DATABASE, "Updated temp target $it") } From f10080686b84b81814d5f30b38bbb7e16e265a0b Mon Sep 17 00:00:00 2001 From: Philoul Date: Mon, 18 Oct 2021 21:07:06 +0200 Subject: [PATCH 3/3] It's better to make convertion in generateTempTarget for uel.log Sorry This reverts commit 9db58726 --- .../plugins/general/wear/ActionStringHandler.kt | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/ActionStringHandler.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/ActionStringHandler.kt index adaa43e8c9..72bcab6b7b 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/ActionStringHandler.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/wear/ActionStringHandler.kt @@ -507,11 +507,6 @@ class ActionStringHandler @Inject constructor( val duration = SafeParse.stringToInt(act[2]) var low = SafeParse.stringToDouble(act[3]) var high = SafeParse.stringToDouble(act[4]) - val isMGDL = java.lang.Boolean.parseBoolean(act[1]) - if (!isMGDL) { - low *= Constants.MMOLL_TO_MGDL - high *= Constants.MMOLL_TO_MGDL - } generateTempTarget(duration, low, high) } else if ("wizard2" == act[0]) { if (lastBolusWizard != null) { //use last calculation as confirmed string matches @@ -576,8 +571,8 @@ class ActionStringHandler @Inject constructor( timestamp = System.currentTimeMillis(), duration = TimeUnit.MINUTES.toMillis(duration.toLong()), reason = TemporaryTarget.Reason.WEAR, - lowTarget = low, - highTarget = high + lowTarget = Profile.toMgdl(low, profileFunction.getUnits()), + highTarget = Profile.toMgdl(high, profileFunction.getUnits()) )).subscribe({ result -> result.inserted.forEach { aapsLogger.debug(LTag.DATABASE, "Inserted temp target $it") } result.updated.forEach { aapsLogger.debug(LTag.DATABASE, "Updated temp target $it") }