File tree Expand file tree Collapse file tree 3 files changed +20
-1
lines changed Expand file tree Collapse file tree 3 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ config WIFI_PASSWORD
14
14
15
15
choice POWER_SAVE_MODE
16
16
prompt "power save mode"
17
- default POWER_SAVE_NONE
17
+ default POWER_SAVE_MODEM
18
18
help
19
19
Power save mode for the esp32 to use.
20
20
Original file line number Diff line number Diff line change 17
17
#include "esp_wifi.h"
18
18
#include "esp_log.h"
19
19
#include "esp_event_loop.h"
20
+ #include "esp_pm.h"
20
21
#include "nvs_flash.h"
21
22
22
23
/*set the ssid and password via "make menuconfig"*/
@@ -89,5 +90,17 @@ void app_main()
89
90
}
90
91
ESP_ERROR_CHECK ( ret );
91
92
93
+ #if CONFIG_PM_ENABLE
94
+ // Configure dynamic frequency scaling: maximum frequency is set in sdkconfig,
95
+ // minimum frequency is XTAL.
96
+ rtc_cpu_freq_t max_freq ;
97
+ rtc_clk_cpu_freq_from_mhz (CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ , & max_freq );
98
+ esp_pm_config_esp32_t pm_config = {
99
+ .max_cpu_freq = max_freq ,
100
+ .min_cpu_freq = RTC_CPU_FREQ_XTAL
101
+ };
102
+ ESP_ERROR_CHECK ( esp_pm_configure (& pm_config ) );
103
+ #endif // CONFIG_PM_ENABLE
104
+
92
105
wifi_power_save ();
93
106
}
Original file line number Diff line number Diff line change
1
+ # Use lower CPU frequency
2
+ CONFIG_ESP32_DEFAULT_CPU_FREQ_80=y
3
+ # Enable support for power management
4
+ CONFIG_PM_ENABLE=y
5
+ # Use RTC timer as reference
6
+ CONFIG_PM_USE_RTC_TIMER_REF=y
You can’t perform that action at this time.
0 commit comments