crash fix for confirmation nodes

This commit is contained in:
HarukiToreda 2025-10-05 23:34:17 -04:00
parent c9314c78ca
commit b8d33a3280

View File

@ -698,20 +698,12 @@ bool CannedMessageModule::handleMessageSelectorInput(const InputEvent *event, bo
if (runState == CANNED_MESSAGE_RUN_STATE_INACTIVE || runState == CANNED_MESSAGE_RUN_STATE_DISABLED) { if (runState == CANNED_MESSAGE_RUN_STATE_INACTIVE || runState == CANNED_MESSAGE_RUN_STATE_DISABLED) {
} else { } else {
#if CANNED_MESSAGE_ADD_CONFIRMATION #if CANNED_MESSAGE_ADD_CONFIRMATION
// Show confirmation dialog before sending canned message const int savedIndex = currentMessageIndex;
NodeNum destNode = dest; graphics::menuHandler::showConfirmationBanner("Send message?", [this, savedIndex]() {
ChannelIndex chan = channel; this->currentMessageIndex = savedIndex;
graphics::menuHandler::showConfirmationBanner("Send message?", [this, destNode, chan, current]() { this->payload = this->runState;
this->sendText(destNode, chan, current, false); this->runState = CANNED_MESSAGE_RUN_STATE_ACTION_SELECT;
payload = runState; this->setIntervalFromNow(0);
runState = CANNED_MESSAGE_RUN_STATE_INACTIVE;
currentMessageIndex = -1;
// Notify UI to regenerate frame set and redraw
UIFrameEvent e;
e.action = UIFrameEvent::Action::REGENERATE_FRAMESET;
notifyObservers(&e);
screen->forceDisplay();
}); });
#else #else
payload = runState; payload = runState;
@ -2220,7 +2212,7 @@ ProcessMessage CannedMessageModule::handleReceived(const meshtastic_MeshPacket &
} }
} else if (isAck && !isFromDest) { } else if (isAck && !isFromDest) {
// Relay ACK banner // Relay ACK banner
snprintf(buf, sizeof(buf), "DM Relayed\n(Status Unknown)%s\n\nSNR: %.1f dB RSSI: %d dBm", snprintf(buf, sizeof(buf), "DM Relayed\n(Status Unknown)\n%s\n\nSNR: %.1f dB RSSI: %d dBm",
(nodeName && nodeName[0]) ? nodeName : "unknown", this->lastRxSnr, this->lastRxRssi); (nodeName && nodeName[0]) ? nodeName : "unknown", this->lastRxSnr, this->lastRxRssi);
} else { } else {
if (this->lastSentNode == NODENUM_BROADCAST) { if (this->lastSentNode == NODENUM_BROADCAST) {