diff --git a/src/config/Config.h b/src/config/Config.h index 3f11786..17e289c 100644 --- a/src/config/Config.h +++ b/src/config/Config.h @@ -6,8 +6,8 @@ #define RATDECK_VERSION_MAJOR 1 #define RATDECK_VERSION_MINOR 6 -#define RATDECK_VERSION_PATCH 1 -#define RATDECK_VERSION_STRING "1.6.1" +#define RATDECK_VERSION_PATCH 2 +#define RATDECK_VERSION_STRING "1.6.2" // --- Feature Flags --- #define HAS_DISPLAY true @@ -63,3 +63,8 @@ // --- Serial Debug --- #define SERIAL_BAUD 115200 + +// --- Shared Utilities (defined in main.cpp) --- +#include +#include +RNS::Bytes encodeAnnounceName(const String& name); diff --git a/src/main.cpp b/src/main.cpp index 8b3a358..877bc4e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -130,7 +130,7 @@ unsigned long wifiConnectedAt = 0; // Announce with display name (MessagePack-encoded app_data) // ============================================================================= -static RNS::Bytes encodeAnnounceName(const String& name) { +RNS::Bytes encodeAnnounceName(const String& name) { if (name.isEmpty()) return {}; size_t len = name.length(); if (len > 31) len = 31; diff --git a/src/ui/screens/LvSettingsScreen.cpp b/src/ui/screens/LvSettingsScreen.cpp index f7962a4..4da9010 100644 --- a/src/ui/screens/LvSettingsScreen.cpp +++ b/src/ui/screens/LvSettingsScreen.cpp @@ -450,14 +450,7 @@ void LvSettingsScreen::buildItems() { announceItem.formatter = [](int) { return String("[Enter]"); }; announceItem.action = [this]() { if (_rns && _cfg) { - const String& name = _cfg->settings().displayName; - RNS::Bytes appData; - if (!name.isEmpty()) { - size_t len = name.length(); if (len > 31) len = 31; - uint8_t buf[2 + 31]; buf[0] = 0x91; buf[1] = 0xA0 | (uint8_t)len; - memcpy(buf + 2, name.c_str(), len); - appData = RNS::Bytes(buf, 2 + len); - } + RNS::Bytes appData = encodeAnnounceName(_cfg->settings().displayName); _rns->announce(appData); if (_ui) { _ui->lvStatusBar().flashAnnounce(); _ui->lvStatusBar().showToast("Announce sent!"); } } else {