DocsReferenceAPI reference
Screen
Screenshots, the UI object tree and full-screen mockup previews
GET /v1/snap#
Screenshot: 320×172 raw RGB565 pixels
Everything actually on screen (all layers, including the status bar, system pages and mockup preview). Width and height are in the reply headers; landscape is 320×172, 110080 bytes. Also in the rescue firmware
Reply#
Raw pixels
The reply is screen pixels (RGB565).
application/octet-stream
Error codes#
| Status | Code | Description |
|---|---|---|
500 | snap_failed | Display not ready, out of memory, or no UI lock within 2 s (message is the ESP-IDF error name). Try again later |
For errors any endpoint can return, see Common errors.
GET /v1/ui#
UI object tree (coordinates, text)
LVGL object tree: type, absolute screen coordinates and size, label text, bar value and hidden. At most 400 nodes and 12 levels; cut subtrees carry children_omitted and the reply carries truncated. For automated tests and agents finding things on screen
Parameters#
| Parameter | Type | Required | Values | Range | Description |
|---|---|---|---|---|---|
layer | string | app top all; default app | app: the app area (default); top: the status bar and system pages; all: one root node per layer (app, top, sys) |
Reply#
Object tree
LVGL object tree of the UI
| Field | Type | Required | Values | Range | Description |
|---|---|---|---|---|---|
ok | boolean | Yes | true | Always true | |
tree | object[] | Yes | Top-level nodes | ||
type | string | Yes | LVGL class name without lv_, such as obj label bar arc image button | ||
x | integer | Yes | Screen X of the top-left corner | ||
y | integer | Yes | Screen Y of the top-left corner | ||
w | integer | Yes | Width | ||
h | integer | Yes | Height | ||
text | string | ≤ 200 bytes | Label text (labels only), up to 200 bytes | ||
text_truncated | boolean | true | The text was cut | ||
value | integer | Value (bar, slider and arc only) | |||
hidden | boolean | Yes | Hidden | ||
children | object[] | Child objects; absent if none | |||
children_omitted | integer | ≥ 1 | Child objects left out | ||
layer | string | app top sys | Layer (root nodes of layer=all only) | ||
nodes | integer | Yes | 0–400 | Node count (at most 400) | |
truncated | boolean | true | Some nodes were left out (over 400 or 12 levels); absent otherwise |
Error codes#
| Status | Code | Description |
|---|---|---|
400 | bad_layer | layer is not app / top / all |
503 | busy | No UI lock within 1 s. Try again |
For errors any endpoint can return, see Common errors.
GET /v1/ui/preview#
Full-screen mockup preview state
Whether a mockup preview is showing and how many seconds are left
Reply#
Preview state
State of the full-screen mockup preview
| Field | Type | Required | Values | Range | Description |
|---|---|---|---|---|---|
ok | boolean | Yes | true | Always true | |
active | boolean | Yes | Showing | ||
left_s | integer | Yes | 0–600 | Seconds left; 0 when not showing |
Error codes#
For errors any endpoint can return, see Common errors.
PUT /v1/ui/preview#
Show a 320×172 mockup full screen (RGB565)
Shows a 320×172 mockup on top of everything (status bar and HID safety outline included) and removes it after seconds; pushing another replaces it and restarts the timer; the backlight stays on meanwhile. The body is 110080 bytes in the format of GET /v1/snap. For viewing mockups only; changes no setting. Host: stick preview mockup.png
Parameters#
| Parameter | Type | Required | Values | Range | Description |
|---|---|---|---|---|---|
seconds | integer | default 30 | 1–600 | Seconds to show, 1–600, default 30 |
Request body#
application/octet-stream
Raw little-endian RGB565 pixels, row by row, 2 bytes each (red 0xF800 is 00 f8)
Examples#
Solid red#
Pixel 0xF800 (little-endian 00 f8) repeated 55040 times (x-repeat), 110080 bytes
00f8Reply#
Showing
State of the full-screen mockup preview
| Field | Type | Required | Values | Range | Description |
|---|---|---|---|---|---|
ok | boolean | Yes | true | Always true | |
active | boolean | Yes | Showing | ||
left_s | integer | Yes | 0–600 | Seconds left; 0 when not showing |
Error codes#
| Status | Code | Description |
|---|---|---|
400 | bad_args | The body is not 110080 bytes, or seconds is not an integer in 1–600 |
409 | bad_orientation | The screen is not landscape 320×172 |
503 | busy | No UI lock. Try again |
For errors any endpoint can return, see Common errors.
DELETE /v1/ui/preview#
Remove the mockup preview
Removes the mockup preview at once; succeeds when none is showing
Reply#
Removed
State of the full-screen mockup preview
| Field | Type | Required | Values | Range | Description |
|---|---|---|---|---|---|
ok | boolean | Yes | true | Always true | |
active | boolean | Yes | Showing | ||
left_s | integer | Yes | 0–600 | Seconds left; 0 when not showing |
Error codes#
For errors any endpoint can return, see Common errors.
GET /v1/display#
Screen settings: brightness, dimming, backlight off, interface style
When idle the device first dims, then turns the backlight off (only the backlight; the device keeps running). Pressing BOOT, a system page or toast, setting the monitor page and a preview all count as activity and light it up. The interface style is the look of the system interface (home, monitor, system pages, status bar, toasts); styles lists the choices. Saved on the device and applied at once; both kernel and rescue firmware use the backlight settings, rescue always uses style b, the endpoint is kernel only
Reply#
Screen settings
Screen settings: brightness, dimming, backlight off, interface style
| Field | Type | Required | Values | Range | Description |
|---|---|---|---|---|---|
ok | boolean | Yes | true | Always true | |
brightness | integer | Yes | 10–100 | Brightness while active (%), default 80 | |
dim_s | integer | Yes | 0–86400 | Seconds idle before dimming; 0 = never; otherwise 10–86400, default 60 | |
off_s | integer | Yes | 0–86400 | Seconds idle before the backlight turns off; 0 = never (always on); otherwise 10–86400 and greater than dim_s, default 300 | |
dim_pct | integer | Yes | Brightness when dimmed (%), fixed at 20; the active brightness if that is lower | ||
style | string | Yes | Current interface style (an id from styles), default b (Soft glow) | ||
styles | object[] | Yes | Available interface styles in registration order, the default first | ||
id | string | Yes | Style id (lowercase ASCII), used as style in POST | ||
name | string | Yes | Chinese name, e.g. 柔光 | ||
name_en | string | Yes | English name, e.g. Soft glow |
Error codes#
For errors any endpoint can return, see Common errors.
POST /v1/display#
Change screen settings or the interface style; saved and applied at once
Only the fields given change; replies like GET. Counts as activity, so the screen lights up at the new brightness right away. With style the interface style changes: no restart, the system interface is rebuilt in the new style at once (the system page, toast and monitor page on screen follow), what apps draw is left alone
Request body#
application/json
Only the fields given are changed; the rest stay
| Field | Type | Required | Values | Range | Description |
|---|---|---|---|---|---|
brightness | integer | 10–100 | Brightness while active (%), default 80 | ||
dim_s | integer | 0–86400 | Seconds idle before dimming; 0 = never; otherwise 10–86400, default 60 | ||
off_s | integer | 0–86400 | Seconds idle before the backlight turns off; 0 = never (always on); otherwise 10–86400 and greater than dim_s, default 300 | ||
style | string | Switch the interface style: one of the ids in styles. Saved on the device; the system interface is rebuilt in the new style at once (no restart; what apps draw is left alone) |
Examples#
Always on#
{"dim_s": 0, "off_s": 0}Power saving: dim after 30 s, off after 2 min#
{"brightness": 60, "dim_s": 30, "off_s": 120}Factory settings#
{"brightness": 80, "dim_s": 60, "off_s": 300}Back to the default style (Soft glow)#
{"style": "b"}Reply#
Saved; current settings
Screen settings: brightness, dimming, backlight off, interface style
| Field | Type | Required | Values | Range | Description |
|---|---|---|---|---|---|
ok | boolean | Yes | true | Always true | |
brightness | integer | Yes | 10–100 | Brightness while active (%), default 80 | |
dim_s | integer | Yes | 0–86400 | Seconds idle before dimming; 0 = never; otherwise 10–86400, default 60 | |
off_s | integer | Yes | 0–86400 | Seconds idle before the backlight turns off; 0 = never (always on); otherwise 10–86400 and greater than dim_s, default 300 | |
dim_pct | integer | Yes | Brightness when dimmed (%), fixed at 20; the active brightness if that is lower | ||
style | string | Yes | Current interface style (an id from styles), default b (Soft glow) | ||
styles | object[] | Yes | Available interface styles in registration order, the default first | ||
id | string | Yes | Style id (lowercase ASCII), used as style in POST | ||
name | string | Yes | Chinese name, e.g. 柔光 | ||
name_en | string | Yes | English name, e.g. Soft glow |
Error codes#
| Status | Code | Description |
|---|---|---|
400 | bad_json | The body is not a JSON object |
400 | bad_display | Invalid value (see message): brightness 10–100; dim_s and off_s are 0 or 10–86400, and off_s must exceed dim_s when both are set; style not in styles (message lists the choices). Nothing changed |
500 | nvs | Saving failed: the backlight settings are applied but the old ones return after a restart; the style did not change. Retry; if it persists, check stick logs |
For errors any endpoint can return, see Common errors.