added allow reboot define and clear node from node queue after successfully ota process

This commit is contained in:
2021-01-20 23:04:18 +01:00
parent 77e87ec840
commit b29887e0ac
5 changed files with 34 additions and 5 deletions

View File

@ -157,11 +157,11 @@ void vMeshOtaTaskOTAWorker(void *arg)
//nodes queue is empty
ESP_LOGI(LOG_TAG, "nodes queue is empty");
if(bWantReboot == true)
if((bWantReboot == true) && (OTA_ALLOW_REBOOT == 1))
{
//ESP_LOGI(LOG_TAG, "ESP32 Reboot ...");
//vTaskDelay( (1000) / portTICK_PERIOD_MS);
//esp_restart();
ESP_LOGE(LOG_TAG, "ESP32 Reboot ...");
vTaskDelay( (1000) / portTICK_PERIOD_MS);
esp_restart();
}
ERROR_CHECK(errMeshOtaSlaveEndpoint(&bNewOTAImage));
@ -184,6 +184,11 @@ void vMeshOtaTaskOTAWorker(void *arg)
//OTA process faild --> add back to queue
vMeshOtaUtilAddNodeToPossibleUpdatableQueue(meshNodeAddr.addr);
}
else
{
vMeshOtaUtilClearNeighboursQueue(&meshNodeAddr); //remove this node from queue
}
}
if(bNewOTAImage == true)
@ -191,6 +196,7 @@ void vMeshOtaTaskOTAWorker(void *arg)
//set want reboot
ESP_LOGI(LOG_TAG, "Updated successfully via Mesh, set pending reboot");
bWantReboot = true;
vMeshOtaUtilAddAllNeighboursToQueue(); //add all existing neighbours to queue
}
vTaskDelay( (1000) / portTICK_PERIOD_MS);