Skip to content
Snippets Groups Projects
Commit 37d734a0 authored by Jake's avatar Jake
Browse files

Setpoint improvements

Readback on setpoints. This means that nav setpoints update when changed
in control graph view.
parent 4d5f4438
No related branches found
No related tags found
No related merge requests found
......@@ -93,7 +93,7 @@ void ControlWorker::getParamValue(QString node, QString param)
/* Set pd.param and finish the job */
pd.param = j;
frontend_getparam(conn, &pd);
emit(gotParamValue(pd.value));
emit(gotParamValue(node, param, pd.value));
}
}
}
......
......@@ -15,7 +15,7 @@ public:
signals:
void gotNodes(QStringList nodes);
void gotParams(QStringList params);
void gotParamValue(float value);
void gotParamValue(QString node, QString param, float value);
void gotConstantBlocks(QStringList blocks);
void paramSet(QString node, QString param);
......
......@@ -43,7 +43,7 @@ MainWindow::MainWindow(QWidget *parent) :
/* Connect signals from control worker */
connect(controlWorker, SIGNAL (gotNodes(QStringList)), this, SLOT (newNodes(QStringList)));
connect(controlWorker, SIGNAL (gotParams(QStringList)), this, SLOT (newParams(QStringList)));
connect(controlWorker, SIGNAL (gotParamValue(float)), this, SLOT (newParamValue(float)));
connect(controlWorker, SIGNAL (gotParamValue(QString, QString, float)), this, SLOT (newParamValue(QString, QString, float)));
connect(controlWorker, SIGNAL (gotConstantBlocks(QStringList)), this, SLOT (newConstantBlocks(QStringList)));
connect(controlWorker, SIGNAL (paramSet(QString, QString)), controlWorker, SLOT (getParamValue(QString, QString)));
......@@ -77,8 +77,6 @@ MainWindow::MainWindow(QWidget *parent) :
connect(findChild<QLineEdit *>("xSetpoint"), SIGNAL (returnPressed()), this, SLOT (sendSetpoints()));
connect(findChild<QLineEdit *>("ySetpoint"), SIGNAL (returnPressed()), this, SLOT (sendSetpoints()));
connect(findChild<QLineEdit *>("zSetpoint"), SIGNAL (returnPressed()), this, SLOT (sendSetpoints()));
connect(findChild<QListView *>("setpointList"), SIGNAL (doubleClicked(QModelIndex)), this, SLOT (sendSelectedSetpoint()));
}
MainWindow::~MainWindow()
......@@ -159,15 +157,15 @@ void MainWindow::newNodes(QStringList blocks)
void MainWindow::newConstantBlocks(QStringList blocks)
{
QComboBox * xSelect = findChild<QComboBox *>("xSetpointSelect");
xSelect->clear(); /* Hopefully this clears the list */
xSelect->clear();
xSelect->addItems(blocks);
QComboBox * ySelect = findChild<QComboBox *>("ySetpointSelect");
ySelect->clear(); /* Hopefully this clears the list */
ySelect->clear();
ySelect->addItems(blocks);
QComboBox * zSelect = findChild<QComboBox *>("zSetpointSelect");
zSelect->clear(); /* Hopefully this clears the list */
zSelect->clear();
zSelect->addItems(blocks);
for (ssize_t i = 0; i < blocks.size(); i++) {
......@@ -188,13 +186,22 @@ void MainWindow::newConstantBlocks(QStringList blocks)
void MainWindow::newParams(QStringList params)
{
QComboBox * select = findChild<QComboBox *>("paramSelect");
select->clear(); /* Hopefully this clears the list */
select->clear();
select->addItems(params);
}
void MainWindow::newParamValue(float val)
void MainWindow::newParamValue(QString node, QString param, float val)
{
findChild<QLineEdit *>("paramValue")->setText(QString::number(val));
/* Update the nav page setpoints if it's a setpoint paramvalue */
if (node == findChild<QComboBox *>("xSetpointSelect")->currentText()) {
findChild<QLineEdit *>("xSetpoint")->setText(QString::number(val));
} else if (node == findChild<QComboBox *>("ySetpointSelect")->currentText()) {
findChild<QLineEdit *>("ySetpoint")->setText(QString::number(val));
} else if (node == findChild<QComboBox *>("zSetpointSelect")->currentText()) {
findChild<QLineEdit *>("zSetpoint")->setText(QString::number(val));
}
}
void MainWindow::on_paramSelect_currentIndexChanged(const QString &arg1)
......
......@@ -38,7 +38,7 @@ private slots:
void newNodes(QStringList blocks);
void newParams(QStringList params);
void newParamValue(float val);
void newParamValue(QString node, QString param, float val);
void newConstantBlocks(QStringList blocks);
void on_paramSelect_currentIndexChanged(const QString &arg1);
......
......@@ -18,7 +18,7 @@
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>0</number>
<number>2</number>
</property>
<widget class="QWidget" name="backend">
<attribute name="title">
......@@ -476,6 +476,26 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pbInsertSetpoint">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Insert</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pbDeleteSetpoint">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>Delete</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_3">
<property name="orientation">
......@@ -498,6 +518,15 @@
<property name="editTriggers">
<set>QAbstractItemView::NoEditTriggers</set>
</property>
<property name="dragEnabled">
<bool>true</bool>
</property>
<property name="dragDropMode">
<enum>QAbstractItemView::InternalMove</enum>
</property>
<property name="defaultDropAction">
<enum>Qt::MoveAction</enum>
</property>
</widget>
</item>
<item>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment