diff --git a/examples/companion_radio/MyMesh.cpp b/examples/companion_radio/MyMesh.cpp index 4ee19131..c6631df8 100644 --- a/examples/companion_radio/MyMesh.cpp +++ b/examples/companion_radio/MyMesh.cpp @@ -788,9 +788,9 @@ int MyMesh::getDiscoverResults(DiscoverResult dest[], int max_count) { } void MyMesh::onControlDataRecv(mesh::Packet *packet) { - // handle node discovery responses when in standalone UI mode (no companion app connected) - if (!_serial->isBLEConnected() && - (packet->payload[0] & 0xF0) == CTL_TYPE_NODE_DISCOVER_RESP && + // If we have an active standalone discover, check if this is a matching response. + // Tag matching provides isolation — no isBLEConnected check needed. + if ((packet->payload[0] & 0xF0) == CTL_TYPE_NODE_DISCOVER_RESP && packet->payload_len >= 6 + PUB_KEY_SIZE && _pending_node_discover_tag != 0 && !millisHasNowPassed(_pending_node_discover_until)) { @@ -817,8 +817,8 @@ void MyMesh::onControlDataRecv(mesh::Packet *packet) { r.timestamp = getRTCClock()->getCurrentTime(); } if (_ui) _ui->notify(UIEventType::newContactMessage); + return; // our discover — don't forward to BLE app } - return; } if (packet->payload_len + 4 > sizeof(out_frame)) { diff --git a/examples/companion_radio/ui-new/NearbyScreen.h b/examples/companion_radio/ui-new/NearbyScreen.h index ec3f5421..59d131c9 100644 --- a/examples/companion_radio/ui-new/NearbyScreen.h +++ b/examples/companion_radio/ui-new/NearbyScreen.h @@ -200,7 +200,7 @@ class NearbyScreen : public UIScreen { display.setColor(DisplayDriver::LIGHT); - // name: known contact → actual name; unknown → "[Type]" + // left: contact name if known, otherwise "[Type]" char label[32]; if (r.name[0]) { strncpy(label, r.name, sizeof(label) - 1); @@ -212,9 +212,14 @@ class NearbyScreen : public UIScreen { display.translateUTF8ToBlocks(filtered, label, sizeof(filtered)); display.drawTextEllipsized(2, y, DIST_COL - 4, filtered); - // right column: type label, dimmed for known / bright for new + // right: short type name; prefix '*' for nodes not in contacts + const char* st = (r.type == ADV_TYPE_REPEATER) ? "Rpt" : + (r.type == ADV_TYPE_SENSOR) ? "Snsr" : + (r.type == ADV_TYPE_ROOM) ? "Room" : "?"; + char rtype[8]; + snprintf(rtype, sizeof(rtype), r.is_known ? "%s" : "*%s", st); display.setCursor(DIST_COL, y); - display.print(r.is_known ? "known" : "NEW"); + display.print(rtype); } display.setColor(DisplayDriver::LIGHT);