Mining pool bugfixes, improvements and icon optimizations
All checks were successful
BTClock CI / build (push) Successful in 17m35s
BTClock CI / merge (map[name:btclock_v8 version:esp32s3], 213epd) (push) Successful in 27s
BTClock CI / merge (map[name:btclock_rev_b version:esp32s3], 213epd) (push) Successful in 20s
BTClock CI / merge (map[name:lolin_s3_mini version:esp32s3], 213epd) (push) Successful in 25s
BTClock CI / merge (map[name:lolin_s3_mini version:esp32s3], 29epd) (push) Successful in 19s
BTClock CI / release (push) Successful in 36s

This commit is contained in:
Djuri 2024-12-20 14:11:26 +01:00
parent e8a7b221cb
commit 7bcb24bab0
14 changed files with 411 additions and 637 deletions

View file

@ -15,9 +15,13 @@ PoolStats NoderunnersPool::parseResponse(const JsonDocument& doc) const {
std::string value = hashrateStr.substr(0, hashrateStr.size() - 1);
int multiplier = getHashrateMultiplier(unit);
double hashrate = std::stod(value) * std::pow(10, multiplier);
char buffer[32];
snprintf(buffer, sizeof(buffer), "%.0f", hashrate);
return PoolStats{
.hashrate = value + std::string(multiplier, '0'),
.hashrate = buffer,
.dailyEarnings = std::nullopt
};
}
@ -28,15 +32,4 @@ LogoData NoderunnersPool::getLogo() const {
.width = 122,
.height = 122
};
}
int NoderunnersPool::getHashrateMultiplier(char unit) {
if (unit == '0')
return 0;
static const std::unordered_map<char, int> multipliers = {
{'Z', 21}, {'E', 18}, {'P', 15}, {'T', 12},
{'G', 9}, {'M', 6}, {'K', 3}
};
return multipliers.at(unit);
}
}

View file

@ -3,6 +3,7 @@
#include "lib/mining_pool/mining_pool_interface.hpp"
#include <icons/icons.h>
#include <utils.hpp>
class NoderunnersPool : public MiningPoolInterface {
public:
@ -16,7 +17,4 @@ public:
std::string getDailyEarningsLabel() const override { return ""; }
bool hasLogo() const override { return true; }
std::string getDisplayLabel() const override { return "NODE/RUNNERS"; } // Fallback if needed
protected:
static int getHashrateMultiplier(char unit);
};