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 <noreply@anthropic.com>
This commit is contained in:
jedarden 2026-04-17 11:19:32 -04:00
parent 212a676f27
commit 982f038e75

View file

@ -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)