From 982f038e75dcede125d05fdcf30bed85d25a428a Mon Sep 17 00:00:00 2001 From: jedarden Date: Fri, 17 Apr 2026 11:19:32 -0400 Subject: [PATCH] fix(firmware): report actual flash chip size in hello message via esp_flash_get_size() Replaces the hardcoded flash_mb:16 with a runtime query so the mothership receives the correct physical flash size regardless of the hardware variant. On the 4MB XMC board this will now report 4; on a 16MB board it reports 16. Co-Authored-By: Claude Sonnet 4.6 --- firmware/main/websocket.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/firmware/main/websocket.c b/firmware/main/websocket.c index a19e122..32a10c2 100644 --- a/firmware/main/websocket.c +++ b/firmware/main/websocket.c @@ -8,6 +8,7 @@ #include "esp_timer.h" #include "esp_system.h" #include "esp_netif.h" +#include "esp_flash.h" #include "driver/temperature_sensor.h" #include "esp_ota_ops.h" #include "esp_http_client.h" @@ -289,7 +290,9 @@ esp_err_t websocket_send_hello(void) { cJSON_AddItemToObject(root, "capabilities", caps); cJSON_AddStringToObject(root, "chip", "ESP32-S3"); - cJSON_AddNumberToObject(root, "flash_mb", 16); + uint32_t flash_size = 0; + esp_flash_get_size(NULL, &flash_size); + cJSON_AddNumberToObject(root, "flash_mb", (int)(flash_size / (1024 * 1024))); cJSON_AddNumberToObject(root, "uptime_ms", esp_timer_get_time() / 1000); // AP BSSID and channel (for passive radar auto-detection)