Virtual keyboard fix

This commit is contained in:
HarukiToreda 2025-05-26 03:00:38 -04:00
parent 7c4714afbb
commit dbfa703cfa
3 changed files with 12 additions and 4 deletions

View File

@ -281,4 +281,6 @@ static const uint8_t icon_node[] PROGMEM = {
0xFE // ####### ← device base
};
#include "img/icon.xbm"
static_assert(sizeof(icon_bits) >= 0, "Silence unused variable warning");

View File

@ -596,7 +596,7 @@ bool CannedMessageModule::handleFreeTextInput(const InputEvent* event) {
if (dest == 0) dest = NODENUM_BROADCAST;
// Defensive: If channel isn't valid, pick the first available channel
if (channel < 0 || channel >= channels.getNumChannels()) channel = 0;
if (channel >= channels.getNumChannels()) channel = 0;
payload = CANNED_MESSAGE_RUN_STATE_FREETEXT;
currentMessageIndex = -1;
@ -1028,7 +1028,7 @@ int32_t CannedMessageModule::runOnce()
switch (this->payload) { // code below all trigger the freetext window (where you type to send a message) or reset the
// display back to the default window
case 0x08: // backspace
if (this->freetext.length() > 0 && this->highlight == 0x00) {
if (this->freetext.length() > 0 && this->key_highlight == 0x00) {
if (this->cursor == this->freetext.length()) {
this->freetext = this->freetext.substring(0, this->freetext.length() - 1);
} else {
@ -1062,7 +1062,7 @@ int32_t CannedMessageModule::runOnce()
// already handled above
break;
default:
if (this->highlight != 0x00) {
if (this->key_highlight != 0x00) {
break;
}

View File

@ -150,6 +150,13 @@ private:
String freetext;
String temporaryMessage;
#if defined(USE_VIRTUAL_KEYBOARD)
bool shift = false; // True if Shift (caps/alt) is active
int charSet = 0; // 0 = alpha keyboard, 1 = numeric/symbol keyboard
int highlight = -1; // Highlighted key for UI feedback
#endif
char key_highlight = 0x00;
// === Message Storage ===
char messageStore[CANNED_MESSAGE_MODULE_MESSAGES_SIZE + 1];
char *messages[CANNED_MESSAGE_MODULE_MESSAGE_MAX_COUNT];
@ -176,7 +183,6 @@ private:
// === State Tracking ===
cannedMessageModuleRunState runState = CANNED_MESSAGE_RUN_STATE_INACTIVE;
cannedMessageDestinationType destSelect = CANNED_MESSAGE_DESTINATION_TYPE_NONE;
char highlight = 0x00;
char payload = 0x00;
unsigned int cursor = 0;
unsigned long lastTouchMillis = 0;