Skip to content

Commit 1ed4429

Browse files
committed
fix: ota beacon timeout
1 parent 11ea677 commit 1ed4429

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

examples/system/ota/main/ota_example_main.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,18 @@ static void ota_example_task(void *pvParameter)
212212
task_fatal_error();
213213
}
214214

215+
update_partition = esp_ota_get_next_update_partition(NULL);
216+
ESP_LOGI(TAG, "Writing to partition subtype %d at offset 0x%x",
217+
update_partition->subtype, update_partition->address);
218+
assert(update_partition != NULL);
219+
220+
err = esp_ota_begin(update_partition, OTA_SIZE_UNKNOWN, &update_handle);
221+
if (err != ESP_OK) {
222+
ESP_LOGE(TAG, "esp_ota_begin failed, error=%d", err);
223+
task_fatal_error();
224+
}
225+
ESP_LOGI(TAG, "esp_ota_begin succeeded");
226+
215227
/*send GET request to http server*/
216228
const char *GET_FORMAT =
217229
"GET %s HTTP/1.0\r\n"
@@ -234,18 +246,6 @@ static void ota_example_task(void *pvParameter)
234246
ESP_LOGI(TAG, "Send GET request to server succeeded");
235247
}
236248

237-
update_partition = esp_ota_get_next_update_partition(NULL);
238-
ESP_LOGI(TAG, "Writing to partition subtype %d at offset 0x%x",
239-
update_partition->subtype, update_partition->address);
240-
assert(update_partition != NULL);
241-
242-
err = esp_ota_begin(update_partition, OTA_SIZE_UNKNOWN, &update_handle);
243-
if (err != ESP_OK) {
244-
ESP_LOGE(TAG, "esp_ota_begin failed, error=%d", err);
245-
task_fatal_error();
246-
}
247-
ESP_LOGI(TAG, "esp_ota_begin succeeded");
248-
249249
bool resp_body_start = false, flag = true;
250250
/*deal with all receive packet*/
251251
while (flag) {

0 commit comments

Comments
 (0)