From 2e0106f703f4998461c48721030a25e05fd6246c Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Sun, 21 Nov 2021 22:40:07 +0100 Subject: [PATCH 1/7] New translations strings.xml (Turkish) (#967) --- core/src/main/res/values-tr-rTR/strings.xml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/core/src/main/res/values-tr-rTR/strings.xml b/core/src/main/res/values-tr-rTR/strings.xml index f6812c767f..f00c5b212d 100644 --- a/core/src/main/res/values-tr-rTR/strings.xml +++ b/core/src/main/res/values-tr-rTR/strings.xml @@ -409,6 +409,23 @@ »%1$s« %2$.2f sınırların dışında Bazal değer NSClient sürümü AndroidAPS ile eşleşmiyor. Lütfen güncelle. + + KA.. Durum güncel değil. + KA.. Bazal güncel değil. + SMS + Pompaya bağlan tıklandı + Pompa sürücüsü değişti. + Pompa sürücüsü değişimi. + Cihaz değişti + Yenileme tıklandı + Zamanlanmış Durum Yenileme + Onaylanmamış komut + Kullanıcı talebi + Kullanıcı talebi + Bolus OK + Pompa eşleştirildi + Insight Yenileme Düğmesi + OKUMADURUMU %1$s %1$d gün %1$d gün From 8c1b4f7534096dcc36175310b394ce2232ada251 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Sun, 21 Nov 2021 23:28:23 +0100 Subject: [PATCH 2/7] rearrange preferences --- app/src/main/res/xml/pref_alerts.xml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/src/main/res/xml/pref_alerts.xml b/app/src/main/res/xml/pref_alerts.xml index 15cf4354a1..811a06b2e8 100644 --- a/app/src/main/res/xml/pref_alerts.xml +++ b/app/src/main/res/xml/pref_alerts.xml @@ -28,11 +28,6 @@ android:key="@string/key_enable_pump_unreachable_alert" android:title="@string/enable_pump_unreachable_alert" /> - - + + Date: Mon, 22 Nov 2021 16:26:33 +0100 Subject: [PATCH 3/7] fix processing automations --- .../general/overview/OverviewFragment.kt | 2 +- .../general/automation/AutomationPlugin.kt | 88 +++++++++---------- 2 files changed, 44 insertions(+), 46 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt index f19129a4cc..95c2110c75 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt @@ -574,7 +574,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList OKDialog.showConfirmation( context, rh.gs(R.string.run_question, event.title), - { handler.post { automationPlugin.processEvent(event, true) } } + { handler.post { automationPlugin.processEvent(event) } } ) } binding.buttonsLayout.userButtonsLayout.addView(it) diff --git a/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/AutomationPlugin.kt b/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/AutomationPlugin.kt index abe90805d7..af9801d147 100644 --- a/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/AutomationPlugin.kt +++ b/automation/src/main/java/info/nightscout/androidaps/plugins/general/automation/AutomationPlugin.kt @@ -186,18 +186,18 @@ class AutomationPlugin @Inject constructor( @Synchronized private fun processActions() { - var userEventsEnabled = config.APS - if (config.APS) { - if (loopPlugin.isSuspended || !(loopPlugin as PluginBase).isEnabled()) { - aapsLogger.debug(LTag.AUTOMATION, "Loop deactivated") - executionLog.add(rh.gs(R.string.loopisdisabled)) - userEventsEnabled = false - } - val enabled = constraintChecker.isAutomationEnabled() - if (!enabled.value()) { - executionLog.add(enabled.getMostLimitedReasons(aapsLogger)) - userEventsEnabled = false - } + var commonEventsEnabled = true + if (loopPlugin.isSuspended || !(loopPlugin as PluginBase).isEnabled()) { + aapsLogger.debug(LTag.AUTOMATION, "Loop deactivated") + executionLog.add(rh.gs(R.string.loopisdisabled)) + rxBus.send(EventAutomationUpdateGui()) + commonEventsEnabled = false + } + val enabled = constraintChecker.isAutomationEnabled() + if (!enabled.value()) { + executionLog.add(enabled.getMostLimitedReasons(aapsLogger)) + rxBus.send(EventAutomationUpdateGui()) + commonEventsEnabled = false } aapsLogger.debug(LTag.AUTOMATION, "processActions") @@ -205,7 +205,7 @@ class AutomationPlugin @Inject constructor( while (iterator.hasNext()) { val event = iterator.next() if (event.isEnabled && !event.userAction && event.shouldRun()) - processEvent(event, userEventsEnabled) + if (event.systemAction || commonEventsEnabled) processEvent(event) } // we cannot detect connected BT devices // so let's collect all connection/disconnections between 2 runs of processActions() @@ -216,40 +216,38 @@ class AutomationPlugin @Inject constructor( storeToSP() // save last run time } - fun processEvent(event: AutomationEvent, userEventsEnabled: Boolean) { + fun processEvent(event: AutomationEvent) { if (event.trigger.shouldRun() && event.getPreconditions().shouldRun()) { - if (event.systemAction || userEventsEnabled) { - val actions = event.actions - for (action in actions) { - action.title = event.title - if (action.isValid()) - action.doAction(object : Callback() { - override fun run() { - val sb = StringBuilder() - sb.append(dateUtil.timeString(dateUtil.now())) - sb.append(" ") - sb.append(if (result.success) "☺" else "▼") - sb.append(" ") - sb.append(event.title) - sb.append(": ") - sb.append(action.shortDescription()) - sb.append(": ") - sb.append(result.comment) - executionLog.add(sb.toString()) - aapsLogger.debug(LTag.AUTOMATION, "Executed: $sb") - rxBus.send(EventAutomationUpdateGui()) - } - }) - else { - executionLog.add("Invalid action: ${action.shortDescription()}") - aapsLogger.debug(LTag.AUTOMATION, "Invalid action: ${action.shortDescription()}") - rxBus.send(EventAutomationUpdateGui()) - } + val actions = event.actions + for (action in actions) { + action.title = event.title + if (action.isValid()) + action.doAction(object : Callback() { + override fun run() { + val sb = StringBuilder() + .append(dateUtil.timeString(dateUtil.now())) + .append(" ") + .append(if (result.success) "☺" else "▼") + .append(" ") + .append(event.title) + .append(": ") + .append(action.shortDescription()) + .append(": ") + .append(result.comment) + executionLog.add(sb.toString()) + aapsLogger.debug(LTag.AUTOMATION, "Executed: $sb") + rxBus.send(EventAutomationUpdateGui()) + } + }) + else { + executionLog.add("Invalid action: ${action.shortDescription()}") + aapsLogger.debug(LTag.AUTOMATION, "Invalid action: ${action.shortDescription()}") + rxBus.send(EventAutomationUpdateGui()) } - SystemClock.sleep(1100) - event.lastRun = dateUtil.now() - if (event.autoRemove) automationEvents.remove(event) } + SystemClock.sleep(1100) + event.lastRun = dateUtil.now() + if (event.autoRemove) automationEvents.remove(event) } } @@ -306,7 +304,7 @@ class AutomationPlugin @Inject constructor( val iterator: MutableIterator = automationEvents.iterator() while (iterator.hasNext()) { val event = iterator.next() - if (event.userAction) list.add(event) + if (event.userAction && event.isEnabled) list.add(event) } return list } From 103e025b9f0ed31fb557d3d0e8c726489d401abf Mon Sep 17 00:00:00 2001 From: Philoul Date: Tue, 23 Nov 2021 00:42:59 +0100 Subject: [PATCH 4/7] Add Basal sum to profile viewer dialog --- .../info/nightscout/androidaps/dialogs/ProfileViewerDialog.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/java/info/nightscout/androidaps/dialogs/ProfileViewerDialog.kt b/core/src/main/java/info/nightscout/androidaps/dialogs/ProfileViewerDialog.kt index b51f4fe50c..bb68d619a7 100644 --- a/core/src/main/java/info/nightscout/androidaps/dialogs/ProfileViewerDialog.kt +++ b/core/src/main/java/info/nightscout/androidaps/dialogs/ProfileViewerDialog.kt @@ -164,7 +164,7 @@ class ProfileViewerDialog : DaggerDialogFragment() { binding.date.text = date binding.ic.text = it.getIcList(rh, dateUtil) binding.isf.text = it.getIsfList(rh, dateUtil) - binding.basal.text = it.getBasalList(rh, dateUtil) + binding.basal.text = " ∑" + it.baseBasalSum() + "U\n" + it.getBasalList(rh, dateUtil) binding.target.text = it.getTargetList(rh, dateUtil) binding.basalGraph.show(it) From 936fc02bb97d59bb5450bc573183d78d0cdc3a7e Mon Sep 17 00:00:00 2001 From: Philoul Date: Tue, 23 Nov 2021 01:00:28 +0100 Subject: [PATCH 5/7] Format Total Basal Insulin --- .../info/nightscout/androidaps/dialogs/ProfileViewerDialog.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/main/java/info/nightscout/androidaps/dialogs/ProfileViewerDialog.kt b/core/src/main/java/info/nightscout/androidaps/dialogs/ProfileViewerDialog.kt index bb68d619a7..458212ec76 100644 --- a/core/src/main/java/info/nightscout/androidaps/dialogs/ProfileViewerDialog.kt +++ b/core/src/main/java/info/nightscout/androidaps/dialogs/ProfileViewerDialog.kt @@ -164,7 +164,7 @@ class ProfileViewerDialog : DaggerDialogFragment() { binding.date.text = date binding.ic.text = it.getIcList(rh, dateUtil) binding.isf.text = it.getIsfList(rh, dateUtil) - binding.basal.text = " ∑" + it.baseBasalSum() + "U\n" + it.getBasalList(rh, dateUtil) + binding.basal.text = "∑ " + rh.gs(R.string.formatinsulinunits, it.baseBasalSum()) + "\n" + it.getBasalList(rh, dateUtil) binding.target.text = it.getTargetList(rh, dateUtil) binding.basalGraph.show(it) From 051a48272521adf96b3eb12d3521d1e935e22284 Mon Sep 17 00:00:00 2001 From: bubble_devteam Date: Tue, 23 Nov 2021 16:42:24 +0800 Subject: [PATCH 6/7] fix Orange connecting bug --- .../plugins/pump/common/hw/rileylink/ble/RileyLinkBLE.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RileyLinkBLE.java b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RileyLinkBLE.java index a8cfa31496..1e41ffebd4 100644 --- a/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RileyLinkBLE.java +++ b/rileylink/src/main/java/info/nightscout/androidaps/plugins/pump/common/hw/rileylink/ble/RileyLinkBLE.java @@ -85,10 +85,11 @@ public class RileyLinkBLE { aapsLogger.debug(LTag.PUMPBTCOMM, "Response Count is " + ByteUtil.shortHexString(characteristic.getValue())); } } - if (radioResponseCountNotified != null) { - radioResponseCountNotified.run(); + if (characteristic.getUuid().equals(UUID.fromString(GattAttributes.CHARA_RADIO_RESPONSE_COUNT))) { + if (radioResponseCountNotified != null) { + radioResponseCountNotified.run(); + } } - orangeLink.onCharacteristicChanged(characteristic); } From 4ce5966c6eaa3b0905127eff19e9d07ff5a79834 Mon Sep 17 00:00:00 2001 From: Andrei Vereha Date: Tue, 23 Nov 2021 19:58:21 +0100 Subject: [PATCH 7/7] round number of unit to 0.05 --- .../pump/omnipod/dash/driver/OmnipodDashManagerImpl.kt | 6 ++++-- .../dash/driver/pod/state/OmnipodDashPodStateManagerImpl.kt | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/OmnipodDashManagerImpl.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/OmnipodDashManagerImpl.kt index 0d62eb9a68..29ddc58221 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/OmnipodDashManagerImpl.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/OmnipodDashManagerImpl.kt @@ -12,8 +12,10 @@ import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definitio import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.PodConstants.Companion.POD_EXPIRATION_ALERT_HOURS import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.PodConstants.Companion.POD_EXPIRATION_ALERT_HOURS_DURATION import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.PodConstants.Companion.POD_EXPIRATION_IMMINENT_ALERT_HOURS +import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.definition.PodConstants.Companion.POD_PULSE_BOLUS_UNITS import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.response.* import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.state.OmnipodDashPodStateManager +import info.nightscout.androidaps.utils.Round import info.nightscout.androidaps.utils.rx.AapsSchedulers import io.reactivex.Observable import io.reactivex.functions.Action @@ -281,7 +283,7 @@ class OmnipodDashManagerImpl @Inject constructor( .setUniqueId(podStateManager.uniqueId!!.toInt()) .setSequenceNumber(podStateManager.messageSequenceNumber) .setNonce(NONCE) - .setNumberOfUnits(podStateManager.firstPrimeBolusVolume!! * PodConstants.POD_PULSE_BOLUS_UNITS) + .setNumberOfUnits(Round.roundTo(podStateManager.firstPrimeBolusVolume!! * PodConstants.POD_PULSE_BOLUS_UNITS, POD_PULSE_BOLUS_UNITS)) .setDelayBetweenPulsesInEighthSeconds(podStateManager.primePulseRate!!.toByte()) .setProgramReminder(ProgramReminder(atStart = false, atEnd = false, atInterval = 0)) .build(), @@ -383,7 +385,7 @@ class OmnipodDashManagerImpl @Inject constructor( ) observables.add( observeSendProgramBolusCommand( - podStateManager.secondPrimeBolusVolume!! * PodConstants.POD_PULSE_BOLUS_UNITS, + Round.roundTo(podStateManager.secondPrimeBolusVolume!! * PodConstants.POD_PULSE_BOLUS_UNITS, PodConstants.POD_PULSE_BOLUS_UNITS), podStateManager.primePulseRate!!.toByte(), confirmationBeeps = false, completionBeeps = false diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/state/OmnipodDashPodStateManagerImpl.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/state/OmnipodDashPodStateManagerImpl.kt index 41d26e3e94..9c3fcb3454 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/state/OmnipodDashPodStateManagerImpl.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/pod/state/OmnipodDashPodStateManagerImpl.kt @@ -16,6 +16,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.response. import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.response.DefaultStatusResponse import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.response.SetUniqueIdResponse import info.nightscout.androidaps.plugins.pump.omnipod.dash.driver.pod.response.VersionResponse +import info.nightscout.androidaps.utils.Round import info.nightscout.androidaps.utils.sharedPreferences.SP import io.reactivex.Completable import io.reactivex.Maybe @@ -340,7 +341,7 @@ class OmnipodDashPodStateManagerImpl @Inject constructor( private fun updateLastBolusFromResponse(bolusPulsesRemaining: Short) { podState.lastBolus?.run { - val remainingUnits = bolusPulsesRemaining.toDouble() * PodConstants.POD_PULSE_BOLUS_UNITS + val remainingUnits = Round.roundTo(bolusPulsesRemaining * PodConstants.POD_PULSE_BOLUS_UNITS, PodConstants.POD_PULSE_BOLUS_UNITS) this.bolusUnitsRemaining = remainingUnits if (remainingUnits == 0.0) { this.deliveryComplete = true