Skip to content

Commit

Permalink
preparing for nvoc
Browse files Browse the repository at this point in the history
  • Loading branch information
orkblutt committed Aug 22, 2017
1 parent d43275e commit 0750513
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 10 deletions.
4 changes: 2 additions & 2 deletions MiningLigth.pro
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = MinerLamp
TEMPLATE = app
VERSION = 0.1.0.620
VERSION = 0.1.0.647

# The following define makes your compiler emit warnings if you use
# any feature of Qt which as been marked as deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS NVIDIA DONATE
DEFINES += QT_DEPRECATED_WARNINGS NVIDIA #DONATE


# You can also make your code fail to compile if you use deprecated APIs.
Expand Down
13 changes: 11 additions & 2 deletions nvidiaapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ nvidiaAPI::nvidiaAPI():

qDebug() << "NVAPI success " << ret;

NvEnumGPUs(_gpuHandles, &_gpuCount);
qDebug() << _gpuCount;


}
}
Expand All @@ -66,6 +65,13 @@ nvidiaAPI::~nvidiaAPI()

}

unsigned int nvidiaAPI::getGPUCount()
{
NvEnumGPUs(_gpuHandles, &_gpuCount);
qDebug() << _gpuCount;
return _gpuCount;
}



void nvidiaAPI::overClock(unsigned int gpu, unsigned int mem)
Expand Down Expand Up @@ -146,7 +152,10 @@ unsigned int nvidiaAPI::getPowerLimit(unsigned int gpu)
NVAPI_GPU_POWER_STATUS pol = { 0 };
pol.version = NVAPI_GPU_POWER_STATUS_VER;
if ((ret = NvClientPowerPoliciesGetStatus(_gpuHandles[gpu], &pol)) != NVAPI_OK)
{
qDebug() << "error";
return 0;
}

return (uint8_t) (pol.entries[0].power / 1000); // in percent

Expand Down
16 changes: 12 additions & 4 deletions nvocdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,20 @@ nvOCDialog::nvOCDialog(QWidget *parent) :

_nvapi = new nvidiaAPI();

ui->horizontalSliderPowerPercent->setValue(_nvapi->getPowerLimit(0));

unsigned int gpuclock = _nvapi->getGpuClock(0);
qDebug() << gpuclock;

_nvapi->getGPUOffset(0);
unsigned int deviceNumber = _nvapi->getGPUCount();
if(deviceNumber)
{
for(unsigned int i = 0; i < deviceNumber; i++)
{
ui->comboBoxDevice->addItem(QString("device " + QString::number(i)));
}
int value = _nvapi->getPowerLimit(0);
qDebug() << value;
ui->horizontalSliderPowerPercent->setValue(value);
}


}

Expand Down
11 changes: 9 additions & 2 deletions nvocdialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
</widget>
</item>
<item row="0" column="1" colspan="2">
<widget class="QComboBox" name="comboBox"/>
<widget class="QComboBox" name="comboBoxDevice"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label">
Expand All @@ -41,7 +41,7 @@
<item row="0" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>GPU:</string>
<string>Devices:</string>
</property>
</widget>
</item>
Expand Down Expand Up @@ -119,6 +119,13 @@
</property>
</widget>
</item>
<item row="0" column="4">
<widget class="QCheckBox" name="checkBox_2">
<property name="text">
<string>Apply to all devices</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
Expand Down

0 comments on commit 0750513

Please sign in to comment.