Step 2.1: web server, embedded UI, /api/status, /api/reboot
- aes67_web: httpd (wildcard URI matching), serves web/index.html embedded via EMBED_TXTFILES, status registry (status_register) and route registry (web_register_uri), GET /api/status, POST /api/reboot (restarts 0.5 s after the response). - Status fields come from each core component: aes67_net (ip, aes67_ip, mac, link), aes67_health (fw, uptime_s, heap_free, psram_free), aes67_tx stub (tx_packets, underruns = 0). No ptp object yet, so the UI shows "no data". - Verified on board: / serves index.html byte-identical (27601 B), /api/status returns live values, reboot via API returns in ~12 s. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,7 +1,19 @@
|
||||
#include "aes67_health.h"
|
||||
|
||||
// Stub (build step 0).
|
||||
#include "aes67_web.h"
|
||||
#include "esp_app_desc.h"
|
||||
#include "esp_heap_caps.h"
|
||||
#include "esp_timer.h"
|
||||
|
||||
static void health_status(cJSON *st)
|
||||
{
|
||||
cJSON_AddStringToObject(st, "fw", esp_app_get_description()->version);
|
||||
cJSON_AddNumberToObject(st, "uptime_s", (double)(esp_timer_get_time() / 1000000));
|
||||
cJSON_AddNumberToObject(st, "heap_free", heap_caps_get_free_size(MALLOC_CAP_INTERNAL));
|
||||
cJSON_AddNumberToObject(st, "psram_free", heap_caps_get_free_size(MALLOC_CAP_SPIRAM));
|
||||
}
|
||||
|
||||
esp_err_t aes67_health_init(void)
|
||||
{
|
||||
return ESP_OK;
|
||||
return status_register(health_status);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user