improved responsiveness and cursor tracking in notes function. updated firmware version in mymesh.

This commit is contained in:
pelgraine
2026-02-12 20:32:21 +11:00
parent 220006c229
commit 5b868d51ca
4 changed files with 25 additions and 8 deletions
+2 -2
View File
@@ -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)
+1 -1
View File
@@ -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;
@@ -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;
+17 -3
View File
@@ -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;