From 1877a2c5311c2892d032bff5a9cee3d3a99f23f0 Mon Sep 17 00:00:00 2001 From: Ford Jones <107664313+ford-jones@users.noreply.github.com> Date: Fri, 15 Aug 2025 22:31:11 +1200 Subject: [PATCH] Prompt user to select destination upon launch of canned message module (#7624) Co-authored-by: Jason P --- src/modules/CannedMessageModule.cpp | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/modules/CannedMessageModule.cpp b/src/modules/CannedMessageModule.cpp index b6cb1b0e3..d40dcd24f 100644 --- a/src/modules/CannedMessageModule.cpp +++ b/src/modules/CannedMessageModule.cpp @@ -78,16 +78,15 @@ void CannedMessageModule::LaunchWithDestination(NodeNum newDest, uint8_t newChan lastDestSet = true; // Rest of function unchanged... - // Always select the first real canned message on activation - int firstRealMsgIdx = 0; + // Upon activation, highlight "[Select Destination]" + int selectDestination = 0; for (int i = 0; i < messagesCount; ++i) { - if (strcmp(messages[i], "[Select Destination]") != 0 && strcmp(messages[i], "[Exit]") != 0 && - strcmp(messages[i], "[---- Free Text ----]") != 0) { - firstRealMsgIdx = i; + if (strcmp(messages[i], "[Select Destination]") == 0) { + selectDestination = i; break; } } - currentMessageIndex = firstRealMsgIdx; + currentMessageIndex = selectDestination; // This triggers the canned message list runState = CANNED_MESSAGE_RUN_STATE_ACTIVE; @@ -999,17 +998,16 @@ int32_t CannedMessageModule::runOnce() this->notifyObservers(&e); return 2000; } - // Always highlight the first real canned message when entering the message list + // Highlight [Select Destination] initially when entering the message list else if ((this->runState != CANNED_MESSAGE_RUN_STATE_FREETEXT) && (this->currentMessageIndex == -1)) { - int firstRealMsgIdx = 0; + int selectDestination = 0; for (int i = 0; i < this->messagesCount; ++i) { - if (strcmp(this->messages[i], "[Select Destination]") != 0 && strcmp(this->messages[i], "[Exit]") != 0 && - strcmp(this->messages[i], "[---- Free Text ----]") != 0) { - firstRealMsgIdx = i; + if (strcmp(this->messages[i], "[Select Destination]") == 0) { + selectDestination = i; break; } } - this->currentMessageIndex = firstRealMsgIdx; + this->currentMessageIndex = selectDestination; e.action = UIFrameEvent::Action::REGENERATE_FRAMESET; this->runState = CANNED_MESSAGE_RUN_STATE_ACTIVE; } else if (this->runState == CANNED_MESSAGE_RUN_STATE_ACTION_UP) {