Add debug log setting and custom endpoint settings
This commit is contained in:
parent
190d650887
commit
bc3e5afe51
7 changed files with 95 additions and 30 deletions
|
@ -36,6 +36,10 @@ void taskMiningPoolStatsFetch(void *pvParameters)
|
|||
poolInterface->setPoolUser(poolUser);
|
||||
std::string apiUrl = poolInterface->getApiUrl();
|
||||
http.begin(apiUrl.c_str());
|
||||
if (debugLogEnabled())
|
||||
{
|
||||
Serial.printf("Fetching mining pool stats from %s\r\n", apiUrl.c_str());
|
||||
}
|
||||
poolInterface->prepareRequest(http);
|
||||
int httpCode = http.GET();
|
||||
if (httpCode == 200)
|
||||
|
@ -44,10 +48,20 @@ void taskMiningPoolStatsFetch(void *pvParameters)
|
|||
JsonDocument doc;
|
||||
deserializeJson(doc, payload);
|
||||
|
||||
if (debugLogEnabled())
|
||||
{
|
||||
Serial.printf("Mining pool stats response: %s\r\n", payload.c_str());
|
||||
}
|
||||
|
||||
PoolStats stats = poolInterface->parseResponse(doc);
|
||||
|
||||
miningPoolStatsHashrate = stats.hashrate;
|
||||
|
||||
if (debugLogEnabled())
|
||||
{
|
||||
Serial.printf("Mining pool stats parsed hashrate: %s\r\n", stats.hashrate.c_str());
|
||||
}
|
||||
|
||||
if (stats.dailyEarnings)
|
||||
{
|
||||
miningPoolStatsDailyEarnings = *stats.dailyEarnings;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue