From f763ae05dcd717bbb23cece0bbf61230e606ecc9 Mon Sep 17 00:00:00 2001 From: moecinnamo Date: Fri, 12 Sep 2025 14:57:04 +0800 Subject: [PATCH] psram size log set --- main/main.cc | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/main/main.cc b/main/main.cc index b721580..ee9ab86 100755 --- a/main/main.cc +++ b/main/main.cc @@ -8,6 +8,8 @@ #include "application.h" #include "system_info.h" +#include + #define TAG "main" extern "C" void app_main(void) @@ -17,7 +19,8 @@ extern "C" void app_main(void) // Initialize NVS flash for WiFi configuration esp_err_t ret = nvs_flash_init(); - if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) { + if (ret == ESP_ERR_NVS_NO_FREE_PAGES || ret == ESP_ERR_NVS_NEW_VERSION_FOUND) + { ESP_LOGW(TAG, "Erasing NVS flash to fix corruption"); ESP_ERROR_CHECK(nvs_flash_erase()); ret = nvs_flash_init(); @@ -25,14 +28,18 @@ extern "C" void app_main(void) ESP_ERROR_CHECK(ret); // Detecting PSRAM - if (esp_spiram_is_initialized()) { - ESP_LOGI("PSRAM", "PSRAM is available and initialized."); - } else { + if (esp_psram_is_initialized()) + { + size_t psram_size = esp_psram_get_size(); + ESP_LOGI("PSRAM", "PSRAM is available and initialized. Total size: %zu bytes", psram_size); + } + else + { ESP_LOGE("PSRAM", "PSRAM not found or not initialized."); } // Launch the application - auto& app = Application::GetInstance(); + auto &app = Application::GetInstance(); app.Start(); app.MainEventLoop(); }