Bugfix Double Extract ZIP-Files

This commit is contained in:
jomjol
2022-12-15 21:16:28 +01:00
parent 6c65b31fff
commit 07913045e2
2 changed files with 20 additions and 16 deletions

View File

@@ -935,7 +935,11 @@ std::string unzip_new(std::string _in_zip_file, std::string _target_zip, std::st
// Get and print information about each file in the archive.
int numberoffiles = (int)mz_zip_reader_get_num_files(&zip_archive);
for (sort_iter = 0; sort_iter < 2; sort_iter++)
ESP_LOGI(TAG, "Numbers of files to be extrated: %d", numberoffiles);
sort_iter = 0;
// for (sort_iter = 0; sort_iter < 2; sort_iter++)
{
memset(&zip_archive, 0, sizeof(zip_archive));
status = mz_zip_reader_init_file(&zip_archive, _in_zip_file.c_str(), sort_iter ? MZ_ZIP_FLAG_DO_NOT_SORT_CENTRAL_DIRECTORY : 0);

View File

@@ -58,6 +58,18 @@ esp_err_t handler_reboot(httpd_req_t *req);
std::string _file_name_update;
static void infinite_loop(void)
{
int i = 0;
ESP_LOGI(TAG, "When a new firmware is available on the server, press the reset button to download it");
while(1) {
ESP_LOGI(TAG, "Waiting for a new firmware... %d", ++i);
vTaskDelay(1000 / portTICK_PERIOD_MS);
}
}
void task_do_Update_ZIP(void *pvParameter)
{
std::string filetype = toUpper(getFileType(_file_name_update));
@@ -110,26 +122,14 @@ void CheckUpdate()
BaseType_t xReturned;
int _i = configMINIMAL_STACK_SIZE;
xReturned = xTaskCreate(&task_do_Update_ZIP, "task_do_Update_ZIP", configMINIMAL_STACK_SIZE * 35, NULL, tskIDLE_PRIORITY+1, NULL);
TickType_t xDelay;
xDelay = 2000000 / portTICK_PERIOD_MS;
ESP_LOGD(TAG, "Wait for Update to be finished: sleep for: %ldms", (long) xDelay);
vTaskDelay( xDelay );
}
static void infinite_loop(void)
{
int i = 0;
ESP_LOGI(TAG, "When a new firmware is available on the server, press the reset button to download it");
while(1) {
ESP_LOGI(TAG, "Waiting for a new firmware... %d", ++i);
vTaskDelay(2000 / portTICK_PERIOD_MS);
while(1) { // wait until reboot within task_do_Update_ZIP
vTaskDelay(1000 / portTICK_PERIOD_MS);
}
}
static bool ota_update_task(std::string fn)
{
esp_err_t err;