mirror of
https://github.com/meshtastic/firmware.git
synced 2025-08-24 05:50:16 +00:00
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:
parent
52f0e5a3db
commit
1877a2c531
@ -78,16 +78,15 @@ void CannedMessageModule::LaunchWithDestination(NodeNum newDest, uint8_t newChan
|
|||||||
lastDestSet = true;
|
lastDestSet = true;
|
||||||
|
|
||||||
// Rest of function unchanged...
|
// Rest of function unchanged...
|
||||||
// Always select the first real canned message on activation
|
// Upon activation, highlight "[Select Destination]"
|
||||||
int firstRealMsgIdx = 0;
|
int selectDestination = 0;
|
||||||
for (int i = 0; i < messagesCount; ++i) {
|
for (int i = 0; i < messagesCount; ++i) {
|
||||||
if (strcmp(messages[i], "[Select Destination]") != 0 && strcmp(messages[i], "[Exit]") != 0 &&
|
if (strcmp(messages[i], "[Select Destination]") == 0) {
|
||||||
strcmp(messages[i], "[---- Free Text ----]") != 0) {
|
selectDestination = i;
|
||||||
firstRealMsgIdx = i;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
currentMessageIndex = firstRealMsgIdx;
|
currentMessageIndex = selectDestination;
|
||||||
|
|
||||||
// This triggers the canned message list
|
// This triggers the canned message list
|
||||||
runState = CANNED_MESSAGE_RUN_STATE_ACTIVE;
|
runState = CANNED_MESSAGE_RUN_STATE_ACTIVE;
|
||||||
@ -999,17 +998,16 @@ int32_t CannedMessageModule::runOnce()
|
|||||||
this->notifyObservers(&e);
|
this->notifyObservers(&e);
|
||||||
return 2000;
|
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)) {
|
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) {
|
for (int i = 0; i < this->messagesCount; ++i) {
|
||||||
if (strcmp(this->messages[i], "[Select Destination]") != 0 && strcmp(this->messages[i], "[Exit]") != 0 &&
|
if (strcmp(this->messages[i], "[Select Destination]") == 0) {
|
||||||
strcmp(this->messages[i], "[---- Free Text ----]") != 0) {
|
selectDestination = i;
|
||||||
firstRealMsgIdx = i;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this->currentMessageIndex = firstRealMsgIdx;
|
this->currentMessageIndex = selectDestination;
|
||||||
e.action = UIFrameEvent::Action::REGENERATE_FRAMESET;
|
e.action = UIFrameEvent::Action::REGENERATE_FRAMESET;
|
||||||
this->runState = CANNED_MESSAGE_RUN_STATE_ACTIVE;
|
this->runState = CANNED_MESSAGE_RUN_STATE_ACTIVE;
|
||||||
} else if (this->runState == CANNED_MESSAGE_RUN_STATE_ACTION_UP) {
|
} else if (this->runState == CANNED_MESSAGE_RUN_STATE_ACTION_UP) {
|
||||||
|
Loading…
Reference in New Issue
Block a user