esp_rmaker_ota: Provide option to modify buff size in menuconfig

This commit is contained in:
shixinke
2021-09-09 18:09:53 +08:00
parent 722635985e
commit d8341cb54d
2 changed files with 13 additions and 3 deletions

View File

@@ -135,6 +135,15 @@ menu "ESP RainMaker Config"
help
This allows you to skip the project name check.
config ESP_RMAKER_OTA_HTTP_RX_BUFFER_SIZE
int "OTA HTTP receive buffer size"
default 1024
range 512 LWIP_TCP_WND_DEFAULT
help
Increasing this value beyond the default would speed up the OTA download process.
However, please ensure that your application has enough memory headroom to allow this,
else, the OTA may fail.
endmenu
menu "ESP RainMaker Scheduling"

View File

@@ -28,7 +28,8 @@
static const char *TAG = "esp_rmaker_ota";
#define OTA_REBOOT_TIMER_SEC 10
#define DEF_HTTP_BUFFER_SIZE 1024
#define DEF_HTTP_TX_BUFFER_SIZE 1024
#define DEF_HTTP_RX_BUFFER_SIZE CONFIG_ESP_RMAKER_OTA_HTTP_RX_BUFFER_SIZE
extern const char esp_rmaker_ota_def_cert[] asm("_binary_rmaker_ota_server_crt_start");
const char *ESP_RMAKER_OTA_DEFAULT_SERVER_CERT = esp_rmaker_ota_def_cert;
@@ -129,7 +130,7 @@ static esp_err_t esp_rmaker_ota_default_cb(esp_rmaker_ota_handle_t ota_handle, e
if (!ota_data->url) {
return ESP_FAIL;
}
int buffer_size_tx = DEF_HTTP_BUFFER_SIZE;
int buffer_size_tx = DEF_HTTP_TX_BUFFER_SIZE;
/* In case received url is longer, we will increase the tx buffer size
* to accomodate the longer url and other headers.
*/
@@ -141,7 +142,7 @@ static esp_err_t esp_rmaker_ota_default_cb(esp_rmaker_ota_handle_t ota_handle, e
.url = ota_data->url,
.cert_pem = ota_data->server_cert,
.timeout_ms = 5000,
.buffer_size = DEF_HTTP_BUFFER_SIZE,
.buffer_size = DEF_HTTP_RX_BUFFER_SIZE,
.buffer_size_tx = buffer_size_tx
};
#ifdef CONFIG_ESP_RMAKER_SKIP_COMMON_NAME_CHECK