From 2bacd7abe2bf7847991462430ae58c6a5db3400c Mon Sep 17 00:00:00 2001 From: Li Shuai Date: Tue, 18 May 2021 20:03:09 +0800 Subject: [PATCH] fix wifi mac sleep bug when wifi is initialized multiple times --- components/esp_hw_support/sleep_modes.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/esp_hw_support/sleep_modes.c b/components/esp_hw_support/sleep_modes.c index 02e9421708..9c1562de7b 100644 --- a/components/esp_hw_support/sleep_modes.c +++ b/components/esp_hw_support/sleep_modes.c @@ -191,7 +191,7 @@ esp_err_t esp_register_mac_bb_pd_callback(mac_bb_power_down_cb_t cb) int index = MAC_BB_POWER_DOWN_CB_NO; for (int i = MAC_BB_POWER_DOWN_CB_NO - 1; i >= 0; i--) { if (s_mac_bb_power_down_cb[i] == cb) { - return ESP_ERR_INVALID_STATE; + return ESP_OK; } if (s_mac_bb_power_down_cb[i] == NULL) { @@ -232,7 +232,7 @@ esp_err_t esp_register_mac_bb_pu_callback(mac_bb_power_up_cb_t cb) int index = MAC_BB_POWER_UP_CB_NO; for (int i = MAC_BB_POWER_UP_CB_NO - 1; i >= 0; i--) { if (s_mac_bb_power_up_cb[i] == cb) { - return ESP_ERR_INVALID_STATE; + return ESP_OK; } if (s_mac_bb_power_up_cb[i] == NULL) {