Skip to content

Commit

Permalink
linear fan speed thread
Browse files Browse the repository at this point in the history
  • Loading branch information
orkblutt committed Sep 27, 2017
1 parent 64d8548 commit 99e52af
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,12 @@ MainWindow::MainWindow(QWidget *parent) :
if(pos > 0)
ui->lineEditAccount->setText(ui->lineEditArgs->text().mid(pos + 3
, ui->lineEditArgs->text().indexOf(" 0x") > 0 ? 42 : 40));
/*

#ifdef NVIDIA
_fanThread = new fanSpeedThread(_nvapi);
_fanThread->start();
#endif
*/

}

MainWindow::~MainWindow()
Expand Down Expand Up @@ -644,7 +644,7 @@ void MainWindow::onPoolUserInfo(double userBalance
fanSpeedThread::fanSpeedThread(nvidiaAPI *nvapi, QObject */*pParent*/) :
_nvapi(nvapi),
_downLimit(30),
_upLimit(70)
_upLimit(65)
{

}
Expand All @@ -657,9 +657,15 @@ void fanSpeedThread::run()
for(uint i = 0; i < gpuCount; i++)
{
int gpuTemp = _nvapi->getGpuTemperature(i);
qDebug() << "gpu temp" << gpuTemp;
if(gpuTemp > _downLimit)
{
int fanLevel = (100 / (_upLimit - _downLimit)) * gpuTemp;
float step = 100 / (float)(_upLimit - _downLimit);

float fanLevel = step * (gpuTemp - _downLimit);

_nvapi->setFanSpeed(i, (int)fanLevel);

qDebug() << fanLevel;
}
}
Expand Down

0 comments on commit 99e52af

Please sign in to comment.