Fixed code to use <screen> tags as base for the xml. Confirmed layout works now.

This commit is contained in:
2026-03-15 15:08:23 -04:00
parent ebb0ccecf4
commit f64860125c
5 changed files with 49 additions and 53 deletions

View File

@@ -11,7 +11,11 @@ internal esp_err_t api_devices_get_handler(httpd_req_t *req)
httpd_resp_set_type(req, "application/json");
httpd_resp_set_hdr(req, "Access-Control-Allow-Origin", "*");
cJSON *root = cJSON_CreateObject();
cJSON_AddStringToObject(root, "default_layout", kDefaultLayoutXml);
cJSON *arr = cJSON_CreateArray();
cJSON_AddItemToObject(root, "devices", arr);
for (int i = 0; i < MAX_DEVICES; i++)
{
@@ -25,11 +29,11 @@ internal esp_err_t api_devices_get_handler(httpd_req_t *req)
}
}
const char *json = cJSON_PrintUnformatted(arr);
const char *json = cJSON_PrintUnformatted(root);
httpd_resp_sendstr(req, json);
free((void *)json);
cJSON_Delete(arr);
cJSON_Delete(root);
return ESP_OK;
}