diff --git a/src/monitor.cpp b/src/monitor.cpp index 56f1368..1fb58f3 100644 --- a/src/monitor.cpp +++ b/src/monitor.cpp @@ -304,14 +304,22 @@ pool_data getPoolData(void){ if (httpCode == HTTP_CODE_OK) { String payload = http.getString(); // Serial.println(payload); - DynamicJsonDocument doc(1024); - deserializeJson(doc, payload); - + StaticJsonDocument<300> filter; + filter["bestDifficulty"] = true; + filter["workersCount"] = true; + filter["workers"][0]["sessionId"] = true; + filter["workers"][0]["hashRate"] = true; + DynamicJsonDocument doc(2048); + deserializeJson(doc, payload, DeserializationOption::Filter(filter)); + //Serial.println(serializeJsonPretty(doc, Serial)); if (doc.containsKey("workersCount")) pData.workersCount = doc["workersCount"].as(); const JsonArray& workers = doc["workers"].as(); float totalhashs = 0; for (const JsonObject& worker : workers) { - totalhashs += worker["hashRate"].as(); + totalhashs += worker["hashRate"].as(); + /* Serial.print(worker["sessionId"].as()+": "); + Serial.print(" - "+worker["hashRate"].as()+": "); + Serial.println(totalhashs); */ } pData.workersHash = String(totalhashs/1000); double temp;