Send mirrored arrows to MUI as D-pad keys

Trackball semantics turned LEFT/RIGHT into LV_KEY_DOWN/UP and UP/DOWN
into encoder steps, so LVGL never saw a left or right key. device-ui now
runs mirrored keys through its input policy, which decides focus
traversal per context like a physical D-pad.
This commit is contained in:
James Rich committed 2026-11-03 07:39:18 -06:00
1 parent fb7967b289
commit dd67f9e975
2 files changed
+8 -8

No files matched your search

+7 -7
View File
@@ -342,25 +342,25 @@ bool muiDisplayInfo(uint16_t &width, uint16_t &height, bool &hasTouch)
return width > 0 && height > 0;
}
// The broker's LEFT/RIGHT codes are swapped relative to LVGL's, hence the cross-map below.
// Broker and LVGL key codes disagree (LEFT/RIGHT are swapped), so map by name.
bool muiInjectInputEvent(uint32_t eventCode, uint32_t kbChar, uint32_t touchX, uint32_t touchY)
{
if (config.display.displaymode != meshtastic_Config_DisplayConfig_DisplayMode_COLOR)
return false;
// trackball semantics: vertical is encoder rotation (moves group focus), horizontal the slider keys
// arrows go in as D-pad keys; device-ui's input policy decides focus traversal per context
switch (eventCode) {
case INPUT_BROKER_UP:
DisplayMirror::injectEncoder(-1);
DisplayMirror::injectKey(LV_KEY_UP);
break;
case INPUT_BROKER_DOWN:
DisplayMirror::injectEncoder(1);
break;
case INPUT_BROKER_LEFT:
DisplayMirror::injectKey(LV_KEY_DOWN);
break;
case INPUT_BROKER_LEFT:
DisplayMirror::injectKey(LV_KEY_LEFT);
break;
case INPUT_BROKER_RIGHT:
DisplayMirror::injectKey(LV_KEY_UP);
DisplayMirror::injectKey(LV_KEY_RIGHT);
break;
case INPUT_BROKER_SELECT:
// with coordinates this is a touch long-press, as the physical touch driver emits it
+1 -1
View File
@@ -89,7 +89,7 @@ extends = env:native-tft
board_level = extra
lib_deps =
${native_base.lib_deps}
https://github.com/jamesarich/device-ui/archive/0b20b01333d42b32af8cc95c63034ac3c70a50ca.zip
https://github.com/jamesarich/device-ui/archive/0996862d2ffb1bdef6748cce76491868404481e8.zip
build_flags =
${env:native-tft.build_flags}
-D MESHTASTIC_MUI_MIRROR=1