Refactor BitAxeFetch to a class

This commit is contained in:
Djuri 2025-01-05 20:14:55 +01:00
parent fa15e46d34
commit c91428dd5f
Signed by: djuri
GPG key ID: 61B9B2DDE5AA3AC1
5 changed files with 50 additions and 44 deletions

View file

@ -7,10 +7,28 @@
#include "lib/config.hpp"
#include "lib/shared.hpp"
extern TaskHandle_t bitaxeFetchTaskHandle;
class BitAxeFetch {
public:
static BitAxeFetch& getInstance() {
static BitAxeFetch instance;
return instance;
}
void setupBitaxeFetchTask();
void taskBitaxeFetch(void *pvParameters);
void setup();
uint64_t getHashRate() const;
uint64_t getBestDiff() const;
static void taskWrapper(void* pvParameters);
TaskHandle_t getTaskHandle() const { return taskHandle; }
uint64_t getBitAxeHashRate();
uint64_t getBitaxeBestDiff();
private:
BitAxeFetch() = default;
~BitAxeFetch() = default;
BitAxeFetch(const BitAxeFetch&) = delete;
BitAxeFetch& operator=(const BitAxeFetch&) = delete;
void task();
TaskHandle_t taskHandle = nullptr;
uint64_t hashrate = 0;
uint64_t bestDiff = 0;
};