feat: support ESP32-S3 new board bring-up
This commit is contained in:
@@ -15,7 +15,12 @@
|
||||
#include "sdkconfig.h"
|
||||
#include "ssid_manager.h"
|
||||
#include "wifi_manager.h"
|
||||
#if __has_include("wifi_storage_hooks.h")
|
||||
#include "wifi_storage_hooks.h"
|
||||
#define WIFI_PORTAL_HAS_STORAGE_HOOKS 1
|
||||
#else
|
||||
#define WIFI_PORTAL_HAS_STORAGE_HOOKS 0
|
||||
#endif
|
||||
|
||||
static const char *TAG = "wifi_portal";
|
||||
|
||||
@@ -49,6 +54,7 @@ static void install_wifi_storage_hooks(void)
|
||||
return;
|
||||
}
|
||||
|
||||
#if WIFI_PORTAL_HAS_STORAGE_HOOKS
|
||||
const wifi_storage_hooks_t hooks = {
|
||||
.set_string = platform_storage_set_string,
|
||||
.get_string = platform_storage_get_string,
|
||||
@@ -59,6 +65,9 @@ static void install_wifi_storage_hooks(void)
|
||||
.erase = platform_storage_erase,
|
||||
};
|
||||
wifi_storage_set_hooks(&hooks);
|
||||
#else
|
||||
ESP_LOGW(TAG, "Wi-Fi storage hook API unavailable; using component default storage");
|
||||
#endif
|
||||
s_installed = true;
|
||||
}
|
||||
|
||||
@@ -198,6 +207,21 @@ static void seed_default_credentials(const char *ssid, const char *password)
|
||||
return;
|
||||
}
|
||||
|
||||
bool configured_ssid_saved = false;
|
||||
for (const auto &item : manager.GetSsidList()) {
|
||||
if (item.ssid == ssid) {
|
||||
configured_ssid_saved = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (saved_count > 0U && !configured_ssid_saved) {
|
||||
ESP_LOGI(TAG,
|
||||
"Configured seed SSID changed to \"%s\"; replacing %u stale credential candidate(s)",
|
||||
ssid,
|
||||
(unsigned)saved_count);
|
||||
manager.Clear();
|
||||
}
|
||||
|
||||
manager.AddSsid(ssid, password != NULL ? password : "");
|
||||
ESP_LOGI(TAG,
|
||||
"Ensured configured Wi-Fi credentials for SSID \"%s\" with %u previous candidate(s)",
|
||||
|
||||
Reference in New Issue
Block a user