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

@@ -32,7 +32,7 @@ internal esp_err_t api_devices_register_handler(httpd_req_t *req)
}
cJSON *mac_item = cJSON_GetObjectItem(body, "mac");
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'");
@@ -41,10 +41,10 @@ internal esp_err_t api_devices_register_handler(httpd_req_t *req)
bool was_new = false;
device_t *dev = register_device(mac_item->valuestring, &was_new);
cJSON_Delete(body);
if (!dev)
{
cJSON_Delete(body);
httpd_resp_send_err(req, HTTPD_500_INTERNAL_SERVER_ERROR, "Device limit reached");
return ESP_FAIL;
}
@@ -61,6 +61,8 @@ internal esp_err_t api_devices_register_handler(httpd_req_t *req)
}
cJSON_AddStringToObject(resp, "mac", dev->mac);
cJSON_Delete(body);
const char *json = cJSON_PrintUnformatted(resp);
httpd_resp_sendstr(req, json);