From b9a68f0f992d2370d89ac172961fa6d755649cb8 Mon Sep 17 00:00:00 2001 From: pelgraine <140762863+pelgraine@users.noreply.github.com> Date: Tue, 10 Feb 2026 02:28:34 +1100 Subject: [PATCH] Amended so sym plus $ prints the dollar sign now --- examples/companion_radio/main.cpp | 6 +++--- examples/companion_radio/ui-new/emojipicker.h | 2 +- variants/lilygo_tdeck_pro/Tca8418keyboard.h | 13 ++++++++++--- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/examples/companion_radio/main.cpp b/examples/companion_radio/main.cpp index df570003..84ab0404 100644 --- a/examples/companion_radio/main.cpp +++ b/examples/companion_radio/main.cpp @@ -546,8 +546,8 @@ void handleKeyboardInput() { return; } - // '$' opens emoji picker - if (key == '$') { + // $ key opens emoji picker (Sym+$ types literal '$') + if (key == KB_KEY_EMOJI) { emojiPicker.reset(); emojiPickerMode = true; drawEmojiPicker(); @@ -846,7 +846,7 @@ void sendComposedMessage() { uint32_t timestamp = rtc_clock.getCurrentTime(); // Convert escape bytes back to UTF-8 for mesh transmission and BLE app - // Worst case: each escape byte → 8 bytes UTF-8 (flag emoji), plus ASCII chars + // Worst case: each escape byte → 8 bytes UTF-8 (flag emoji), plus ASCII chars char utf8Buf[512]; emojiUnescape(composeBuffer, utf8Buf, sizeof(utf8Buf)); int utf8Len = strlen(utf8Buf); diff --git a/examples/companion_radio/ui-new/emojipicker.h b/examples/companion_radio/ui-new/emojipicker.h index 53246cae..6ebb2969 100644 --- a/examples/companion_radio/ui-new/emojipicker.h +++ b/examples/companion_radio/ui-new/emojipicker.h @@ -103,7 +103,7 @@ struct EmojiPicker { case '\r': ensureVisible(); return (uint8_t)(EMOJI_ESCAPE_START + cursor); - case '\b': case 'q': case 'Q': case '$': + case '\b': case 'q': case 'Q': case KB_KEY_EMOJI: return 0xFF; default: return 0; diff --git a/variants/lilygo_tdeck_pro/Tca8418keyboard.h b/variants/lilygo_tdeck_pro/Tca8418keyboard.h index 492dc191..a70cb2f3 100644 --- a/variants/lilygo_tdeck_pro/Tca8418keyboard.h +++ b/variants/lilygo_tdeck_pro/Tca8418keyboard.h @@ -21,6 +21,7 @@ #define KB_KEY_BACKSPACE '\b' #define KB_KEY_ENTER '\r' #define KB_KEY_SPACE ' ' +#define KB_KEY_EMOJI 0x01 // Internal code: bare $ key (emoji picker trigger) class TCA8418Keyboard { private: @@ -225,10 +226,16 @@ public: return 0; } - // Handle dedicated $ key (key code 22, next to M) + // Handle $ key (key code 22, next to M) + // Bare press -> emoji picker trigger, Sym+$ -> literal '$' character if (keyCode == 22) { - Serial.println("KB: $ key pressed"); - return '$'; + if (_symActive) { + _symActive = false; + Serial.println("KB: Sym+$ -> '$'"); + return '$'; + } + Serial.println("KB: $ key -> emoji trigger"); + return KB_KEY_EMOJI; } // Handle Mic key - produces 0 with Sym, otherwise ignore