Add channel name instead of channel slot

This commit is contained in:
HarukiToreda
2025-09-22 20:10:05 -04:00
parent abcc166f3a
commit 3d8b4a68b8
4 changed files with 28 additions and 12 deletions

View File

@@ -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);
}