mirror of
https://github.com/meshtastic/firmware.git
synced 2025-10-28 15:22:55 +00:00
Add channel name instead of channel slot
This commit is contained in:
parent
abcc166f3a
commit
3d8b4a68b8
@ -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);
|
||||
}
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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 {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user