diff --git a/examples/companion_radio/MyMesh.cpp b/examples/companion_radio/MyMesh.cpp index 3fdc8e7f..4e43de86 100644 --- a/examples/companion_radio/MyMesh.cpp +++ b/examples/companion_radio/MyMesh.cpp @@ -817,6 +817,7 @@ void MyMesh::onControlDataRecv(mesh::Packet *packet) { r.rssi = (int8_t)_radio->getLastRSSI(); r.snr_x4 = (int8_t)(_radio->getLastSNR() * 4); r.remote_snr_x4 = (int8_t)packet->payload[1]; + memcpy(r.pub_key, pub_key, PUB_KEY_SIZE); r.timestamp = getRTCClock()->getCurrentTime(); } if (_ui) _ui->notify(UIEventType::newContactMessage); diff --git a/examples/companion_radio/MyMesh.h b/examples/companion_radio/MyMesh.h index ba2c01cb..1d6b8373 100644 --- a/examples/companion_radio/MyMesh.h +++ b/examples/companion_radio/MyMesh.h @@ -92,6 +92,7 @@ struct DiscoverResult { int8_t rssi; // RSSI of the response as received by us (dBm) int8_t snr_x4; // SNR of the response as received by us (dB × 4) int8_t remote_snr_x4; // SNR at which responder heard our request (dB × 4) + uint8_t pub_key[PUB_KEY_SIZE]; uint32_t timestamp; }; diff --git a/examples/companion_radio/ui-new/NearbyScreen.h b/examples/companion_radio/ui-new/NearbyScreen.h index 3b87942c..0d4f5e27 100644 --- a/examples/companion_radio/ui-new/NearbyScreen.h +++ b/examples/companion_radio/ui-new/NearbyScreen.h @@ -1,5 +1,6 @@ #pragma once #include +#include #ifndef M_PI #define M_PI 3.14159265358979323846 @@ -198,9 +199,13 @@ class NearbyScreen : public UIScreen { display.setColor(DisplayDriver::LIGHT); display.fillRect(0, 10, display.width(), 1); + // public key as base64, truncated with ... by drawTextEllipsized + uint8_t b64[48]; + encode_base64(r.pub_key, PUB_KEY_SIZE, b64); + b64[44] = '\0'; + display.drawTextEllipsized(2, 12, display.width() - 4, (const char*)b64); + char buf[32]; - snprintf(buf, sizeof(buf), "Type: %s", fullType); - display.setCursor(2, 12); display.print(buf); snprintf(buf, sizeof(buf), "RSSI: %d dBm", (int)r.rssi); display.setCursor(2, 21); display.print(buf);