Fix to but that takes you to message selection screen

This commit is contained in:
HarukiToreda 2025-05-26 23:45:53 -04:00
parent aaf9f4011f
commit bdd03bc853

View File

@ -533,9 +533,13 @@ bool CannedMessageModule::handleMessageSelectorInput(const InputEvent* event, bo
} }
bool CannedMessageModule::handleFreeTextInput(const InputEvent* event) { bool CannedMessageModule::handleFreeTextInput(const InputEvent* event) {
#if defined(USE_VIRTUAL_KEYBOARD) // Always process only if in FREETEXT mode
if (runState != CANNED_MESSAGE_RUN_STATE_FREETEXT) return false; if (runState != CANNED_MESSAGE_RUN_STATE_FREETEXT) return false;
#if defined(USE_VIRTUAL_KEYBOARD)
// Touch input (virtual keyboard) handling
// Only handle if touch coordinates present (CardKB won't set these)
if (event->touchX != 0 || event->touchY != 0) {
String keyTapped = keyForCoordinates(event->touchX, event->touchY); String keyTapped = keyForCoordinates(event->touchX, event->touchY);
bool valid = false; bool valid = false;
@ -582,15 +586,19 @@ bool CannedMessageModule::handleFreeTextInput(const InputEvent* event) {
if (valid) { if (valid) {
lastTouchMillis = millis(); lastTouchMillis = millis();
return true; return true; // STOP: We handled a VKB touch
} }
#endif }
#endif // USE_VIRTUAL_KEYBOARD
// ---- All hardware keys fall through to here (CardKB, physical, etc.) ----
// Confirm select (Enter)
bool isSelect = isSelectEvent(event); bool isSelect = isSelectEvent(event);
if (isSelect) {
if (runState == CANNED_MESSAGE_RUN_STATE_FREETEXT && isSelect) { LOG_DEBUG("[SELECT] handleFreeTextInput: runState=%d, dest=%u, channel=%d, freetext='%s'",
(int)runState, dest, channel, freetext.c_str());
if (dest == 0) dest = NODENUM_BROADCAST; if (dest == 0) dest = NODENUM_BROADCAST;
// Defensive: If channel isn't valid, pick the first available channel // Defensive: If channel isn't valid, pick the first available channel
if (channel < 0 || channel >= channels.getNumChannels()) channel = 0; if (channel < 0 || channel >= channels.getNumChannels()) channel = 0;
@ -598,6 +606,7 @@ bool CannedMessageModule::handleFreeTextInput(const InputEvent* event) {
currentMessageIndex = -1; currentMessageIndex = -1;
runState = CANNED_MESSAGE_RUN_STATE_ACTION_SELECT; runState = CANNED_MESSAGE_RUN_STATE_ACTION_SELECT;
lastTouchMillis = millis(); lastTouchMillis = millis();
runOnce();
return true; return true;
} }