btclock_v3/src/lib/bitaxe_fetch.hpp

34 lines
758 B
C++
Raw Normal View History

2024-07-29 20:49:46 +02:00
#pragma once
#include <Arduino.h>
#include <HTTPClient.h>
2025-01-05 18:08:21 +01:00
#include <utils.hpp>
2024-07-29 20:49:46 +02:00
#include "lib/config.hpp"
#include "lib/shared.hpp"
2025-01-05 20:14:55 +01:00
class BitAxeFetch {
public:
static BitAxeFetch& getInstance() {
static BitAxeFetch instance;
return instance;
}
2024-07-29 20:49:46 +02:00
2025-01-05 20:14:55 +01:00
void setup();
uint64_t getHashRate() const;
uint64_t getBestDiff() const;
static void taskWrapper(void* pvParameters);
TaskHandle_t getTaskHandle() const { return taskHandle; }
2024-07-29 20:49:46 +02:00
2025-01-05 20:14:55 +01:00
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;
};