diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/message/MessageIO.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/message/MessageIO.kt index 2394ae14e2..0aa3033894 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/message/MessageIO.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/driver/comm/message/MessageIO.kt @@ -37,7 +37,7 @@ class MessageIO( fun sendMessage(msg: MessagePacket): MessageSendResult { val foundRTS = cmdBleIO.flushIncomingQueue() if (foundRTS) { - val msg = receiveMessage() + val msg = receiveMessage(false) aapsLogger.warn(LTag.PUMPBTCOMM, "sendMessage received message=$msg") throw IllegalStateException("Received message while trying to send") } @@ -90,11 +90,13 @@ class MessageIO( } @Suppress("ReturnCount") - fun receiveMessage(): MessagePacket? { - val expectRTS = cmdBleIO.expectCommandType(BleCommandRTS, MESSAGE_READ_TIMEOUT_MS) - if (expectRTS !is BleConfirmSuccess) { - aapsLogger.warn(LTag.PUMPBTCOMM, "Error reading RTS: $expectRTS") - return null + fun receiveMessage(readRTS: Boolean = true): MessagePacket? { + if (readRTS) { + val expectRTS = cmdBleIO.expectCommandType(BleCommandRTS, MESSAGE_READ_TIMEOUT_MS) + if (expectRTS !is BleConfirmSuccess) { + aapsLogger.warn(LTag.PUMPBTCOMM, "Error reading RTS: $expectRTS") + return null + } } val sendResult = cmdBleIO.sendAndConfirmPacket(BleCommandCTS.data) diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/OmnipodDashOverviewFragment.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/OmnipodDashOverviewFragment.kt index ea37bf5aeb..97f70338a5 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/OmnipodDashOverviewFragment.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/OmnipodDashOverviewFragment.kt @@ -432,12 +432,14 @@ class OmnipodDashOverviewFragment : DaggerFragment() { } } - val podStatusColor = - if (!podStateManager.isActivationCompleted || podStateManager.isPodKaput || podStateManager.isSuspended) { + val podStatusColor = when { + !podStateManager.isActivationCompleted || podStateManager.isPodKaput || podStateManager.isSuspended -> Color.RED - } else { + podStateManager.activeCommand != null -> + Color.YELLOW + else -> Color.WHITE - } + } podInfoBinding.podStatus.setTextColor(podStatusColor) }