From 4ea67ee9506e33ef1abaf0a035b5269e511b5aaf Mon Sep 17 00:00:00 2001 From: Jakub <106778416+MarekZegare4@users.noreply.github.com> Date: Fri, 5 Jun 2026 12:30:55 +0200 Subject: [PATCH] fix(ui): hasConnection() should track BLE bond, not isConnected() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR #14 (advert sound) changed setHasConnection() from isBLEConnected() to isConnected() to also mute on USB — but DualSerialInterface::isConnected() is hardcoded true (USB is always a send fallback) and ArduinoSerialInterface's is too ("no way of knowing"), so USB-client presence is undetectable. The result on every dual build: hasConnection() always true, which broke everything that means "a companion app is connected": - Auto buzzer mute → permanently muted (Auto behaved like Off) - BT status indicator → always shown connected - message-wake → display never woke for new messages Revert to isBLEConnected() (the only detectable client signal). Mute-on-USB isn't achievable; Buzzer = Off covers that case manually. Co-Authored-By: Claude Opus 4.8 --- examples/companion_radio/MyMesh.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/examples/companion_radio/MyMesh.cpp b/examples/companion_radio/MyMesh.cpp index ad142999..8d616de3 100644 --- a/examples/companion_radio/MyMesh.cpp +++ b/examples/companion_radio/MyMesh.cpp @@ -2497,7 +2497,12 @@ void MyMesh::loop() { } #ifdef DISPLAY_CLASS - if (_ui) _ui->setHasConnection(_serial->isConnected()); + // Use BLE-bonded state, not isConnected(): on a dual (BLE+USB) interface + // isConnected() is hardcoded true (USB is always a send fallback), and USB + // client presence isn't detectable anyway. hasConnection() drives the BT + // status indicator, message-wake and the Auto buzzer mute — all of which + // mean "a companion app is connected", i.e. BLE bonded. + if (_ui) _ui->setHasConnection(_serial->isBLEConnected()); #endif }