Device Library Central
menu.json
Central-role static menu tree (main/interface/interface_central.c). Loaded when central connects (ble_central_core.c calls interface_central_init(paths->central->menu)).
Root
| Field | Required | Notes |
|---|---|---|
menus | Yes | Non-empty array of menu nodes. |
initial_menu | No | String id of the first visible node; if omitted, the first valid entry in menus becomes initial. |
states | No | Registers named UI state keys for set_state / state bar (key strings only parsed; name is ignored by firmware). At most 10 keys (CENTRAL_STATE_MAX_ENTRIES). key length capped at 9 usable characters (CENTRAL_STATE_KEY_LEN). |
Menu node (menus[])
| Field | Notes |
|---|---|
id | Required. Used with push_menu("id") and WebSocket central / menu_select. |
title | Optional; defaults to id if missing. |
on_enter | Optional Lua field string; dispatched with lua_call_from_field when the node becomes active (initial load, push_menu, or pop_menu back). Same syntax as items[].id (see below). |
items | Array of selectable rows (optional); omit or [] for an empty panel. Rows need id and label or they are skipped. At most 8 entries (CENTRAL_MENU_MAX_ITEMS); extras are dropped with a log warning. |
Item id → Lua dispatch
Selecting a row passes items[].id through lua_call_from_field (also used for on_enter):
- Plain name: e.g.
turn_on→ calls global Lua handlerturn_onwith no argument. name(args): e.g.set_color(FF0000)→ functionset_colorwith argument stringFF0000(lua_call_parseinlua_hook.c). Matching)required.
Reserved menu actions are Lua-side (e.g. scripts may define wrappers that call push_menu / pop_menu).
Navigation limits
Menu stack depth is 4 (CENTRAL_MENU_STACK_DEPTH).