mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
chanage(example/power_save): add wifi band (2.4 GHz and 5 GHz) menuconfig option for esp32c5
This commit is contained in:
parent
d63beec095
commit
1604cef916
@ -37,6 +37,21 @@ menu "Example Configuration"
|
||||
For Station, If the station does not receive a beacon frame from the connected SoftAP during the
|
||||
inactive time, disconnect from SoftAP. Default 6s.
|
||||
|
||||
choice EXAMPLE_WIFI_BAND_MODE
|
||||
prompt "wifi band"
|
||||
default EXAMPLE_WIFI_BAND_MODE_2G
|
||||
depends on SOC_WIFI_HE_SUPPORT_5G
|
||||
help
|
||||
WiFi band for the example to use.
|
||||
|
||||
config EXAMPLE_WIFI_BAND_MODE_2G
|
||||
bool "2G"
|
||||
config EXAMPLE_WIFI_BAND_MODE_5G
|
||||
bool "5G"
|
||||
config EXAMPLE_WIFI_BAND_MODE_AUTO
|
||||
bool "Auto"
|
||||
endchoice
|
||||
|
||||
choice EXAMPLE_POWER_SAVE_MODE
|
||||
prompt "power save mode"
|
||||
default EXAMPLE_POWER_SAVE_MIN_MODEM
|
||||
|
@ -36,6 +36,15 @@
|
||||
#define DEFAULT_PS_MODE WIFI_PS_NONE
|
||||
#endif /*CONFIG_POWER_SAVE_MODEM*/
|
||||
|
||||
#if SOC_WIFI_HE_SUPPORT_5G
|
||||
#if CONFIG_EXAMPLE_WIFI_BAND_MODE_2G
|
||||
#define DEFAULT_WIFI_BAND_MODE WIFI_BAND_MODE_2G_ONLY
|
||||
#elif CONFIG_EXAMPLE_WIFI_BAND_MODE_5G
|
||||
#define DEFAULT_WIFI_BAND_MODE WIFI_BAND_MODE_5G_ONLY
|
||||
#else
|
||||
#define DEFAULT_WIFI_BAND_MODE WIFI_BAND_MODE_AUTO
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static const char *TAG = "power_save";
|
||||
|
||||
@ -80,6 +89,9 @@ static void wifi_power_save(void)
|
||||
ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA));
|
||||
ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_STA, &wifi_config));
|
||||
ESP_ERROR_CHECK(esp_wifi_start());
|
||||
#if SOC_WIFI_HE_SUPPORT_5G
|
||||
ESP_ERROR_CHECK(esp_wifi_set_band_mode(DEFAULT_WIFI_BAND_MODE));
|
||||
#endif
|
||||
ESP_ERROR_CHECK(esp_wifi_set_inactive_time(WIFI_IF_STA, DEFAULT_BEACON_TIMEOUT));
|
||||
|
||||
ESP_LOGI(TAG, "esp_wifi_set_ps().");
|
||||
|
Loading…
Reference in New Issue
Block a user