Update monitor.cpp

all credits to this changes for https://github.com/ChimpRocket
This commit is contained in:
yonijuerga 2024-06-11 12:20:53 +02:00 committed by GitHub
parent 53157f1ecf
commit 496fcecc7d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -152,7 +152,7 @@ String getBTCprice(void){
if((mBTCUpdate == 0) || (millis() - mBTCUpdate > UPDATE_BTC_min * 60 * 1000)){
if (WiFi.status() != WL_CONNECTED) return (String(bitcoin_price) + "$");
if (WiFi.status() != WL_CONNECTED) return "$" + String(bitcoin_price);
HTTPClient http;
try {
@ -164,7 +164,7 @@ String getBTCprice(void){
DynamicJsonDocument doc(1024);
deserializeJson(doc, payload);
if (doc.containsKey("last_trade_price")) bitcoin_price = doc["last_trade_price"];
if (doc.containsKey("data") && doc["data"].containsKey("amount")) bitcoin_price = doc["data"]["amount"];
doc.clear();
@ -177,7 +177,7 @@ String getBTCprice(void){
}
}
return (String(bitcoin_price) + "$");
return "$" + String(bitcoin_price);
}
unsigned long mTriggerUpdate = 0;