feat(wifi): retain multiple network credentials

This commit is contained in:
chenjintao
2026-08-24 16:16:16 +08:00
parent 23f4969404
commit ae27d5bbaa
6 changed files with 67 additions and 29 deletions
+6 -4
View File
@@ -15,8 +15,9 @@ typedef struct {
/**
* @brief Initialize Wi-Fi portal defaults and seed credentials.
*
* This writes the provided SSID/password into NVS if no credentials exist yet.
* The underlying Wi-Fi manager is initialized lazily when starting STA or AP.
* This saves the provided SSID/password as the highest-priority entry while
* retaining existing credentials. The underlying Wi-Fi manager is initialized
* lazily when starting STA or AP.
*/
esp_err_t wifi_portal_init_defaults(const char *seed_ssid, const char *seed_password);
@@ -50,8 +51,9 @@ esp_err_t wifi_portal_connect_sta(int timeout_ms);
/**
* @brief Trial-connect with credentials without persisting them first.
*
* On success, the trial credentials atomically replace the saved credential
* list. On failure, the previous in-memory and NVS credentials remain intact.
* On success, the trial credentials are saved as the highest-priority entry
* while older credentials are retained. On failure, the previous in-memory
* and NVS credentials remain intact.
*/
esp_err_t wifi_portal_connect_sta_with_credentials(const char *ssid,
const char *password,