more ota progress

This commit is contained in:
Sebastien Leclerc
2019-09-24 00:11:24 -04:00
parent c34cf06be1
commit 5e7e4cfdf4
9 changed files with 190 additions and 361 deletions

View File

@@ -59,7 +59,7 @@ static int perform_ota_update(int argc, char **argv)
void register_ota_cmd()
{
ota_args.url= arg_str1(NULL, NULL, "<url>", "url of the binary app file");
ota_args.end = arg_end(2);
ota_args.end = arg_end(1);
const esp_console_cmd_t cmd = {
.command = "ota_update",

View File

@@ -68,8 +68,9 @@ esp_err_t _http_event_handler(esp_http_client_event_t *evt)
return ESP_OK;
}
void ota_task(void *pvParameter, const char * bin_url)
void ota_task(void *pvParameter)
{
char * bin_url=(char *)pvParameter;
ESP_LOGI(TAG, "Starting OTA example");
esp_http_client_config_t config = {
@@ -106,6 +107,8 @@ void start_ota(const char * bin_url)
err = nvs_flash_init();
}
ESP_ERROR_CHECK(err);
char * urlPtr=malloc((strlen(bin_url)+1)*sizeof(char));
strcpy(urlPtr,bin_url);
xTaskCreate(&ota_task, "ota_task", 8192, NULL, 5, NULL);
xTaskCreate(&ota_task, "ota_task", 8192, NULL, 5, urlPtr);
}