diff --git a/examples/companion_radio/AbstractUITask.h b/examples/companion_radio/AbstractUITask.h index 7cd8fe24..0941a106 100644 --- a/examples/companion_radio/AbstractUITask.h +++ b/examples/companion_radio/AbstractUITask.h @@ -35,6 +35,10 @@ protected: public: void setHasConnection(bool connected) { _connected = connected; } bool hasConnection() const { return _connected; } + // True only when a BLE central is actually bonded/connected. On a dual + // (BLE+USB) interface hasConnection() is always true (USB counts), so use + // this for BLE-specific UI like the pairing-PIN prompt. + bool isBLEConnected() const { return _serial->isBLEConnected(); } uint16_t getBattMilliVolts() const { return _board->getBattMilliVolts(); } bool isSerialEnabled() const { return _serial->isEnabled(); } void enableSerial() { _serial->enable(); } diff --git a/examples/companion_radio/ui-new/UITask.cpp b/examples/companion_radio/ui-new/UITask.cpp index 6aad9505..c4d7258e 100644 --- a/examples/companion_radio/ui-new/UITask.cpp +++ b/examples/companion_radio/ui-new/UITask.cpp @@ -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());