diff --git a/src/tasks/blocknotify.cpp b/src/tasks/blocknotify.cpp index 4614b85..dd5c042 100644 --- a/src/tasks/blocknotify.cpp +++ b/src/tasks/blocknotify.cpp @@ -82,6 +82,9 @@ void checkBitcoinBlock(void *pvParameters) Serial.print(F("Error in HTTP request to mempool API: ")); Serial.print(httpCode); Serial.println(http->errorToString(httpCode)); + if (httpCode == -1) { + WiFi.reconnect(); + } } http->end(); diff --git a/src/tasks/get_price.cpp b/src/tasks/get_price.cpp index 86eb4fa..10aae6c 100644 --- a/src/tasks/get_price.cpp +++ b/src/tasks/get_price.cpp @@ -56,6 +56,9 @@ void taskGetPrice(void *pvParameters) { Serial.print(F("Error retrieving BTC/USD price (CoinGecko). HTTP status code: ")); Serial.println(httpCode); + if (httpCode == -1) { + WiFi.reconnect(); + } } } else { @@ -86,6 +89,9 @@ void taskGetPrice(void *pvParameters) { Serial.print(F("Error retrieving BTC/USD price (CoinDesk). HTTP status code: ")); Serial.println(httpCode); + if (httpCode == -1) { + WiFi.reconnect(); + } } }