添加代码
This commit is contained in:
parent
c5a57c9678
commit
9f3b468afc
@ -270,6 +270,7 @@ void ConfigMgr::Save(QString & file_path) {
|
|||||||
channel_item.insert("threshold", ptr->variables_[cid].threshold);
|
channel_item.insert("threshold", ptr->variables_[cid].threshold);
|
||||||
channel_item.insert("hysteresis", ptr->variables_[cid].hysteresis);
|
channel_item.insert("hysteresis", ptr->variables_[cid].hysteresis);
|
||||||
channel_item.insert("events_per_revolution", ptr->variables_[cid].events_per_revolution);
|
channel_item.insert("events_per_revolution", ptr->variables_[cid].events_per_revolution);
|
||||||
|
channel_item.insert("automatic_threshold",ptr->variables_[cid].automatic_threshold);
|
||||||
}
|
}
|
||||||
slot_item[QString::number(cid + 1)] = channel_item;
|
slot_item[QString::number(cid + 1)] = channel_item;
|
||||||
}
|
}
|
||||||
@ -534,6 +535,7 @@ void ConfigMgr::Load(QString filename) {
|
|||||||
speed_data->variables_[j].normal_latching = channel["normal_latching"].toBool();
|
speed_data->variables_[j].normal_latching = channel["normal_latching"].toBool();
|
||||||
speed_data->variables_[j].speed_peek = channel["speed_peak"].toInt();
|
speed_data->variables_[j].speed_peek = channel["speed_peak"].toInt();
|
||||||
speed_data->variables_[j].default_speed = channel["default_speed"].toInt();
|
speed_data->variables_[j].default_speed = channel["default_speed"].toInt();
|
||||||
|
speed_data->variables_[j].automatic_threshold = channel["automatic_threshold"].toBool();
|
||||||
|
|
||||||
|
|
||||||
QJsonObject setpoint_data = channel["setpoint"].toObject();
|
QJsonObject setpoint_data = channel["setpoint"].toObject();
|
||||||
@ -561,6 +563,7 @@ void ConfigMgr::Load(QString filename) {
|
|||||||
keyphase_data->variables_[j].threshold = channel["threshold"].toDouble();
|
keyphase_data->variables_[j].threshold = channel["threshold"].toDouble();
|
||||||
keyphase_data->variables_[j].hysteresis = channel["hysteresis"].toDouble();
|
keyphase_data->variables_[j].hysteresis = channel["hysteresis"].toDouble();
|
||||||
keyphase_data->variables_[j].events_per_revolution = channel["events_per_revolution"].toInt();
|
keyphase_data->variables_[j].events_per_revolution = channel["events_per_revolution"].toInt();
|
||||||
|
keyphase_data->variables_[j].automatic_threshold = channel["automatic_threshold"].toBool();
|
||||||
}
|
}
|
||||||
cards_.push_back(keyphase_data);
|
cards_.push_back(keyphase_data);
|
||||||
}else if (card_type_[i] == kCardRelaySingleNOK ){
|
}else if (card_type_[i] == kCardRelaySingleNOK ){
|
||||||
|
72
keyphase.cpp
72
keyphase.cpp
@ -193,3 +193,75 @@ void KeyPhase::on_pushButton_confirm_clicked() {
|
|||||||
this->close();
|
this->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void KeyPhase::on_radioButton_manual_threshold_1_clicked()
|
||||||
|
{
|
||||||
|
if(ui->radioButton_manual_threshold_1->isChecked()){
|
||||||
|
ui->doubleSpinBox_threshold_1->setEnabled(true);
|
||||||
|
ui->doubleSpinBox_hysteresis_1->setEnabled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void KeyPhase::on_radioButton_automatic_threshold_1_clicked()
|
||||||
|
{
|
||||||
|
if(ui->radioButton_automatic_threshold_1->isChecked()){
|
||||||
|
ui->doubleSpinBox_threshold_1->setEnabled(false);
|
||||||
|
ui->doubleSpinBox_hysteresis_1->setEnabled(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void KeyPhase::on_radioButton_automatic_threshold_2_clicked()
|
||||||
|
{
|
||||||
|
if(ui->radioButton_automatic_threshold_2->isChecked()){
|
||||||
|
ui->doubleSpinBox_threshold_2->setEnabled(false);
|
||||||
|
ui->doubleSpinBox_hysteresis_2->setEnabled(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void KeyPhase::on_radioButton_manual_threshold_2_clicked()
|
||||||
|
{
|
||||||
|
if(ui->radioButton_manual_threshold_2->isChecked()){
|
||||||
|
ui->doubleSpinBox_threshold_2->setEnabled(true);
|
||||||
|
ui->doubleSpinBox_hysteresis_2->setEnabled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void KeyPhase::on_radioButton_automatic_threshold_3_clicked()
|
||||||
|
{
|
||||||
|
if(ui->radioButton_automatic_threshold_3->isChecked()){
|
||||||
|
ui->doubleSpinBox_threshold_3->setEnabled(false);
|
||||||
|
ui->doubleSpinBox_hysteresis_3->setEnabled(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void KeyPhase::on_radioButton_manual_threshold_3_clicked()
|
||||||
|
{
|
||||||
|
if(ui->radioButton_manual_threshold_3->isChecked()){
|
||||||
|
ui->doubleSpinBox_threshold_3->setEnabled(true);
|
||||||
|
ui->doubleSpinBox_hysteresis_3->setEnabled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void KeyPhase::on_radioButton_automatic_threshold_4_clicked()
|
||||||
|
{
|
||||||
|
if(ui->radioButton_automatic_threshold_4->isChecked()){
|
||||||
|
ui->doubleSpinBox_threshold_4->setEnabled(false);
|
||||||
|
ui->doubleSpinBox_hysteresis_4->setEnabled(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void KeyPhase::on_radioButton_manual_threshold_4_clicked()
|
||||||
|
{
|
||||||
|
if(ui->radioButton_manual_threshold_4->isChecked()){
|
||||||
|
ui->doubleSpinBox_threshold_4->setEnabled(true);
|
||||||
|
ui->doubleSpinBox_hysteresis_4->setEnabled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
18
keyphase.h
18
keyphase.h
@ -23,7 +23,23 @@ class KeyPhase : public QDialog {
|
|||||||
void on_manual_threshold_2_clicked(bool checked);
|
void on_manual_threshold_2_clicked(bool checked);
|
||||||
void on_manual_threshold_3_clicked(bool checked);
|
void on_manual_threshold_3_clicked(bool checked);
|
||||||
void on_manual_threshold_4_clicked(bool checked);
|
void on_manual_threshold_4_clicked(bool checked);
|
||||||
private:
|
void on_radioButton_manual_threshold_1_clicked();
|
||||||
|
|
||||||
|
void on_radioButton_automatic_threshold_1_clicked();
|
||||||
|
|
||||||
|
void on_radioButton_automatic_threshold_2_clicked();
|
||||||
|
|
||||||
|
void on_radioButton_manual_threshold_2_clicked();
|
||||||
|
|
||||||
|
void on_radioButton_automatic_threshold_3_clicked();
|
||||||
|
|
||||||
|
void on_radioButton_manual_threshold_3_clicked();
|
||||||
|
|
||||||
|
void on_radioButton_automatic_threshold_4_clicked();
|
||||||
|
|
||||||
|
void on_radioButton_manual_threshold_4_clicked();
|
||||||
|
|
||||||
|
private:
|
||||||
Ui::KeyPhase *ui;
|
Ui::KeyPhase *ui;
|
||||||
void UpdateData(std::shared_ptr<KeyphaseData> &keyphase_data);
|
void UpdateData(std::shared_ptr<KeyphaseData> &keyphase_data);
|
||||||
// TachometerVariables keyphase_variables[4];
|
// TachometerVariables keyphase_variables[4];
|
||||||
|
@ -109,7 +109,7 @@
|
|||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>0</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="tab">
|
<widget class="QWidget" name="tab">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
@ -933,7 +933,7 @@
|
|||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
<number>0</number>
|
<number>1</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="tab_5">
|
<widget class="QWidget" name="tab_5">
|
||||||
<attribute name="title">
|
<attribute name="title">
|
||||||
|
@ -482,7 +482,6 @@ void MainWindow::OnButtonGroup(QAbstractButton *slot_btn) {
|
|||||||
setpoint_tachometer->show();
|
setpoint_tachometer->show();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -174,8 +174,12 @@ void Tachometer::Init() {
|
|||||||
ui->default_value_1->setValue(speed_data->variables_[i].default_speed);
|
ui->default_value_1->setValue(speed_data->variables_[i].default_speed);
|
||||||
if (speed_data->variables_[i].automatic_threshold) {
|
if (speed_data->variables_[i].automatic_threshold) {
|
||||||
ui->radioButton_automatic_threshold_1->setChecked(true);
|
ui->radioButton_automatic_threshold_1->setChecked(true);
|
||||||
|
ui->doubleSpinBox_threshold_1->setEnabled(false);
|
||||||
|
ui->doubleSpinBox_hysteresis_1->setEnabled(false);
|
||||||
} else {
|
} else {
|
||||||
ui->radioButton_manual_threshold_1->setChecked(true);
|
ui->radioButton_manual_threshold_1->setChecked(true);
|
||||||
|
ui->doubleSpinBox_threshold_1->setEnabled(true);
|
||||||
|
ui->doubleSpinBox_hysteresis_1->setEnabled(true);
|
||||||
}
|
}
|
||||||
ui->doubleSpinBox_threshold_1->setValue(speed_data->variables_[i].threshold);
|
ui->doubleSpinBox_threshold_1->setValue(speed_data->variables_[i].threshold);
|
||||||
ui->doubleSpinBox_hysteresis_1->setValue(speed_data->variables_[i].hysteresis);
|
ui->doubleSpinBox_hysteresis_1->setValue(speed_data->variables_[i].hysteresis);
|
||||||
@ -200,8 +204,12 @@ void Tachometer::Init() {
|
|||||||
ui->default_value_2->setValue(speed_data->variables_[i].default_speed);
|
ui->default_value_2->setValue(speed_data->variables_[i].default_speed);
|
||||||
if (speed_data->variables_[i].automatic_threshold) {
|
if (speed_data->variables_[i].automatic_threshold) {
|
||||||
ui->radioButton_automatic_threshold_2->setChecked(true);
|
ui->radioButton_automatic_threshold_2->setChecked(true);
|
||||||
|
ui->doubleSpinBox_threshold_2->setEnabled(false);
|
||||||
|
ui->doubleSpinBox_hysteresis_2->setEnabled(false);
|
||||||
} else {
|
} else {
|
||||||
ui->radioButton_manual_threshold_2->setChecked(true);
|
ui->radioButton_manual_threshold_2->setChecked(true);
|
||||||
|
ui->doubleSpinBox_threshold_2->setEnabled(true);
|
||||||
|
ui->doubleSpinBox_hysteresis_2->setEnabled(true);
|
||||||
}
|
}
|
||||||
ui->doubleSpinBox_threshold_2->setValue(speed_data->variables_[i].threshold);
|
ui->doubleSpinBox_threshold_2->setValue(speed_data->variables_[i].threshold);
|
||||||
ui->doubleSpinBox_hysteresis_2->setValue(speed_data->variables_[i].hysteresis);
|
ui->doubleSpinBox_hysteresis_2->setValue(speed_data->variables_[i].hysteresis);
|
||||||
@ -226,8 +234,12 @@ void Tachometer::Init() {
|
|||||||
ui->default_value_3->setValue(speed_data->variables_[i].default_speed);
|
ui->default_value_3->setValue(speed_data->variables_[i].default_speed);
|
||||||
if (speed_data->variables_[i].automatic_threshold) {
|
if (speed_data->variables_[i].automatic_threshold) {
|
||||||
ui->radioButton_automatic_threshold_3->setChecked(true);
|
ui->radioButton_automatic_threshold_3->setChecked(true);
|
||||||
|
ui->doubleSpinBox_threshold_3->setEnabled(false);
|
||||||
|
ui->doubleSpinBox_hysteresis_3->setEnabled(false);
|
||||||
} else {
|
} else {
|
||||||
ui->radioButton_manual_threshold_3->setChecked(true);
|
ui->radioButton_manual_threshold_3->setChecked(true);
|
||||||
|
ui->doubleSpinBox_threshold_3->setEnabled(true);
|
||||||
|
ui->doubleSpinBox_hysteresis_3->setEnabled(true);
|
||||||
}
|
}
|
||||||
ui->doubleSpinBox_threshold_3->setValue(speed_data->variables_[i].threshold);
|
ui->doubleSpinBox_threshold_3->setValue(speed_data->variables_[i].threshold);
|
||||||
ui->doubleSpinBox_hysteresis_3->setValue(speed_data->variables_[i].hysteresis);
|
ui->doubleSpinBox_hysteresis_3->setValue(speed_data->variables_[i].hysteresis);
|
||||||
@ -252,8 +264,12 @@ void Tachometer::Init() {
|
|||||||
ui->default_value_4->setValue(speed_data->variables_[i].default_speed);
|
ui->default_value_4->setValue(speed_data->variables_[i].default_speed);
|
||||||
if (speed_data->variables_[i].automatic_threshold) {
|
if (speed_data->variables_[i].automatic_threshold) {
|
||||||
ui->radioButton_automatic_threshold_4->setChecked(true);
|
ui->radioButton_automatic_threshold_4->setChecked(true);
|
||||||
|
ui->doubleSpinBox_threshold_4->setEnabled(false);
|
||||||
|
ui->doubleSpinBox_hysteresis_4->setEnabled(false);
|
||||||
} else {
|
} else {
|
||||||
ui->radioButton_manual_threshold_4->setChecked(true);
|
ui->radioButton_manual_threshold_4->setChecked(true);
|
||||||
|
ui->doubleSpinBox_threshold_4->setEnabled(true);
|
||||||
|
ui->doubleSpinBox_hysteresis_4->setEnabled(true);
|
||||||
}
|
}
|
||||||
ui->doubleSpinBox_threshold_4->setValue(speed_data->variables_[i].threshold);
|
ui->doubleSpinBox_threshold_4->setValue(speed_data->variables_[i].threshold);
|
||||||
ui->doubleSpinBox_hysteresis_4->setValue(speed_data->variables_[i].hysteresis);
|
ui->doubleSpinBox_hysteresis_4->setValue(speed_data->variables_[i].hysteresis);
|
||||||
@ -288,3 +304,9 @@ void Tachometer::on_pushButton_confirm_clicked() {
|
|||||||
void Tachometer::on_pushButton_cancel_clicked() {
|
void Tachometer::on_pushButton_cancel_clicked() {
|
||||||
this->close();
|
this->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Tachometer::on_radioButton_automatic_threshold_1_clicked()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -24,7 +24,9 @@ class Tachometer : public QDialog {
|
|||||||
void on_manual_threshold_2_clicked(bool checked);
|
void on_manual_threshold_2_clicked(bool checked);
|
||||||
void on_manual_threshold_3_clicked(bool checked);
|
void on_manual_threshold_3_clicked(bool checked);
|
||||||
void on_manual_threshold_4_clicked(bool checked);
|
void on_manual_threshold_4_clicked(bool checked);
|
||||||
private:
|
void on_radioButton_automatic_threshold_1_clicked();
|
||||||
|
|
||||||
|
private:
|
||||||
Ui::Tachometer *ui;
|
Ui::Tachometer *ui;
|
||||||
void UpdateData(std::shared_ptr<TachometerData> &speed_data);
|
void UpdateData(std::shared_ptr<TachometerData> &speed_data);
|
||||||
// Tachometer_Variables tachometer_variables[4];
|
// Tachometer_Variables tachometer_variables[4];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user