diff --git a/examples/system/ota/advanced_https_ota/main/advanced_https_ota_example.c b/examples/system/ota/advanced_https_ota/main/advanced_https_ota_example.c index 3f05a3f37..e6b4bd15c 100644 --- a/examples/system/ota/advanced_https_ota/main/advanced_https_ota_example.c +++ b/examples/system/ota/advanced_https_ota/main/advanced_https_ota_example.c @@ -20,6 +20,10 @@ #include "nvs_flash.h" #include "protocol_examples_common.h" +#if CONFIG_EXAMPLE_CONNECT_WIFI +#include "esp_wifi.h" +#endif + static const char *TAG = "advanced_https_ota_example"; extern const uint8_t server_cert_pem_start[] asm("_binary_ca_cert_pem_start"); extern const uint8_t server_cert_pem_end[] asm("_binary_ca_cert_pem_end"); @@ -130,6 +134,13 @@ void app_main(void) */ ESP_ERROR_CHECK(example_connect()); +#if CONFIG_EXAMPLE_CONNECT_WIFI + /* Ensure to disable any WiFi power save mode, this allows best throughput + * and hence timings for overall OTA operation. + */ + esp_wifi_set_ps(WIFI_PS_NONE); +#endif // CONFIG_EXAMPLE_CONNECT_WIFI + xTaskCreate(&advanced_ota_example_task, "advanced_ota_example_task", 1024 * 8, NULL, 5, NULL); } diff --git a/examples/system/ota/native_ota_example/main/native_ota_example.c b/examples/system/ota/native_ota_example/main/native_ota_example.c index ae885b167..08b6c9bb6 100644 --- a/examples/system/ota/native_ota_example/main/native_ota_example.c +++ b/examples/system/ota/native_ota_example/main/native_ota_example.c @@ -21,6 +21,10 @@ #include "driver/gpio.h" #include "protocol_examples_common.h" +#if CONFIG_EXAMPLE_CONNECT_WIFI +#include "esp_wifi.h" +#endif + #define BUFFSIZE 1024 #define HASH_LEN 32 /* SHA-256 digest length */ @@ -283,5 +287,12 @@ void app_main(void) */ ESP_ERROR_CHECK(example_connect()); +#if CONFIG_EXAMPLE_CONNECT_WIFI + /* Ensure to disable any WiFi power save mode, this allows best throughput + * and hence timings for overall OTA operation. + */ + esp_wifi_set_ps(WIFI_PS_NONE); +#endif // CONFIG_EXAMPLE_CONNECT_WIFI + xTaskCreate(&ota_example_task, "ota_example_task", 8192, NULL, 5, NULL); } diff --git a/examples/system/ota/simple_ota_example/main/simple_ota_example.c b/examples/system/ota/simple_ota_example/main/simple_ota_example.c index f85186e2b..494c85f54 100644 --- a/examples/system/ota/simple_ota_example/main/simple_ota_example.c +++ b/examples/system/ota/simple_ota_example/main/simple_ota_example.c @@ -21,6 +21,10 @@ #include "nvs_flash.h" #include "protocol_examples_common.h" +#if CONFIG_EXAMPLE_CONNECT_WIFI +#include "esp_wifi.h" +#endif + static const char *TAG = "simple_ota_example"; extern const uint8_t server_cert_pem_start[] asm("_binary_ca_cert_pem_start"); extern const uint8_t server_cert_pem_end[] asm("_binary_ca_cert_pem_end"); @@ -117,5 +121,12 @@ void app_main(void) */ ESP_ERROR_CHECK(example_connect()); +#if CONFIG_EXAMPLE_CONNECT_WIFI + /* Ensure to disable any WiFi power save mode, this allows best throughput + * and hence timings for overall OTA operation. + */ + esp_wifi_set_ps(WIFI_PS_NONE); +#endif // CONFIG_EXAMPLE_CONNECT_WIFI + xTaskCreate(&simple_ota_example_task, "ota_example_task", 8192, NULL, 5, NULL); }