Prompt user to select destination upon launch of canned message module (#7624)

Co-authored-by: Jason P <applewiz@mac.com>
This commit is contained in:
Ford Jones 2025-08-15 22:31:11 +12:00 committed by GitHub
parent 52f0e5a3db
commit 1877a2c531
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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) {