DocsReferenceAPI reference

Screen

Screenshots, the UI object tree and full-screen mockup previews

GET /v1/snap#

Screenshot: 320×172 raw RGB565 pixels

Signature required

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#

StatusCodeDescription
500snap_failedDisplay 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)

Signature required Kernel only

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#

ParameterTypeRequiredValuesRangeDescription
layerstringapp top all; default appapp: 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

FieldTypeRequiredValuesRangeDescription
okbooleanYestrueAlways true
treeobject[]YesTop-level nodes
typestringYesLVGL class name without lv_, such as obj label bar arc image button
xintegerYesScreen X of the top-left corner
yintegerYesScreen Y of the top-left corner
wintegerYesWidth
hintegerYesHeight
textstring≤ 200 bytesLabel text (labels only), up to 200 bytes
text_truncatedbooleantrueThe text was cut
valueintegerValue (bar, slider and arc only)
hiddenbooleanYesHidden
childrenobject[]Child objects; absent if none
children_omittedinteger≥ 1Child objects left out
layerstringapp top sysLayer (root nodes of layer=all only)
nodesintegerYes0–400Node count (at most 400)
truncatedbooleantrueSome nodes were left out (over 400 or 12 levels); absent otherwise

Error codes#

StatusCodeDescription
400bad_layerlayer is not app / top / all
503busyNo 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

Signature required Kernel only

Whether a mockup preview is showing and how many seconds are left

Reply#

Preview state

State of the full-screen mockup preview

FieldTypeRequiredValuesRangeDescription
okbooleanYestrueAlways true
activebooleanYesShowing
left_sintegerYes0–600Seconds 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)

Signature required Kernel only

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#

ParameterTypeRequiredValuesRangeDescription
secondsintegerdefault 301–600Seconds 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

HEX
00f8

Reply#

Showing

State of the full-screen mockup preview

FieldTypeRequiredValuesRangeDescription
okbooleanYestrueAlways true
activebooleanYesShowing
left_sintegerYes0–600Seconds left; 0 when not showing

Error codes#

StatusCodeDescription
400bad_argsThe body is not 110080 bytes, or seconds is not an integer in 1–600
409bad_orientationThe screen is not landscape 320×172
503busyNo UI lock. Try again

For errors any endpoint can return, see Common errors.

DELETE /v1/ui/preview#

Remove the mockup preview

Signature required Kernel only

Removes the mockup preview at once; succeeds when none is showing

Reply#

Removed

State of the full-screen mockup preview

FieldTypeRequiredValuesRangeDescription
okbooleanYestrueAlways true
activebooleanYesShowing
left_sintegerYes0–600Seconds 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

Signature required Kernel only

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

FieldTypeRequiredValuesRangeDescription
okbooleanYestrueAlways true
brightnessintegerYes10–100Brightness while active (%), default 80
dim_sintegerYes0–86400Seconds idle before dimming; 0 = never; otherwise 10–86400, default 60
off_sintegerYes0–86400Seconds idle before the backlight turns off; 0 = never (always on); otherwise 10–86400 and greater than dim_s, default 300
dim_pctintegerYesBrightness when dimmed (%), fixed at 20; the active brightness if that is lower
stylestringYesCurrent interface style (an id from styles), default b (Soft glow)
stylesobject[]YesAvailable interface styles in registration order, the default first
idstringYesStyle id (lowercase ASCII), used as style in POST
namestringYesChinese name, e.g. 柔光
name_enstringYesEnglish 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

Signature required Kernel only

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

FieldTypeRequiredValuesRangeDescription
brightnessinteger10–100Brightness while active (%), default 80
dim_sinteger0–86400Seconds idle before dimming; 0 = never; otherwise 10–86400, default 60
off_sinteger0–86400Seconds idle before the backlight turns off; 0 = never (always on); otherwise 10–86400 and greater than dim_s, default 300
stylestringSwitch 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#

JSON
{"dim_s": 0, "off_s": 0}

Power saving: dim after 30 s, off after 2 min#

JSON
{"brightness": 60, "dim_s": 30, "off_s": 120}

Factory settings#

JSON
{"brightness": 80, "dim_s": 60, "off_s": 300}

Back to the default style (Soft glow)#

JSON
{"style": "b"}

Reply#

Saved; current settings

Screen settings: brightness, dimming, backlight off, interface style

FieldTypeRequiredValuesRangeDescription
okbooleanYestrueAlways true
brightnessintegerYes10–100Brightness while active (%), default 80
dim_sintegerYes0–86400Seconds idle before dimming; 0 = never; otherwise 10–86400, default 60
off_sintegerYes0–86400Seconds idle before the backlight turns off; 0 = never (always on); otherwise 10–86400 and greater than dim_s, default 300
dim_pctintegerYesBrightness when dimmed (%), fixed at 20; the active brightness if that is lower
stylestringYesCurrent interface style (an id from styles), default b (Soft glow)
stylesobject[]YesAvailable interface styles in registration order, the default first
idstringYesStyle id (lowercase ASCII), used as style in POST
namestringYesChinese name, e.g. 柔光
name_enstringYesEnglish name, e.g. Soft glow

Error codes#

StatusCodeDescription
400bad_jsonThe body is not a JSON object
400bad_displayInvalid 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
500nvsSaving 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.

View the source of this page on GitHub