Moved to lvgl 9.4 because 9.5 has removed runtime xml support.

Made basic example of editing xml layout from backend.
This commit is contained in:
2026-03-15 14:47:32 -04:00
parent baa0a8b1ba
commit ebb0ccecf4
13 changed files with 236 additions and 58 deletions

View File

@@ -53,7 +53,15 @@ The following REST endpoints handle the device lifecycle and image generation:
### Subsystems Config
The ESP-IDF project configuration (`sdkconfig.defaults`) must be modified to enable the `CONFIG_LV_USE_XML=y` flag, which compiles the LVGL XML parser component into the firmware image.
### XML Runtime Integration
The user provided documentation for the `LV_USE_XML` runtime feature. We must:
1. Call `lv_xml_register_component_from_data("current_device", dev->xml_layout)` to register the XML payload.
2. Check if the XML string contains `<screen>`. If it does, LVGL expects us to instantiate it as a full screen using `lv_obj_t * root = lv_xml_create_screen("current_device");`.
3. If it does not contain `<screen>`, it's just a regular component/widget, so we create it *on* the active screen using `lv_obj_t * root = lv_xml_create(scr, "current_device", NULL);`.
4. Fallback to a string label if the XML is empty or parsing fails.
### Frontend
- **DeviceManager.svelte:** A new component accessible from the Sidebar. It fetches the device list on load.
- **XML Uploading:** For each device card, a text area allows the user to paste an LVGL XML string. Clicking "Save Layout" updates the device via `POST /api/devices/layout`.
- **Debug Features:** A collapsed section (e.g. `<details>`) in the UI will contain a button to "Register Debug Device" that triggers a POST to `/api/devices/register` with a random or hardcoded MAC (e.g., `00:11:22:33:44:55`).
- **Integration:** The `App.svelte` router will be updated to include the `'devices'` view state alongside Dashboard, Tasks, and Users.