fix ch1 &2 config bugs
This commit is contained in:
parent
faffd3695f
commit
1de7d438ad
@ -54,7 +54,7 @@ int MyTcpClient::sendData(char*data,qint64 len) {
|
||||
return bytesWritten;
|
||||
}
|
||||
void MyTcpClient::waitForRead() {
|
||||
socket->waitForReadyRead();
|
||||
socket->waitForReadyRead(3000);
|
||||
}
|
||||
void MyTcpClient::disconnectFromServer() {
|
||||
shouldReconnect = false; // 停止自动重连
|
||||
|
||||
@ -294,6 +294,9 @@ typedef struct SeismicMonitor_{
|
||||
normal_voltage_low = -20;
|
||||
signal_sensitivity = 8;
|
||||
channel_type = -1;
|
||||
function = 0;
|
||||
first_channel_angle = 0;
|
||||
second_channel_angle = 0;
|
||||
}
|
||||
} SeismicMonitor;
|
||||
|
||||
|
||||
@ -514,7 +514,7 @@
|
||||
<rect>
|
||||
<x>460</x>
|
||||
<y>280</y>
|
||||
<width>31</width>
|
||||
<width>41</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
||||
@ -298,6 +298,7 @@ void MainWindow::onMenuActionTriggered() {
|
||||
CardType card_type = static_cast<CardType>(action->data().toInt());
|
||||
qDebug() << "rack_type" << action->data() << "card type" << card_type;
|
||||
int button_id = button->objectName().right(button->objectName().length() - 15).toInt();
|
||||
current_slot = button_id;
|
||||
qDebug() << slot_type << rack_type << button_id << map_slot_config[button_id].slot_type << map_slot_config[button_id + 2].slot_type ;
|
||||
map_slot_config[button_id].slot_label->setStyleSheet("QLabel { color :#2980b9; font: bold 16px}");
|
||||
QString chan_display = "";
|
||||
@ -677,6 +678,12 @@ void MainWindow::on_pushButton_open_clicked() {
|
||||
return;
|
||||
}
|
||||
QFile file(tsi_config_file);
|
||||
// 先读出当前权限
|
||||
QFileDevice::Permissions p = file.permissions();
|
||||
// 加上写权限(所有者)
|
||||
p |= QFileDevice::WriteOwner | QFileDevice::WriteGroup | QFileDevice::WriteOther;
|
||||
// 去掉只读相当于重新设置权限
|
||||
file.setPermissions(p);
|
||||
if (!file.open(QIODevice::ReadOnly)) {
|
||||
qWarning() << "Failed to open update file.";
|
||||
return;
|
||||
|
||||
@ -47,6 +47,8 @@ Seismic_monitor::Seismic_monitor(int slot,CardType cardtype, QWidget *parent) :
|
||||
ui->label_text_4->setVisible(false);
|
||||
ui->label_text_5->setVisible(false);
|
||||
ui->label_text_6->setVisible(false);
|
||||
ui->comboBox_function_1->setCurrentIndex(0);
|
||||
ui->comboBox_function_2->setCurrentIndex(0);
|
||||
Init();
|
||||
}
|
||||
|
||||
@ -647,7 +649,13 @@ void Seismic_monitor::on_pushButton_copy_channel_clicked()
|
||||
void Seismic_monitor::on_comboBox_function_2_currentIndexChanged(int index)
|
||||
{
|
||||
if(index == 1 && (ui->comboBox_chan_type_3->currentIndex() != 0 || ui->comboBox_chan_type_4->currentIndex() != 0)){
|
||||
QMessageBox::warning(this, QStringLiteral("警告"), "通道1 和 通道2 必须为径向位移!");
|
||||
QMessageBox::warning(this, QStringLiteral("警告"), "通道3 和 通道4 必须为径向位移!");
|
||||
ui->comboBox_function_2->setCurrentIndex(0);
|
||||
return;
|
||||
}
|
||||
if((index == 2||index == 3||index == 4)
|
||||
&& (ui->comboBox_chan_type_3->currentIndex() != 3 || ui->comboBox_chan_type_4->currentIndex() != 3)){
|
||||
QMessageBox::warning(this, QStringLiteral("警告"), "通道3 和 通道4 必须为轴向位移!");
|
||||
ui->comboBox_function_2->setCurrentIndex(0);
|
||||
return;
|
||||
}
|
||||
@ -674,6 +682,9 @@ void Seismic_monitor::on_comboBox_function_2_currentIndexChanged(int index)
|
||||
ui->label_text_6->setVisible(false);
|
||||
}
|
||||
current_config_3_4 = index;
|
||||
if(index != 0){
|
||||
on_comboBox_dual_math_function_2_currentIndexChanged(0);
|
||||
}
|
||||
}
|
||||
|
||||
void Seismic_monitor::on_comboBox_function_1_currentIndexChanged(int index)
|
||||
@ -683,6 +694,12 @@ void Seismic_monitor::on_comboBox_function_1_currentIndexChanged(int index)
|
||||
ui->comboBox_function_1->setCurrentIndex(0);
|
||||
return;
|
||||
}
|
||||
if((index == 2||index == 3||index == 4)
|
||||
&& (ui->comboBox_chan_type_3->currentIndex() != 3 || ui->comboBox_chan_type_4->currentIndex() != 3)){
|
||||
QMessageBox::warning(this, QStringLiteral("警告"), "通道1 和 通道2 必须为轴向位移!");
|
||||
ui->comboBox_function_1->setCurrentIndex(0);
|
||||
return;
|
||||
}
|
||||
if(index == 3){
|
||||
ui->lineEdit_first_1->setVisible(true);
|
||||
ui->lineEdit_second_1->setVisible(true);
|
||||
@ -706,6 +723,9 @@ void Seismic_monitor::on_comboBox_function_1_currentIndexChanged(int index)
|
||||
ui->label_text_5->setVisible(false);
|
||||
}
|
||||
current_config_1_2 = index;
|
||||
if(index != 0){
|
||||
on_comboBox_dual_math_function_currentIndexChanged(0);
|
||||
}
|
||||
}
|
||||
QString Seismic_monitor::GetUnit(int unit_num){
|
||||
QString unit_str = "";
|
||||
@ -779,3 +799,51 @@ int Seismic_monitor::SetUnit(QString unit_str){
|
||||
}
|
||||
return unit_num;
|
||||
}
|
||||
|
||||
void Seismic_monitor::on_comboBox_dual_math_function_currentIndexChanged(int index)
|
||||
{
|
||||
std::shared_ptr<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot_no);
|
||||
std::shared_ptr<VibrationData> ptr = std::dynamic_pointer_cast<VibrationData>(base_ptr);
|
||||
std::shared_ptr<VariableBase> variable_base1 = ptr->GetChannelPtr(1);
|
||||
std::shared_ptr<VariableBase> variable_base2 = ptr->GetChannelPtr(2);
|
||||
qDebug() << "comboBox_function_1" << ui->comboBox_function_1->currentIndex();
|
||||
if(ui->comboBox_function_1->currentIndex() == kDMF && (index == kRMSSum || index == kRMSSubtraction)
|
||||
&& variable_base1->general.rectifier_function != 6
|
||||
&& variable_base2->general.rectifier_function != 6){
|
||||
QMessageBox::warning(this, QStringLiteral("警告"), "通道1 和 通道2 整流器必须为RMS!");
|
||||
ui->comboBox_function_1->setCurrentIndex(0);
|
||||
return;
|
||||
}
|
||||
if((index == kSUM || index == kSUBTRACTION || index == kXYMin || index == kXYMax)
|
||||
&& variable_base1->general.rectifier_function !=
|
||||
variable_base2->general.rectifier_function){
|
||||
QMessageBox::warning(this, QStringLiteral("警告"), "通道1 和 通道2 整流器必须配置相同!");
|
||||
ui->comboBox_function_1->setCurrentIndex(0);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Seismic_monitor::on_comboBox_dual_math_function_2_currentIndexChanged(int index)
|
||||
{
|
||||
std::shared_ptr<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot_no);
|
||||
std::shared_ptr<VibrationData> ptr = std::dynamic_pointer_cast<VibrationData>(base_ptr);
|
||||
std::shared_ptr<VariableBase> variable_base1 = ptr->GetChannelPtr(3);
|
||||
std::shared_ptr<VariableBase> variable_base2 = ptr->GetChannelPtr(4);
|
||||
qDebug() << "comboBox_function_2" << ui->comboBox_function_2->currentIndex();
|
||||
if(ui->comboBox_function_2->currentIndex() == kDMF && (index == kRMSSum || index == kRMSSubtraction)
|
||||
&& variable_base1->general.rectifier_function != 6
|
||||
&& variable_base2->general.rectifier_function != 6){
|
||||
QMessageBox::warning(this, QStringLiteral("警告"), "通道3 和 通道4 整流器必须为RMS!");
|
||||
ui->comboBox_function_2->setCurrentIndex(0);
|
||||
return;
|
||||
}
|
||||
if((index == kSUM || index == kSUBTRACTION || index == kXYMin || index == kXYMax)
|
||||
&& variable_base1->general.rectifier_function !=
|
||||
variable_base2->general.rectifier_function){
|
||||
QMessageBox::warning(this, QStringLiteral("警告"), "通道3 和 通道4 整流器必须配置相同!");
|
||||
ui->comboBox_function_2->setCurrentIndex(0);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -61,6 +61,10 @@ class Seismic_monitor : public QWidget {
|
||||
|
||||
void on_comboBox_function_1_currentIndexChanged(int index);
|
||||
|
||||
void on_comboBox_dual_math_function_currentIndexChanged(int index);
|
||||
|
||||
void on_comboBox_dual_math_function_2_currentIndexChanged(int index);
|
||||
|
||||
private:
|
||||
Ui::Seismic_monitor *ui;
|
||||
void UpdateData(std::shared_ptr<VibrationData> vib_data);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user