OTA improvements

This commit is contained in:
Klaus K Wilting 2018-11-20 21:03:03 +01:00
parent 12ad60a0a8
commit b8e7b4bf48
2 changed files with 6 additions and 2 deletions

View File

@ -118,6 +118,10 @@ int do_ota_update() {
// Fetch the latest firmware version // Fetch the latest firmware version
ESP_LOGI(TAG, "Checking latest firmware version on server"); ESP_LOGI(TAG, "Checking latest firmware version on server");
display(2, "**", "checking version"); display(2, "**", "checking version");
if (WiFi.status() != WL_CONNECTED)
return 1;
const String latest = bintray.getLatestVersion(); const String latest = bintray.getLatestVersion();
if (latest.length() == 0) { if (latest.length() == 0) {
@ -133,6 +137,8 @@ int do_ota_update() {
display(2, "OK", latest.c_str()); display(2, "OK", latest.c_str());
display(3, "**", ""); display(3, "**", "");
if (WiFi.status() != WL_CONNECTED)
return 1;
String firmwarePath = bintray.getBinaryPath(latest); String firmwarePath = bintray.getBinaryPath(latest);
if (!firmwarePath.endsWith(".bin")) { if (!firmwarePath.endsWith(".bin")) {
ESP_LOGI(TAG, "Unsupported binary format"); ESP_LOGI(TAG, "Unsupported binary format");

View File

@ -8,8 +8,6 @@ static const char TAG[] = "main";
// helper function // helper function
void do_reset() { void do_reset() {
ESP_LOGI(TAG, "Remote command: restart device"); ESP_LOGI(TAG, "Remote command: restart device");
if (irqHandlerTask != NULL)
vTaskDelete(irqHandlerTask);
LMIC_shutdown(); LMIC_shutdown();
vTaskDelay(3000 / portTICK_PERIOD_MS); vTaskDelay(3000 / portTICK_PERIOD_MS);
esp_restart(); esp_restart();