Skip to content

Commit 92f5798

Browse files
author
zhufangluo
committed
bugfix(gmf_io): Fix http io dir write data bus init
1 parent 9c48c9e commit 92f5798

File tree

3 files changed

+18
-12
lines changed

3 files changed

+18
-12
lines changed

elements/gmf_io/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## v0.7.4
4+
5+
### Bug Fixes
6+
7+
- Fixed data bus init when direction is write in `io_http`
8+
39
## v0.7.3
410

511
### Bug Fixes

elements/gmf_io/esp_gmf_io_http.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,17 @@ static esp_gmf_err_t _http_open(esp_gmf_io_handle_t self)
153153
return ESP_GMF_ERR_FAIL;
154154
}
155155

156+
if (http->data_bus == NULL) {
157+
err = esp_gmf_db_new_block(1, http_io_cfg->out_buf_size, &http->data_bus);
158+
if (err != ESP_GMF_ERR_OK) {
159+
ESP_LOGE(TAG, "Failed to create the buffer for %d, sz: %d, %s-%p", http_io_cfg->dir, http_io_cfg->out_buf_size, OBJ_GET_TAG(http), http);
160+
return err;
161+
}
162+
esp_gmf_data_bus_type_t db_type = 0;
163+
esp_gmf_db_get_type(http->data_bus, &db_type);
164+
http->base.type = db_type;
165+
}
166+
156167
if (http_io_cfg->dir == ESP_GMF_IO_DIR_WRITER) {
157168
err = esp_http_client_open(http->client, -1);
158169
if (err == ESP_GMF_ERR_OK) {
@@ -213,17 +224,6 @@ static esp_gmf_err_t _http_open(esp_gmf_io_handle_t self)
213224
}
214225
esp_gmf_io_set_size(self, info.size);
215226

216-
if (http->data_bus == NULL) {
217-
err = esp_gmf_db_new_block(1, http_io_cfg->out_buf_size, &http->data_bus);
218-
if (err != ESP_GMF_ERR_OK) {
219-
ESP_LOGE(TAG, "Failed to create the download buffer, sz: %d, %s-%p", http_io_cfg->out_buf_size, OBJ_GET_TAG(http), http);
220-
return err;
221-
}
222-
esp_gmf_data_bus_type_t db_type = 0;
223-
esp_gmf_db_get_type(http->data_bus, &db_type);
224-
http->base.type = db_type;
225-
}
226-
227227
return ESP_GMF_ERR_OK;
228228
}
229229

elements/gmf_io/idf_component.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: "0.7.3"
1+
version: "0.7.4"
22
description: Espressif GMF IO Module
33
url: https://github.com/espressif/esp-gmf/tree/main/elements/gmf_io
44
documentation: "https://github.com/espressif/esp-gmf/blob/main/elements/gmf_io/README.md"

0 commit comments

Comments
 (0)