mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-03 12:44:33 +02:00
examples/ota: disable WiFi power save mode for optimal performance
This commit is contained in:
@@ -20,6 +20,10 @@
|
|||||||
#include "nvs_flash.h"
|
#include "nvs_flash.h"
|
||||||
#include "protocol_examples_common.h"
|
#include "protocol_examples_common.h"
|
||||||
|
|
||||||
|
#if CONFIG_EXAMPLE_CONNECT_WIFI
|
||||||
|
#include "esp_wifi.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
static const char *TAG = "advanced_https_ota_example";
|
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_start[] asm("_binary_ca_cert_pem_start");
|
||||||
extern const uint8_t server_cert_pem_end[] asm("_binary_ca_cert_pem_end");
|
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());
|
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);
|
xTaskCreate(&advanced_ota_example_task, "advanced_ota_example_task", 1024 * 8, NULL, 5, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -21,6 +21,10 @@
|
|||||||
#include "driver/gpio.h"
|
#include "driver/gpio.h"
|
||||||
#include "protocol_examples_common.h"
|
#include "protocol_examples_common.h"
|
||||||
|
|
||||||
|
#if CONFIG_EXAMPLE_CONNECT_WIFI
|
||||||
|
#include "esp_wifi.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#define BUFFSIZE 1024
|
#define BUFFSIZE 1024
|
||||||
#define HASH_LEN 32 /* SHA-256 digest length */
|
#define HASH_LEN 32 /* SHA-256 digest length */
|
||||||
|
|
||||||
@@ -283,5 +287,12 @@ void app_main(void)
|
|||||||
*/
|
*/
|
||||||
ESP_ERROR_CHECK(example_connect());
|
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);
|
xTaskCreate(&ota_example_task, "ota_example_task", 8192, NULL, 5, NULL);
|
||||||
}
|
}
|
||||||
|
@@ -21,6 +21,10 @@
|
|||||||
#include "nvs_flash.h"
|
#include "nvs_flash.h"
|
||||||
#include "protocol_examples_common.h"
|
#include "protocol_examples_common.h"
|
||||||
|
|
||||||
|
#if CONFIG_EXAMPLE_CONNECT_WIFI
|
||||||
|
#include "esp_wifi.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
static const char *TAG = "simple_ota_example";
|
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_start[] asm("_binary_ca_cert_pem_start");
|
||||||
extern const uint8_t server_cert_pem_end[] asm("_binary_ca_cert_pem_end");
|
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());
|
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);
|
xTaskCreate(&simple_ota_example_task, "ota_example_task", 8192, NULL, 5, NULL);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user