#include #include #include #include using namespace std; #define TIMEOUT 500 Controller::Controller(vector> curves) : mFanCurves(curves), mRun(false) {} Controller::~Controller() { StopFanControlLoop(); } void Controller::StartFanControlLoop() { mRun = true; Loop(); // mWorker = make_unique(&Controller::Loop, this); } void Controller::StopFanControlLoop() { mRun = false; // if (mWorker->joinable()) // mWorker->join(); // mWorker.reset(); } void Controller::Loop() { while (mRun) { for (auto c : mFanCurves) { c->DoFanControl(); } this_thread::sleep_for(chrono::milliseconds(TIMEOUT)); } }