From 1405120a3a9cf63083892e5b3c9ea0b7f11064a2 Mon Sep 17 00:00:00 2001 From: pankore <86098180+pankore@users.noreply.github.com> Date: Sun, 19 Mar 2023 00:36:39 +0800 Subject: [PATCH] [Ameba] ClearWiFiConfig bug fix (#25571) * Update AmebaUtils.cpp fix clear wifi config * cleanup * fix compile error * restyle --- src/platform/Ameba/AmebaUtils.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/platform/Ameba/AmebaUtils.cpp b/src/platform/Ameba/AmebaUtils.cpp index 1d202ccd53f644..72d0e7fda0c4cc 100644 --- a/src/platform/Ameba/AmebaUtils.cpp +++ b/src/platform/Ameba/AmebaUtils.cpp @@ -116,11 +116,15 @@ CHIP_ERROR AmebaUtils::GetWiFiConfig(rtw_wifi_config_t * config) CHIP_ERROR AmebaUtils::ClearWiFiConfig() { - // Clear Ameba WiFi station config + /* Clear Wi-Fi Configurations in Storage */ CHIP_ERROR err = CHIP_NO_ERROR; - rtw_wifi_config_t wifiConfig; - memset(&wifiConfig, 0, sizeof(wifiConfig)); - err = SetWiFiConfig(&wifiConfig); + err = PersistedStorage::KeyValueStoreMgr().Delete(kWiFiSSIDKeyName); + SuccessOrExit(err); + + err = PersistedStorage::KeyValueStoreMgr().Delete(kWiFiCredentialsKeyName); + SuccessOrExit(err); + +exit: return err; }