Build an ESP32-P4 Touchscreen Macro Deck with LVGL
Resumo
Pixel shares a look at Tessera Deck, an MIT-licensed Stream Deck alternative built on a 7-inch ESP32-P4 touchscreen with LVGL 9.6. The announcement explains native PC UI testing, the panel’s touch-only role, and its USB Serial/JTAG line protocol with a Python host—useful design lessons for embedded display projects.
DEV Community
Building a touchscreen macro deck on an ESP32-P4 with LVGL 9.6
I wanted a Stream Deck-style macro pad without paying for a Stream Deck, so I built one on a GUITION JC1060P470C. It is a 7-inch, 1024 x 600 capacitive touchscreen on an ESP32-P4. The project is called Tessera Deck. It is MIT licensed, it runs on Windows 10 and 11, and the panel UI is LVGL 9.6 on ESP-IDF 6.1. This post covers the design choices behind the panel firmware and the host protocol, for anyone building something similar on an embedded display. The cover image is a Blender render made from the CAD model of the desk console. I have no photo of a printed one yet. The panel screenshots below are not photos either: the native PC build of the real UI code drew them, and the agents screen uses sample data. 1. Build the UI for the PC first The UI code compiles natively on the PC against the same LVGL sources as the firmware. A test feeds it touch input and renders 1024 x 600 frames. A layout bug shows up in seconds, with no flashing and no cable. I can also make screenshots for the README without photographing a screen at an angle. The catch is that the native build does not exercise the display driver, the touch controller or PSRAM limits. Those still need the board. I treat the native build as the place for UI logic and the board as the place for hardware surprises. 2. Keep the panel dumb The panel only draws and reports touches. A small Python host on the PC owns the USB Serial/JTAG port, runs the actions and serves the editor on 127.0.0.1. The two talk over a line protocol at 115200 baud. Each message is one UTF-8 line. The host sends text commands or one JSON object. The panel answers, and it also sends its own events as JSON lines. A key press looks like this, copied from the protocol page at v0.9.0: {"type":"deck_event","id":N,"button":N,"label":"…","hold":true}
hold is only present for a long press. Everything else about what the key does lives on the PC. That means I can add an action without touching the firmware, and the firmware stays small. There are limits to this design. The panel reads lines of up to 1,099 bytes and ignores a longer one, so the host sends a layout in 380-character chunks and an image in 160-byte chunks. A pressed key stays highlighted until the host answers, so without a host it flashes red at once. If the PC is off, the panel keeps the last layout on screen and the keys do nothing. 3. Update objects in place A touchscreen punishes rebuilds. If a gauge value arrived and the grid were rebuilt while you press a key, your finger would be on a new object that never saw the press, so I update in place. Now labels, colours and gauge values change on the existing LVGL objects. The grid is only rebuilt when the page or its layout changes. A key is never rebuilt under your finger. The same idea covers widgets. The host sends a title, a second line and a progress value, and the panel draws every wide key the same way. A new widget is a new host-side feature and needs no new firmware. 4. Treat icons as a cache problem Icons are the one thing that is too big to treat like text. The host sends each icon as RGBA with a CRC32 check, using these lines: AD_IMG_BEGIN
AD_IMG_DATA
AD_IMG_END
The panel only answers at the end: OK, INVALID or FULL. FULL means the cache cannot hold the image. The cache is 8 MiB in PSRAM. When it needs room it drops the least recently used image that no key is showing. If the panel needs an image it no longer has, it sends {"type":"image","id":"im:…"} and the host sends it again. Animated icons arrive as frames with a duration each. The CRC32 lets the panel answer INVALID for a corrupt image instead of showing it, and a corrupt icon is more annoying than a missing one. 5. Let the panel answer your AI agent When Claude Code wants permission to run something, the question appears on the panel with Allow and Deny buttons. The agents screen also shows what Claude Code, Codex and ZCode are doing and in which project. Setup adds hooks to ~/.claude...

Powered by Readybot.io