From 12435f3e8e238f5741c6d5d583158106015bcc38 Mon Sep 17 00:00:00 2001 From: TD-er Date: Sun, 10 May 2026 21:32:30 +0200 Subject: [PATCH] [ESP32P4] Fix crashes on older ESP-HOSTED-MCU fw & detection 32M flash --- src/ESPEasy/net/wifi/ESPEasyWifi.cpp | 8 ++++++++ src/src/Helpers/Hardware_device_info.cpp | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/ESPEasy/net/wifi/ESPEasyWifi.cpp b/src/ESPEasy/net/wifi/ESPEasyWifi.cpp index bfa43f8e9..2587ccb69 100644 --- a/src/ESPEasy/net/wifi/ESPEasyWifi.cpp +++ b/src/ESPEasy/net/wifi/ESPEasyWifi.cpp @@ -504,6 +504,14 @@ bool wifiAPmodeActivelyUsed() // AP not active or soon to be disabled in processDisableAPmode() return false; } +#ifdef BOARD_HAS_SDIO_ESP_HOSTED + if (GetHostedMCUFwVersion() < 0x010000) { + // Hosted fw is too old, function below is not yet implemented + // When calling that function the ESP32-P4 will crash. + return false; + } +#endif + return SOFTAP_STATION_COUNT != 0; // FIXME TD-er: is effectively checking for AP active enough or must really check for connected clients to prevent automatic wifi diff --git a/src/src/Helpers/Hardware_device_info.cpp b/src/src/Helpers/Hardware_device_info.cpp index 8598556be..bc2486c8e 100644 --- a/src/src/Helpers/Hardware_device_info.cpp +++ b/src/src/Helpers/Hardware_device_info.cpp @@ -140,8 +140,8 @@ uint32_t getFlashRealSizeInBytes() { if (res == 0) { #if defined(ESP32) #ifdef ESP32P4 - // TODO TD-er: Implement - res = 1 << 24; + const int32_t flash_cap_MB = getEmbeddedFlashSize(); + res = flash_cap_MB << 20; #else res = (1 << ((getFlashChipId() >> 16) & 0xFF)); #endif