Reconnect WiFi on error

This commit is contained in:
Djuri Baars 2023-11-04 21:24:15 +01:00
parent 8cc99d2437
commit aa6c09e9aa
2 changed files with 9 additions and 0 deletions

View file

@ -82,6 +82,9 @@ void checkBitcoinBlock(void *pvParameters)
Serial.print(F("Error in HTTP request to mempool API: ")); Serial.print(F("Error in HTTP request to mempool API: "));
Serial.print(httpCode); Serial.print(httpCode);
Serial.println(http->errorToString(httpCode)); Serial.println(http->errorToString(httpCode));
if (httpCode == -1) {
WiFi.reconnect();
}
} }
http->end(); http->end();

View file

@ -56,6 +56,9 @@ void taskGetPrice(void *pvParameters)
{ {
Serial.print(F("Error retrieving BTC/USD price (CoinGecko). HTTP status code: ")); Serial.print(F("Error retrieving BTC/USD price (CoinGecko). HTTP status code: "));
Serial.println(httpCode); Serial.println(httpCode);
if (httpCode == -1) {
WiFi.reconnect();
}
} }
} else { } else {
@ -86,6 +89,9 @@ void taskGetPrice(void *pvParameters)
{ {
Serial.print(F("Error retrieving BTC/USD price (CoinDesk). HTTP status code: ")); Serial.print(F("Error retrieving BTC/USD price (CoinDesk). HTTP status code: "));
Serial.println(httpCode); Serial.println(httpCode);
if (httpCode == -1) {
WiFi.reconnect();
}
} }
} }