From 3d8b4a68b8f51d1cab020e38fb269d59c18257d4 Mon Sep 17 00:00:00 2001 From: HarukiToreda <116696711+HarukiToreda@users.noreply.github.com> Date: Mon, 22 Sep 2025 20:10:05 -0400 Subject: [PATCH] Add channel name instead of channel slot --- src/graphics/draw/MenuHandler.cpp | 18 ++++++++++++++---- src/graphics/draw/MenuHandler.h | 4 ++-- src/graphics/draw/MessageRenderer.cpp | 10 ++++++++-- src/modules/CannedMessageModule.cpp | 8 ++++---- 4 files changed, 28 insertions(+), 12 deletions(-) diff --git a/src/graphics/draw/MenuHandler.cpp b/src/graphics/draw/MenuHandler.cpp index d9699ec53..5a9a0ed9d 100644 --- a/src/graphics/draw/MenuHandler.cpp +++ b/src/graphics/draw/MenuHandler.cpp @@ -448,8 +448,13 @@ void menuHandler::messageViewModeMenu() for (int ch = 0; ch < 8; ++ch) { auto msgs = messageStore.getChannelMessages(ch); if (!msgs.empty()) { - char buf[20]; - snprintf(buf, sizeof(buf), "Channel %d", ch); + char buf[40]; + const char* cname = channels.getName(ch); + if (cname && cname[0]) { + snprintf(buf, sizeof(buf), "#%s", cname); + } else { + snprintf(buf, sizeof(buf), "#Ch%d", ch); + } labels.push_back(buf); ids.push_back(100 + ch); } @@ -458,8 +463,13 @@ void menuHandler::messageViewModeMenu() // --- Add channels from registry --- for (int ch : graphics::MessageRenderer::getSeenChannels()) { if (std::find(ids.begin(), ids.end(), 100 + ch) == ids.end()) { - char buf[20]; - snprintf(buf, sizeof(buf), "Channel %d", ch); + char buf[40]; + const char* cname = channels.getName(ch); + if (cname && cname[0]) { + snprintf(buf, sizeof(buf), "#%s", cname); + } else { + snprintf(buf, sizeof(buf), "#Ch%d", ch); + } labels.push_back(buf); ids.push_back(100 + ch); } diff --git a/src/graphics/draw/MenuHandler.h b/src/graphics/draw/MenuHandler.h index 81c0f7b77..d6c96d931 100644 --- a/src/graphics/draw/MenuHandler.h +++ b/src/graphics/draw/MenuHandler.h @@ -44,7 +44,7 @@ class menuHandler throttle_message, FrameToggles, message_response_menu, - message_viewmode_menu // <-- View Mode menu entry + message_viewmode_menu }; static screenMenus menuQueue; @@ -59,7 +59,7 @@ class menuHandler static void TwelveHourPicker(); static void ClockFacePicker(); static void messageResponseMenu(); - static void messageViewModeMenu(); // <-- prototype already here + static void messageViewModeMenu(); static void homeBaseMenu(); static void textMessageBaseMenu(); static void systemBaseMenu(); diff --git a/src/graphics/draw/MessageRenderer.cpp b/src/graphics/draw/MessageRenderer.cpp index 43ab72ce0..72c1b93aa 100644 --- a/src/graphics/draw/MessageRenderer.cpp +++ b/src/graphics/draw/MessageRenderer.cpp @@ -301,10 +301,16 @@ void drawTextMessageFrame(OLEDDisplay *display, OLEDDisplayUiState *state, int16 case ThreadMode::ALL: titleStr = "Messages"; break; - case ThreadMode::CHANNEL: - snprintf(titleBuf, sizeof(titleBuf), "Ch%d", currentChannel); + case ThreadMode::CHANNEL: { + const char *cname = channels.getName(currentChannel); + if (cname && cname[0]) { + snprintf(titleBuf, sizeof(titleBuf), "#%s", cname); + } else { + snprintf(titleBuf, sizeof(titleBuf), "Ch%d", currentChannel); + } titleStr = titleBuf; break; + } case ThreadMode::DIRECT: { meshtastic_NodeInfoLite *node = nodeDB->getMeshNode(currentPeer); if (node && node->has_user) { diff --git a/src/modules/CannedMessageModule.cpp b/src/modules/CannedMessageModule.cpp index e9d703132..33cbe031a 100644 --- a/src/modules/CannedMessageModule.cpp +++ b/src/modules/CannedMessageModule.cpp @@ -198,13 +198,13 @@ void CannedMessageModule::drawHeader(OLEDDisplay *display, int16_t x, int16_t y, { if (graphics::isHighResolution) { if (this->dest == NODENUM_BROADCAST) { - display->drawStringf(x, y, buffer, "To: Broadcast@%s", channels.getName(this->channel)); + display->drawStringf(x, y, buffer, "To: Broadcast#%s", channels.getName(this->channel)); } else { display->drawStringf(x, y, buffer, "To: %s", getNodeName(this->dest)); } } else { if (this->dest == NODENUM_BROADCAST) { - display->drawStringf(x, y, buffer, "To: Broadc@%.5s", channels.getName(this->channel)); + display->drawStringf(x, y, buffer, "To: Broadc#%.5s", channels.getName(this->channel)); } else { display->drawStringf(x, y, buffer, "To: %s", getNodeName(this->dest)); } @@ -645,7 +645,7 @@ bool CannedMessageModule::handleMessageSelectorInput(const InputEvent *event, bo if (osk_found && screen) { char headerBuffer[64]; if (this->dest == NODENUM_BROADCAST) { - snprintf(headerBuffer, sizeof(headerBuffer), "To: Broadcast@%s", channels.getName(this->channel)); + snprintf(headerBuffer, sizeof(headerBuffer), "To: Broadcast#%s", channels.getName(this->channel)); } else { snprintf(headerBuffer, sizeof(headerBuffer), "To: %s", getNodeName(this->dest)); } @@ -1562,7 +1562,7 @@ void CannedMessageModule::drawDestinationSelectionScreen(OLEDDisplay *display, O // Draw Channels First if (itemIndex < numActiveChannels) { uint8_t channelIndex = this->activeChannelIndices[itemIndex]; - snprintf(entryText, sizeof(entryText), "@%s", channels.getName(channelIndex)); + snprintf(entryText, sizeof(entryText), "#%s", channels.getName(channelIndex)); } // Then Draw Nodes else {