feat(wifi): refactor wifi power save

This commit is contained in:
Zhang Jun Hao
2019-09-03 15:29:54 +08:00
parent df1e032b58
commit 9fd4951863
15 changed files with 80 additions and 15 deletions

View File

@ -75,14 +75,14 @@ void esp_deep_sleep_set_rf_option(uint8_t option);
*
* @return null
*/
void esp_wifi_fpm_open(void);
void esp_wifi_fpm_open(void) __attribute__ ((deprecated));
/**
* @brief Disable force sleep function.
*
* @return null
*/
void esp_wifi_fpm_close(void);
void esp_wifi_fpm_close(void) __attribute__ ((deprecated));
/**
* @brief Wake ESP8266 up from MODEM_SLEEP_T force sleep.
@ -93,7 +93,7 @@ void esp_wifi_fpm_close(void);
*
* @return null
*/
void esp_wifi_fpm_do_wakeup(void);
void esp_wifi_fpm_do_wakeup(void) __attribute__ ((deprecated));
/**
* @brief Set a callback of waken up from force sleep because of time out.
@ -110,7 +110,7 @@ void esp_wifi_fpm_do_wakeup(void);
*
* @return null
*/
void esp_wifi_fpm_set_wakeup_cb(fpm_wakeup_cb cb);
void esp_wifi_fpm_set_wakeup_cb(fpm_wakeup_cb cb) __attribute__ ((deprecated));
/**
* @brief Force ESP8266 enter sleep mode, and it will wake up automatically when time out.
@ -133,7 +133,7 @@ void esp_wifi_fpm_set_wakeup_cb(fpm_wakeup_cb cb);
* @return ESP_ERR_WIFI_PM_MODE_OPEN, fail to sleep, Please call esp_wifi_set_ps(WIFI_PS_NONE) first.
* @return ESP_ERR_WIFI_MODE, fail to sleep, Please call esp_wifi_set_mode(WIFI_MODE_NULL) first.
*/
esp_err_t esp_wifi_fpm_do_sleep(uint32_t sleep_time_in_us);
esp_err_t esp_wifi_fpm_do_sleep(uint32_t sleep_time_in_us) __attribute__ ((deprecated));
/**
* @brief Set sleep type for force sleep function.
@ -144,14 +144,14 @@ esp_err_t esp_wifi_fpm_do_sleep(uint32_t sleep_time_in_us);
*
* @return null
*/
void esp_wifi_fpm_set_sleep_type(wifi_sleep_type_t type);
void esp_wifi_fpm_set_sleep_type(wifi_sleep_type_t type) __attribute__ ((deprecated));
/**
* @brief Get sleep type of force sleep function.
*
* @return sleep type
*/
wifi_sleep_type_t esp_wifi_fpm_get_sleep_type(void);
wifi_sleep_type_t esp_wifi_fpm_get_sleep_type(void) __attribute__ ((deprecated));
/**
* @brief Set a GPIO to wake the ESP8266 up from light-sleep mode
@ -171,12 +171,12 @@ wifi_sleep_type_t esp_wifi_fpm_get_sleep_type(void);
*
* @return null
*/
void esp_wifi_enable_gpio_wakeup(uint32_t gpio_num, gpio_int_type_t intr_status);
void esp_wifi_enable_gpio_wakeup(uint32_t gpio_num, gpio_int_type_t intr_status) __attribute__ ((deprecated));
/**
* @brief Disable the function that the GPIO can wake the ESP8266 up from light-sleep mode.
*/
void esp_wifi_disable_gpio_wakeup(void);
void esp_wifi_disable_gpio_wakeup(void) __attribute__ ((deprecated));
/**
* @brief Enable wakeup by timer

View File

@ -1,10 +1,10 @@
gwen:
core: f467b5d
net80211: 7f8c705
pp: 7f8c705
wpa: f467b5d
espnow: 7f8c705
wps: 7f8c705
core: 743c778
net80211: 743c778
pp: 743c778
wpa: 743c778
espnow: 743c778
wps: 743c778
smartconfig: 2.8.2
phy: 1055_22

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,65 @@
// Copyright 2019-2020 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "esp_sleep.h"
#include "esp_log.h"
static const char* TAG = "FPM";
void esp_wifi_fpm_open(void)
{
ESP_LOGE(TAG, "We have removed this api, please do not call");
}
void esp_wifi_fpm_close(void)
{
ESP_LOGE(TAG, "We have removed this api, please do not call");
}
void esp_wifi_fpm_do_wakeup(void)
{
ESP_LOGE(TAG, "We have removed this api, please do not call");
}
void esp_wifi_fpm_set_wakeup_cb(fpm_wakeup_cb cb)
{
ESP_LOGE(TAG, "We have removed this api, please do not call");
}
esp_err_t esp_wifi_fpm_do_sleep(uint32_t sleep_time_in_us)
{
ESP_LOGE(TAG, "We have removed this api, please do not call");
return ESP_FAIL;
}
void esp_wifi_fpm_set_sleep_type(wifi_sleep_type_t type)
{
ESP_LOGE(TAG, "We have removed this api, please do not call");
}
wifi_sleep_type_t esp_wifi_fpm_get_sleep_type(void)
{
ESP_LOGE(TAG, "We have removed this api, please do not call");
return WIFI_NONE_SLEEP_T;
}
void esp_wifi_enable_gpio_wakeup(uint32_t gpio_num, gpio_int_type_t intr_status)
{
ESP_LOGE(TAG, "We have removed this api, please do not call");
}
void esp_wifi_disable_gpio_wakeup(void)
{
ESP_LOGE(TAG, "We have removed this api, please do not call");
}