From 5b868d51ca7cea0a5a5d7f14e6238d7b60ebd5d0 Mon Sep 17 00:00:00 2001 From: pelgraine <140762863+pelgraine@users.noreply.github.com> Date: Thu, 12 Feb 2026 20:32:21 +1100 Subject: [PATCH] improved responsiveness and cursor tracking in notes function. updated firmware version in mymesh. --- examples/companion_radio/MyMesh.h | 4 ++-- examples/companion_radio/main.cpp | 2 +- examples/companion_radio/ui-new/Notesscreen.h | 7 +++++-- variants/lilygo_tdeck_pro/Tca8418keyboard.h | 20 ++++++++++++++++--- 4 files changed, 25 insertions(+), 8 deletions(-) diff --git a/examples/companion_radio/MyMesh.h b/examples/companion_radio/MyMesh.h index cedda797..b964249b 100644 --- a/examples/companion_radio/MyMesh.h +++ b/examples/companion_radio/MyMesh.h @@ -8,11 +8,11 @@ #define FIRMWARE_VER_CODE 8 #ifndef FIRMWARE_BUILD_DATE -#define FIRMWARE_BUILD_DATE "11 Feb 2026" +#define FIRMWARE_BUILD_DATE "12 Feb 2026" #endif #ifndef FIRMWARE_VERSION -#define FIRMWARE_VERSION "Meck v0.8.4" +#define FIRMWARE_VERSION "Meck v0.8.5" #endif #if defined(NRF52_PLATFORM) || defined(STM32_PLATFORM) diff --git a/examples/companion_radio/main.cpp b/examples/companion_radio/main.cpp index 8ab836da..4105e8b8 100644 --- a/examples/companion_radio/main.cpp +++ b/examples/companion_radio/main.cpp @@ -26,7 +26,7 @@ static uint8_t composeChannelIdx = 0; static unsigned long lastComposeRefresh = 0; static bool composeNeedsRefresh = false; - #define COMPOSE_REFRESH_INTERVAL 600 // ms between e-ink refreshes while typing (refresh takes ~650ms) + #define COMPOSE_REFRESH_INTERVAL 100 // ms before starting e-ink refresh after keypress (refresh itself takes ~644ms) // DM compose mode (direct message to a specific contact) static bool composeDM = false; diff --git a/examples/companion_radio/ui-new/Notesscreen.h b/examples/companion_radio/ui-new/Notesscreen.h index a1963e53..3bf15c74 100644 --- a/examples/companion_radio/ui-new/Notesscreen.h +++ b/examples/companion_radio/ui-new/Notesscreen.h @@ -747,8 +747,11 @@ private: display.setColor(DisplayDriver::YELLOW); display.setCursor(0, footerY); - char status[40]; - snprintf(status, sizeof(status), "%d/%d", _bufLen, NOTES_BUF_SIZE - 1); + char status[20]; + int cursorLine = lineForPos(_cursorPos); + int curPage = (_editMaxLines > 0) ? (cursorLine / _editMaxLines) + 1 : 1; + int totalPg = (_editMaxLines > 0) ? max(1, (_numEditorLines + _editMaxLines - 1) / _editMaxLines) : 1; + snprintf(status, sizeof(status), "Pg %d/%d", curPage, totalPg); display.print(status); const char* right; diff --git a/variants/lilygo_tdeck_pro/Tca8418keyboard.h b/variants/lilygo_tdeck_pro/Tca8418keyboard.h index 86e3e094..9813d433 100644 --- a/variants/lilygo_tdeck_pro/Tca8418keyboard.h +++ b/variants/lilygo_tdeck_pro/Tca8418keyboard.h @@ -28,8 +28,9 @@ private: uint8_t _addr; TwoWire* _wire; bool _initialized; - bool _shiftActive; // Sticky shift (one-shot) + bool _shiftActive; // Sticky shift (one-shot or held) bool _shiftConsumed; // Was shift active for the last returned key + bool _shiftHeld; // Shift key physically held down bool _altActive; // Sticky alt (one-shot) bool _symActive; // Sticky sym (one-shot) unsigned long _lastShiftTime; // For Shift+key combos @@ -149,7 +150,7 @@ private: public: TCA8418Keyboard(uint8_t addr = 0x34, TwoWire* wire = &Wire) : _addr(addr), _wire(wire), _initialized(false), - _shiftActive(false), _shiftConsumed(false), _altActive(false), _symActive(false), _lastShiftTime(0) {} + _shiftActive(false), _shiftConsumed(false), _shiftHeld(false), _altActive(false), _symActive(false), _lastShiftTime(0) {} bool begin() { // Check if device responds @@ -204,6 +205,15 @@ public: Serial.printf("KB raw: event=0x%02X code=%d pressed=%d count=%d\n", keyEvent, keyCode, pressed, keyCount); + // Track shift release (before the general release-ignore) + if (!pressed && (keyCode == 35 || keyCode == 31)) { + _shiftHeld = false; + // Don't clear _shiftActive here - it may be a one-shot tap + // where release arrives before the next key press. + // _shiftActive is cleared when consumed by a key (if !_shiftHeld). + return 0; + } + // Only act on key press, not release if (!pressed || keyCode == 0) { return 0; @@ -212,6 +222,7 @@ public: // Handle modifier keys - set sticky state and return 0 if (keyCode == 35 || keyCode == 31) { // Shift keys _shiftActive = true; + _shiftHeld = true; _lastShiftTime = millis(); Serial.println("KB: Shift activated"); return 0; @@ -277,7 +288,10 @@ public: if (c >= 'a' && c <= 'z') { c = c - 'a' + 'A'; } - _shiftActive = false; // Reset sticky shift + // Only clear shift if it's one-shot (tap), not held down + if (!_shiftHeld) { + _shiftActive = false; + } _shiftConsumed = true; // Record that shift was active for this key } else { _shiftConsumed = false;