redo fan curve point saving

This commit is contained in:
jussi
2019-02-03 19:48:30 +02:00
parent d0f4bf72e4
commit ef0f423677
3 changed files with 25 additions and 32 deletions

View File

@@ -74,6 +74,7 @@ editProfile::editProfile(QWidget *parent) :
qv_x.append(mw.xCurvePoints[i]);
qv_y.append(mw.yCurvePoints[i]);
}
ui->curvePlot->graph(0)->setData(qv_x, qv_y);
drawFillerLines();
@@ -323,15 +324,6 @@ void editProfile::detectRelease(QMouseEvent *event)
void editProfile::on_saveButton_clicked()
{
QString xString;
QString yString;
for (int i=0; i<qv_x.length(); i++) {
QString x = QString::number(ui->curvePlot->graph(0)->dataSortKey(i));
QString y = QString::number(ui->curvePlot->graph(0)->dataMainValue(i));
xString.append(x + ", ");
yString.append(y + ", ");
}
QSettings settings("tuxclocker");
settings.beginGroup("General");
QString currentProfile = settings.value("currentProfile").toString();
@@ -339,8 +331,15 @@ void editProfile::on_saveButton_clicked()
settings.endGroup();
settings.beginGroup(currentProfile);
settings.beginGroup(latestUUID);
settings.setValue("ypoints", yString);
settings.setValue("xpoints", xString);
QString xString;
QString yString;
settings.beginWriteArray("curvepoints");
for (int i=0; i<qv_x.length(); i++) {
settings.setArrayIndex(i);
settings.setValue("xpoints", ui->curvePlot->graph(0)->dataSortKey(i));
settings.setValue("ypoints", ui->curvePlot->graph(0)->dataMainValue(i));
}
settings.endArray();
close();
}

View File

@@ -56,8 +56,8 @@ MainWindow::MainWindow(QWidget *parent) :
// Divide by 2 to get the clock speed
ui->memClkSlider->setRange(nv->GPUList[currentGPUIndex].minMemClkOffset/2, nv->GPUList[currentGPUIndex].maxMemClkOffset/2);
ui->memClkSpinBox->setRange(nv->GPUList[currentGPUIndex].minMemClkOffset/2, nv->GPUList[currentGPUIndex].maxMemClkOffset/2);
ui->memClkSlider->setValue(nv->GPUList[currentGPUIndex].memClkOffset/2);
ui->memClkSpinBox->setValue(nv->GPUList[currentGPUIndex].memClkOffset/2);
ui->memClkSlider->setValue(nv->GPUList[currentGPUIndex].memClkOffset);
ui->memClkSpinBox->setValue(nv->GPUList[currentGPUIndex].memClkOffset);
} else {
ui->memClkSlider->setEnabled(false);
ui->memClkSpinBox->setEnabled(false);
@@ -808,7 +808,6 @@ void MainWindow::loadProfileSettings()
{
QSettings settings("tuxclocker");
currentProfile = settings.value("General/currentProfile").toString();
qDebug() << "current profile" << currentProfile;
latestUUID = settings.value("General/latestUUID").toString();
// Set the profile combo box selection to currentProfile
for (int i=0; i<ui->profileComboBox->count(); i++) {
@@ -819,22 +818,17 @@ void MainWindow::loadProfileSettings()
}
settings.beginGroup(currentProfile);
settings.beginGroup(latestUUID);
// Check for existance of the setting so zeroes don't get appended to curve point vectors
if (settings.contains("xpoints") && nv->GPUList[currentGPUIndex].manualFanCtrlAvailable) {
QString xPointStr = "/bin/sh -c \"echo " + settings.value("xpoints").toString() + grepStringToInt;
QString yPointStr = "/bin/sh -c \"echo " + settings.value("ypoints").toString() + grepStringToInt;
QProcess process;
process.start(xPointStr);
process.waitForFinished(-1);
for (int i=0; i<process.size() +1; i++) {
xCurvePoints.append(process.readLine().toInt());
}
process.start(yPointStr);
process.waitForFinished(-1);
for (int i=0; i<process.size() +1; i++) {
yCurvePoints.append(process.readLine().toInt());
// Check if manual control is available and set the combo box accordingly
if (nv->GPUList[currentGPUIndex].manualFanCtrlAvailable) {
xCurvePoints.clear();
yCurvePoints.clear();
int size = settings.beginReadArray("curvepoints");
for (int i=0; i<size; i++) {
settings.setArrayIndex(i);
xCurvePoints.append(settings.value("xpoints").toInt());
yCurvePoints.append(settings.value("ypoints").toInt());
}
settings.endArray();
QStandardItemModel *model = qobject_cast<QStandardItemModel*>(ui->fanModeComboBox->model());
QModelIndex customModeIndex = model->index(2, ui->fanModeComboBox->modelColumn());
QStandardItem *customMode = model->itemFromIndex(customModeIndex);
@@ -869,9 +863,9 @@ void MainWindow::loadProfileSettings()
}
if (settings.contains("memoryClockOffset")) {
latestMemClkOfs=settings.value("memoryClockOffset").toInt();
ui->memClkSlider->setValue(latestMemClkOfs);
ui->memClkSlider->setValue(latestMemClkOfs);
qDebug() << latestMemClkOfs << "is now memclkoffset";
}
if (settings.contains("fanControlMode")) {
fanControlMode = settings.value("fanControlMode").toInt();
@@ -1029,7 +1023,6 @@ void MainWindow::on_applyButton_clicked()
QString prevProfile = settings.value("currentProfile").toString();
settings.setValue("currentProfile", currentProfile);
applyGPUSettings();
// Query the maximum offsets
nv->queryGPUCurrentMaxClocks(currentGPUIndex);
@@ -1048,6 +1041,7 @@ void MainWindow::on_editFanCurveButton_pressed()
void MainWindow::on_editProfile_closed()
{
// Clear the existing curve points and load the new ones
qDebug() << "dialog closed";
xCurvePoints.clear();
yCurvePoints.clear();
loadProfileSettings();

View File

@@ -241,7 +241,7 @@ void nvidia::queryGPUFanSpeed(int GPUIndex)
NV_CTRL_THERMAL_COOLER_CURRENT_LEVEL,
&GPUList[GPUIndex].fanSpeed);
qDebug() << GPUList[GPUIndex].fanSpeed;
//qDebug() << GPUList[GPUIndex].fanSpeed;
}
void nvidia::queryGPUUsedVRAM(int GPUIndex)
{