fix(ble): show pairing PIN on dual (BLE+USB) builds

The Bluetooth-page PIN prompt was gated on hasConnection(), which is fed by
the serial interface's isConnected(). DualSerialInterface::isConnected()
always returns true (USB always "connected"), so waiting_for_pair was always
false and the PIN was never drawn — on every dual build, i.e. the published
OLED + e-ink firmware. Pure-BLE builds were unaffected (there isConnected()
reflects bond state).

Gate the PIN on actual BLE-bonded state instead: add
AbstractUITask::isBLEConnected() (forwards to BaseSerialInterface::
isBLEConnected(), which DualSerialInterface overrides with the real BLE state
and pure-BLE inherits as its bond-aware isConnected()). The PIN now shows on
the Bluetooth page while BLE is on and not yet bonded.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Jakub
2026-06-05 12:03:38 +02:00
co-authored by Claude Opus 4.8
parent 2ef8644efe
commit a6ae9e80c8
2 changed files with 8 additions and 1 deletions
+4 -1
View File
@@ -740,7 +740,10 @@ public:
display.drawXbm((display.width() - 32) / 2, content_y,
_task->isSerialEnabled() ? bluetooth_on : bluetooth_off, 32, 32);
const int text_y = content_y + 32 + 3;
const bool waiting_for_pair = _task->isSerialEnabled() && !_task->hasConnection() && the_mesh.getBLEPin() != 0;
// Gate on BLE-bonded state, not hasConnection(): on a dual BLE+USB
// interface hasConnection() is always true (USB), which would hide the
// PIN forever — the exact e-ink dual-build pairing bug.
const bool waiting_for_pair = _task->isSerialEnabled() && !_task->isBLEConnected() && the_mesh.getBLEPin() != 0;
if (waiting_for_pair && !display.isLandscape()) {
char pin_buf[16];
snprintf(pin_buf, sizeof(pin_buf), "PIN: %d", the_mesh.getBLEPin());