feat: show pub_key as base64 in discover detail screen

Replaces "Type: Repeater" line with the node's full public key encoded
as base64 (44 chars). drawTextEllipsized clips it with ... to fit the
128px wide display. Type is already visible in the inverted header.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Jakub
2026-05-21 09:11:32 +02:00
parent 3b7915d0b7
commit 52d97ed314
3 changed files with 9 additions and 2 deletions

View File

@@ -817,6 +817,7 @@ void MyMesh::onControlDataRecv(mesh::Packet *packet) {
r.rssi = (int8_t)_radio->getLastRSSI(); r.rssi = (int8_t)_radio->getLastRSSI();
r.snr_x4 = (int8_t)(_radio->getLastSNR() * 4); r.snr_x4 = (int8_t)(_radio->getLastSNR() * 4);
r.remote_snr_x4 = (int8_t)packet->payload[1]; r.remote_snr_x4 = (int8_t)packet->payload[1];
memcpy(r.pub_key, pub_key, PUB_KEY_SIZE);
r.timestamp = getRTCClock()->getCurrentTime(); r.timestamp = getRTCClock()->getCurrentTime();
} }
if (_ui) _ui->notify(UIEventType::newContactMessage); if (_ui) _ui->notify(UIEventType::newContactMessage);

View File

@@ -92,6 +92,7 @@ struct DiscoverResult {
int8_t rssi; // RSSI of the response as received by us (dBm) 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 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) int8_t remote_snr_x4; // SNR at which responder heard our request (dB × 4)
uint8_t pub_key[PUB_KEY_SIZE];
uint32_t timestamp; uint32_t timestamp;
}; };

View File

@@ -1,5 +1,6 @@
#pragma once #pragma once
#include <math.h> #include <math.h>
#include <base64.hpp>
#ifndef M_PI #ifndef M_PI
#define M_PI 3.14159265358979323846 #define M_PI 3.14159265358979323846
@@ -198,9 +199,13 @@ class NearbyScreen : public UIScreen {
display.setColor(DisplayDriver::LIGHT); display.setColor(DisplayDriver::LIGHT);
display.fillRect(0, 10, display.width(), 1); 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]; 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); snprintf(buf, sizeof(buf), "RSSI: %d dBm", (int)r.rssi);
display.setCursor(2, 21); display.print(buf); display.setCursor(2, 21); display.print(buf);