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

@@ -60,14 +60,14 @@ internal esp_err_t api_devices_layout_handler(httpd_req_t *req)
cJSON *mac_item = cJSON_GetObjectItem(body, "mac");
cJSON *xml_item = cJSON_GetObjectItem(body, "xml");
if (!cJSON_IsString(mac_item) || strlen(mac_item->valuestring) == 0)
if (!cJSON_IsString(mac_item) || !mac_item->valuestring || strlen(mac_item->valuestring) == 0)
{
cJSON_Delete(body);
httpd_resp_send_err(req, HTTPD_400_BAD_REQUEST, "Missing 'mac'");
return ESP_FAIL;
}
if (!cJSON_IsString(xml_item))
if (!cJSON_IsString(xml_item) || !xml_item->valuestring)
{
cJSON_Delete(body);
httpd_resp_send_err(req, HTTPD_400_BAD_REQUEST, "Missing 'xml'");
@@ -75,10 +75,10 @@ internal esp_err_t api_devices_layout_handler(httpd_req_t *req)
}
bool ok = update_device_layout(mac_item->valuestring, xml_item->valuestring);
cJSON_Delete(body);
if (!ok)
{
cJSON_Delete(body);
httpd_resp_send_err(req, HTTPD_404_NOT_FOUND, "Device not found");
return ESP_FAIL;
}
@@ -86,6 +86,8 @@ internal esp_err_t api_devices_layout_handler(httpd_req_t *req)
ESP_LOGI(kTagDeviceLayout, "Updated layout for %s (%zu bytes)", mac_item->valuestring,
strlen(xml_item->valuestring));
cJSON_Delete(body);
httpd_resp_sendstr(req, "{\"status\":\"ok\"}");
return ESP_OK;
}