fix(ui): keep hasConnection() BLE-specific; use isClientConnected() only for mute/wake

Self-review caught a regression I'd just introduced: feeding hasConnection()
from isClientConnected() (BLE *or* USB) broke the GPX-export collision warning
in TrailScreen, which relies on hasConnection() meaning "BLE app connected"
(BLE → USB dump is safe; otherwise the app may be on USB → warn).

Correct split:
- hasConnection() ← isBLEConnected() — BLE-specific consumers: BT status
  indicator, pairing PIN, GPX-export warning.
- isClientConnected() (BLE bonded OR open USB-CDC port) used directly only by
  the Auto buzzer mute and message-wake, which should react to either transport.

Builds clean on dual (OLED + e-ink) and pure-BLE.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Jakub
2026-06-05 12:42:14 +02:00
parent 3b795f7abc
commit cacc4e6206
3 changed files with 15 additions and 11 deletions

View File

@@ -2497,11 +2497,12 @@ void MyMesh::loop() {
}
#ifdef DISPLAY_CLASS
// "a companion app is connected over any transport" — BLE bonded or a host
// holding the USB-CDC port open. Drives Auto buzzer mute + message-wake.
// (Not isConnected(): a dual interface hardcodes that true as a send
// fallback. The BT status indicator and pairing PIN use isBLEConnected().)
if (_ui) _ui->setHasConnection(_serial->isClientConnected());
// hasConnection() means "a BLE companion app is connected". Not isConnected()
// (a dual interface hardcodes that true as a USB send-fallback). Drives the BT
// status indicator, pairing PIN, and the GPX-export collision warning — all
// BLE-specific. The Auto buzzer mute / message-wake use isClientConnected()
// (BLE *or* an open USB port) directly instead.
if (_ui) _ui->setHasConnection(_serial->isBLEConnected());
#endif
}