modified: firmware/main/include/leds.h
modified: firmware/main/include/wifi.h modified: firmware/main/src/leds.c modified: firmware/main/src/main.c modified: firmware/main/src/wifi.c modified: firmware/sdkconfig Enhance power management and disable wifi temporarily for temp testing
This commit is contained in:
1 parent
6ceb9ed7af
commit
2f48a98556
6 files changed
+66
-27
No files matched your search
@@ -9,20 +9,36 @@
|
||||
esp_err_t wifi_init(void) {
|
||||
tcpip_adapter_init();
|
||||
ESP_ERROR_CHECK(esp_event_loop_create_default());
|
||||
|
||||
wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
|
||||
|
||||
ESP_ERROR_CHECK(esp_wifi_init(&cfg));
|
||||
ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA));
|
||||
|
||||
wifi_config_t sta_config = {
|
||||
.sta = {
|
||||
.ssid = CONFIG_ESP_WIFI_SSID,
|
||||
.password = CONFIG_ESP_WIFI_PASSWORD,
|
||||
},
|
||||
};
|
||||
|
||||
ESP_ERROR_CHECK(esp_wifi_set_config(ESP_IF_WIFI_STA, &sta_config));
|
||||
ESP_ERROR_CHECK(esp_wifi_start());
|
||||
ESP_ERROR_CHECK(esp_wifi_connect());
|
||||
|
||||
// Enable power saving
|
||||
ESP_ERROR_CHECK(esp_wifi_set_ps(WIFI_PS_MIN_MODEM));
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
|
||||
esp_err_t wifi_sleep() {
|
||||
/*
|
||||
// Enter light sleep mode
|
||||
wifi_fpm_open(); // Enable modem sleep
|
||||
wifi_fpm_do_sleep(0xFFFFFFF); // Enter sleep mode indefinitely
|
||||
// The system will wake up when an interrupt occurs
|
||||
wifi_fpm_close(); // Close modem sleep mode after waking up
|
||||
*/
|
||||
return ESP_OK;
|
||||
}
|
||||
Reference in new issue
Block a user