Skip to content

Commit d8341cb

Browse files
esp_rmaker_ota: Provide option to modify buff size in menuconfig
1 parent 7226359 commit d8341cb

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

components/esp_rainmaker/Kconfig.projbuild

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,15 @@ menu "ESP RainMaker Config"
135135
help
136136
This allows you to skip the project name check.
137137

138+
config ESP_RMAKER_OTA_HTTP_RX_BUFFER_SIZE
139+
int "OTA HTTP receive buffer size"
140+
default 1024
141+
range 512 LWIP_TCP_WND_DEFAULT
142+
help
143+
Increasing this value beyond the default would speed up the OTA download process.
144+
However, please ensure that your application has enough memory headroom to allow this,
145+
else, the OTA may fail.
146+
138147
endmenu
139148

140149
menu "ESP RainMaker Scheduling"

components/esp_rainmaker/src/ota/esp_rmaker_ota.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
static const char *TAG = "esp_rmaker_ota";
2929

3030
#define OTA_REBOOT_TIMER_SEC 10
31-
#define DEF_HTTP_BUFFER_SIZE 1024
31+
#define DEF_HTTP_TX_BUFFER_SIZE 1024
32+
#define DEF_HTTP_RX_BUFFER_SIZE CONFIG_ESP_RMAKER_OTA_HTTP_RX_BUFFER_SIZE
3233

3334
extern const char esp_rmaker_ota_def_cert[] asm("_binary_rmaker_ota_server_crt_start");
3435
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
129130
if (!ota_data->url) {
130131
return ESP_FAIL;
131132
}
132-
int buffer_size_tx = DEF_HTTP_BUFFER_SIZE;
133+
int buffer_size_tx = DEF_HTTP_TX_BUFFER_SIZE;
133134
/* In case received url is longer, we will increase the tx buffer size
134135
* to accomodate the longer url and other headers.
135136
*/
@@ -141,7 +142,7 @@ static esp_err_t esp_rmaker_ota_default_cb(esp_rmaker_ota_handle_t ota_handle, e
141142
.url = ota_data->url,
142143
.cert_pem = ota_data->server_cert,
143144
.timeout_ms = 5000,
144-
.buffer_size = DEF_HTTP_BUFFER_SIZE,
145+
.buffer_size = DEF_HTTP_RX_BUFFER_SIZE,
145146
.buffer_size_tx = buffer_size_tx
146147
};
147148
#ifdef CONFIG_ESP_RMAKER_SKIP_COMMON_NAME_CHECK

0 commit comments

Comments
 (0)