-
Notifications
You must be signed in to change notification settings - Fork 0
/
igains.cpp
40 lines (32 loc) · 1.06 KB
/
igains.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#include "igains.h"
#include "ui_igains.h"
IGains::IGains(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::IGains),
bpm_count(96)
{
ui->setupUi(this);
const int num_rows = 32;
const int num_cols= 3;
global_data = new double[bpm_count];
this->ui->ltGains->setRowStretch(num_rows - 1, 0);
this->ui->ltGains->setColumnStretch(num_cols - 1, 0);
this->ui->ltGains->setHorizontalSpacing(5);
for (int index = 0; index < bpm_count; ++index)
this->ui->ltGains->addWidget(new PIDGainWidget(index, "I", this));
CONNECT_CLOSE_BUTTON;
}
IGains::~IGains()
{
delete ui;
}
void IGains::on_btnGlobalSet_clicked()
{
QMessageBox::StandardButton reply = QMessageBox::question(nullptr, "Confirmation", "Are you sure you want to set a Global Gain?", QMessageBox::Yes|QMessageBox::No);
if (reply == QMessageBox::Yes){
double value = this->ui->globalSet->getValue();
for (int i = 0; i < bpm_count; ++i)
global_data[i] = value;
Client::writeDoubleArray("SOFB:PID:KI", global_data, 96);
}
}