diff --git a/config_mgr.cpp b/config_mgr.cpp index dbfb14d..1e9c817 100644 --- a/config_mgr.cpp +++ b/config_mgr.cpp @@ -61,40 +61,53 @@ void ConfigMgr::Save(QString & file_path) { if( ptr->base_config_[cid].channel_type == -1){ continue; } - channel_item["standby"] = ptr->base_config_[cid].standby; - channel_item["active"] = ptr->base_config_[cid].active; -// channel_item["rack_type"] = 0; // TODO: + if(ptr->base_config_[cid].channel_type == kVib12 || + ptr->base_config_[cid].channel_type == kVib34){ + channel_item["function"] = ptr->base_config_[cid].function; + if(ptr->base_config_[cid].function == kRST){ + channel_item["fisrt_channel_angle"] = ptr->base_config_[cid].fisrt_channel_angle; + channel_item["second_channel_angle"] = ptr->base_config_[cid].second_channel_angle; + }else if(ptr->base_config_[cid].function == kDMF){ + channel_item["dmf_function"] = ptr->base_config_[cid].dmf_function; + } + channel_item["function"] = ptr->base_config_[cid].function; + }else{ + channel_item["standby"] = ptr->base_config_[cid].standby; + channel_item["active"] = ptr->base_config_[cid].active; + // channel_item["rack_type"] = 0; // TODO: + // channel_item["transducer_id"] = ptr->base_config_[cid].transducer_id; + // channel_item["scale_factor"] = ptr->base_config_[cid].scale_factor; + // channel_item["sampling_rate"] = ptr->base_config_[cid].sampling_rate; + channel_item["power"] = ptr->base_config_[cid].power; + channel_item["point_name"] = ptr->base_config_[cid].point_name; + channel_item["chan_id"] = ptr->base_config_[cid].chan_id; + channel_item["sensitivity_unit"] = ptr->base_config_[cid].sensitivity_unit; + channel_item["signal_sensitivity"] = ptr->base_config_[cid].signal_sensitivity; + + + QJsonArray voltage_range; + voltage_range.append(ptr->base_config_[cid].normal_voltage_low); + voltage_range.append(ptr->base_config_[cid].normal_voltage_high); + channel_item["normal_voltage_range"] = voltage_range; + // output channel + QJsonObject dc_output_item; + if(ptr->dc_output[cid].output_channel != -1){ + dc_output_item["output_channel"] = ptr->dc_output[cid].output_channel; + dc_output_item["minmum"] = ptr->dc_output[cid].minmum; + dc_output_item["maxmum"] = ptr->dc_output[cid].maxmum; + dc_output[QString::number(cid + 1)] = dc_output_item; + } + if(ptr->base_config_[cid].channel_type == kVibRadial || ptr->base_config_[cid].channel_type == kVibThrust || + ptr->base_config_[cid].channel_type == kVibAcc || ptr->base_config_[cid].channel_type == kVibVelocity ){ + if(ptr->base_config_[cid].channel_type != kVibThrust){ + channel_item["keyphase"] = ptr->base_config_[cid].keyphase; + channel_item["keyphase_slot"] = ptr->base_config_[cid].keyphase_slot; + channel_item["keyphase_ch"] = ptr->base_config_[cid].keyphase_ch; + } + } + } channel_item["channel_type"] = ptr->base_config_[cid].channel_type; -// channel_item["transducer_id"] = ptr->base_config_[cid].transducer_id; -// channel_item["scale_factor"] = ptr->base_config_[cid].scale_factor; -// channel_item["sampling_rate"] = ptr->base_config_[cid].sampling_rate; - channel_item["power"] = ptr->base_config_[cid].power; - channel_item["point_name"] = ptr->base_config_[cid].point_name; - channel_item["chan_id"] = ptr->base_config_[cid].chan_id; - channel_item["sensitivity_unit"] = ptr->base_config_[cid].sensitivity_unit; - channel_item["signal_sensitivity"] = ptr->base_config_[cid].signal_sensitivity; - - QJsonArray voltage_range; - voltage_range.append(ptr->base_config_[cid].normal_voltage_low); - voltage_range.append(ptr->base_config_[cid].normal_voltage_high); - channel_item["normal_voltage_range"] = voltage_range; - // output channel - QJsonObject dc_output_item; - if(ptr->dc_output[cid].output_channel != -1){ - dc_output_item["output_channel"] = ptr->dc_output[cid].output_channel; - dc_output_item["minmum"] = ptr->dc_output[cid].minmum; - dc_output_item["maxmum"] = ptr->dc_output[cid].maxmum; - dc_output[QString::number(cid + 1)] = dc_output_item; - } - if(ptr->base_config_[cid].channel_type == kVibRadial || ptr->base_config_[cid].channel_type == kVibThrust || - ptr->base_config_[cid].channel_type == kVibAcc || ptr->base_config_[cid].channel_type == kVibVelocity ){ - if(ptr->base_config_[cid].channel_type != kVibThrust){ - channel_item["keyphase"] = ptr->base_config_[cid].keyphase; - channel_item["keyphase_slot"] = ptr->base_config_[cid].keyphase_slot; - channel_item["keyphase_ch"] = ptr->base_config_[cid].keyphase_ch; - } - } // if(ptr->base_config_[cid].channel_type == kVibPressurePulsation){ // setpoint_data["low_upper"] = qRound(ptr->alert_danger_press[cid].low_upper * 10)/10.0; // setpoint_data["low_enable"] = ptr->alert_danger_press[cid].low_enable; @@ -110,7 +123,7 @@ void ConfigMgr::Save(QString & file_path) { // variables QJsonObject variables; std::shared_ptr base_channel_ptr = ptr->GetChannelPtr(cid + 1); - if (base_channel_ptr == nullptr) { + if (base_channel_ptr == nullptr && cid < 4) { continue; } if (ptr->base_config_[cid].channel_type == kVibRadial) { @@ -435,92 +448,6 @@ void ConfigMgr::Save(QString & file_path) { processed_output["general"] = general; processed_output["alarm"] = alarm; variables["processed_output"] = processed_output; - }else if(ptr->base_config_[cid].channel_type == kVib12){ - std::shared_ptr av_ptr = std::dynamic_pointer_cast(base_channel_ptr); - if(av_ptr == nullptr){ - continue; - } - // filter - QJsonArray filter; - QJsonObject low_pass; - low_pass["low"] = av_ptr->filter_[0].low; - low_pass["high"] = av_ptr->filter_[0].high; - low_pass["checked"] = av_ptr->filter_[0].checked; - filter.append(low_pass); - QJsonObject high_pass; - high_pass["low"] = av_ptr->filter_[1].low; - high_pass["high"] = av_ptr->filter_[1].high; - high_pass["checked"] = av_ptr->filter_[1].checked; - filter.append(high_pass); - QJsonObject band_pass; - band_pass["low"] = av_ptr->filter_[2].low; - band_pass["high"] = av_ptr->filter_[2].high; - band_pass["checked"] = av_ptr->filter_[2].checked; - filter.append(band_pass); - variables["filter"] = filter; - // processed output - QJsonObject processed_output,general,alarm; - general["output_used"] = av_ptr->general.output_used; - general["engieneering_unit"] = av_ptr->general.engineering_unit; - general["rectifier_function"] = av_ptr->general.rectifier_function; - - alarm["danger_high_level"] = av_ptr->danger_high.level; - alarm["danger_high_hysteresis"] = av_ptr->danger_high.hysteresis; - alarm["danger_high_delay"] = av_ptr->danger_high.delay; - alarm["danger_high_enable"] = av_ptr->danger_high.enable; - alarm["danger_high_latch"] = av_ptr->danger_high.latch; - alarm["alert_high_level"] = av_ptr->alert_high.level; - alarm["alert_high_hysteresis"] = av_ptr->alert_high.hysteresis; - alarm["alert_high_delay"] = av_ptr->alert_high.delay; - alarm["alert_high_enable"] = av_ptr->alert_high.enable; - alarm["alert_high_latch"] = av_ptr->alert_high.latch; - processed_output["general"] = general; - processed_output["alarm"] = alarm; - variables["processed_output"] = processed_output; - - }else if(ptr->base_config_[cid].channel_type == kVib34){ - std::shared_ptr av_ptr = std::dynamic_pointer_cast(base_channel_ptr); - if(av_ptr == nullptr){ - continue; - } - // filter - QJsonArray filter; - QJsonObject low_pass; - low_pass["low"] = av_ptr->filter_[0].low; - low_pass["high"] = av_ptr->filter_[0].high; - low_pass["checked"] = av_ptr->filter_[0].checked; - filter.append(low_pass); - QJsonObject high_pass; - high_pass["low"] = av_ptr->filter_[1].low; - high_pass["high"] = av_ptr->filter_[1].high; - high_pass["checked"] = av_ptr->filter_[1].checked; - filter.append(high_pass); - QJsonObject band_pass; - band_pass["low"] = av_ptr->filter_[2].low; - band_pass["high"] = av_ptr->filter_[2].high; - band_pass["checked"] = av_ptr->filter_[2].checked; - filter.append(band_pass); - variables["filter"] = filter; - // processed output - QJsonObject processed_output,general,alarm; - general["output_used"] = av_ptr->general.output_used; - general["engieneering_unit"] = av_ptr->general.engineering_unit; - general["rectifier_function"] = av_ptr->general.rectifier_function; - - alarm["danger_high_level"] = av_ptr->danger_high.level; - alarm["danger_high_hysteresis"] = av_ptr->danger_high.hysteresis; - alarm["danger_high_delay"] = av_ptr->danger_high.delay; - alarm["danger_high_enable"] = av_ptr->danger_high.enable; - alarm["danger_high_latch"] = av_ptr->danger_high.latch; - alarm["alert_high_level"] = av_ptr->alert_high.level; - alarm["alert_high_hysteresis"] = av_ptr->alert_high.hysteresis; - alarm["alert_high_delay"] = av_ptr->alert_high.delay; - alarm["alert_high_enable"] = av_ptr->alert_high.enable; - alarm["alert_high_latch"] = av_ptr->alert_high.latch; - processed_output["general"] = general; - processed_output["alarm"] = alarm; - variables["processed_output"] = processed_output; - } channel_item["variable"] = variables; } else if (card_type_[i] == kCardSpeedSingle || card_type_[i] == kCardSpeedTMRPrimary) { @@ -738,25 +665,37 @@ void ConfigMgr::Load(QString filename) { if(channel.isEmpty()) continue; // base info - vib_data->base_config_[j].standby = channel["standby"].toBool(); - vib_data->base_config_[j].active = channel["active"].toBool(); -// vib_data->base_config_[j].rack_type = channel["rack_type"].toInt(); -// vib_data->base_config_[j].tmr_group = channel["tmr_group"].toString(); vib_data->base_config_[j].channel_type = channel["channel_type"].toInt(); - vib_data->base_config_[j].transducer_id = channel["transducer_id"].toInt(); -// vib_data->base_config_[j].scale_factor = channel["scale_factor"].toDouble(); -// vib_data->base_config_[j].sampling_rate = channel["sampling_rate"].toInt(); - QJsonArray voltage_range_array = channel["normal_voltage_range"].toArray(); - vib_data->base_config_[j].normal_voltage_low = voltage_range_array[0].toDouble(); - vib_data->base_config_[j].normal_voltage_high = voltage_range_array[1].toDouble(); - vib_data->base_config_[j].power = channel["power"].toBool(); - vib_data->base_config_[j].point_name = channel["point_name"].toString(); - vib_data->base_config_[j].chan_id = channel["chan_id"].toString(); - vib_data->base_config_[j].sensitivity_unit = channel["sensitivity_unit"].toInt(); - vib_data->base_config_[j].signal_sensitivity = channel["signal_sensitivity"].toDouble(); - vib_data->base_config_[j].keyphase = channel["keyphase"].toBool(); - vib_data->base_config_[j].keyphase_slot = channel["keyphase_slot"].toInt(); - vib_data->base_config_[j].keyphase_ch = channel["keyphase_ch"].toInt(); + if(vib_data->base_config_[j].channel_type == kVib12 || + vib_data->base_config_[j].channel_type == kVib34){ + vib_data->base_config_[j].function = channel["function"].toInt(); + if(vib_data->base_config_[j].function == kRST){ + vib_data->base_config_[j].fisrt_channel_angle = channel["fisrt_channel_angle"].toDouble(); + vib_data->base_config_[j].second_channel_angle = channel["second_channel_angle"].toDouble(); + }else if(vib_data->base_config_[j].function == kDMF){ + vib_data->base_config_[j].dmf_function = channel["dmf_function"].toInt(); + } + }else{ + vib_data->base_config_[j].standby = channel["standby"].toBool(); + vib_data->base_config_[j].active = channel["active"].toBool(); + // vib_data->base_config_[j].rack_type = channel["rack_type"].toInt(); + // vib_data->base_config_[j].tmr_group = channel["tmr_group"].toString(); + vib_data->base_config_[j].transducer_id = channel["transducer_id"].toInt(); + // vib_data->base_config_[j].scale_factor = channel["scale_factor"].toDouble(); + // vib_data->base_config_[j].sampling_rate = channel["sampling_rate"].toInt(); + QJsonArray voltage_range_array = channel["normal_voltage_range"].toArray(); + vib_data->base_config_[j].normal_voltage_low = voltage_range_array[0].toDouble(); + vib_data->base_config_[j].normal_voltage_high = voltage_range_array[1].toDouble(); + vib_data->base_config_[j].power = channel["power"].toBool(); + vib_data->base_config_[j].point_name = channel["point_name"].toString(); + vib_data->base_config_[j].chan_id = channel["chan_id"].toString(); + vib_data->base_config_[j].sensitivity_unit = channel["sensitivity_unit"].toInt(); + vib_data->base_config_[j].signal_sensitivity = channel["signal_sensitivity"].toDouble(); + vib_data->base_config_[j].keyphase = channel["keyphase"].toBool(); + vib_data->base_config_[j].keyphase_slot = channel["keyphase_slot"].toInt(); + vib_data->base_config_[j].keyphase_ch = channel["keyphase_ch"].toInt(); + } + //setpoint QJsonObject setpoint_data = channel["setpoint"].toObject(); if(vib_data->base_config_[j].channel_type == kVibRadial || vib_data->base_config_[j].channel_type == kVibThrust || @@ -1049,49 +988,11 @@ void ConfigMgr::Load(QString filename) { break; } case kVib12: { - std::shared_ptr variable = std::make_shared(); - variable->id_ = j + 1; - QJsonObject processed_output, general, alarm; - processed_output = tmp_variable["processed_output"].toObject(); - general = processed_output["general"].toObject(); - alarm = processed_output["alarm"].toObject(); - variable->general.output_used = general["output_used"].toBool(); - variable->general.engineering_unit = general["engieneering_unit"].toInt(); - variable->general.rectifier_function = general["rectifier_function"].toInt(); - variable->danger_high.level = alarm["danger_high_level"].toDouble(); - variable->danger_high.hysteresis = alarm["danger_high_hysteresis"].toDouble(); - variable->danger_high.delay = alarm["danger_high_delay"].toInt(); - variable->danger_high.enable = alarm["danger_high_enable"].toBool(); - variable->danger_high.latch = alarm["danger_high_latch"].toBool(); - variable->alert_high.level = alarm["alert_high_level"].toDouble(); - variable->alert_high.hysteresis = alarm["alert_high_hysteresis"].toDouble(); - variable->alert_high.delay = alarm["alert_high_delay"].toInt(); - variable->alert_high.enable = alarm["alert_high_enable"].toBool(); - variable->alert_high.latch = alarm["alert_high_latch"].toBool(); - vib_data->variables_.push_back(variable); + break; } case kVib34: { - std::shared_ptr variable = std::make_shared(); - variable->id_ = j + 1; - QJsonObject processed_output, general, alarm; - processed_output = tmp_variable["processed_output"].toObject(); - general = processed_output["general"].toObject(); - alarm = processed_output["alarm"].toObject(); - variable->general.output_used = general["output_used"].toBool(); - variable->general.engineering_unit = general["engieneering_unit"].toInt(); - variable->general.rectifier_function = general["rectifier_function"].toInt(); - variable->danger_high.level = alarm["danger_high_level"].toDouble(); - variable->danger_high.hysteresis = alarm["danger_high_hysteresis"].toDouble(); - variable->danger_high.delay = alarm["danger_high_delay"].toInt(); - variable->danger_high.enable = alarm["danger_high_enable"].toBool(); - variable->danger_high.latch = alarm["danger_high_latch"].toBool(); - variable->alert_high.level = alarm["alert_high_level"].toDouble(); - variable->alert_high.hysteresis = alarm["alert_high_hysteresis"].toDouble(); - variable->alert_high.delay = alarm["alert_high_delay"].toInt(); - variable->alert_high.enable = alarm["alert_high_enable"].toBool(); - variable->alert_high.latch = alarm["alert_high_latch"].toBool(); - vib_data->variables_.push_back(variable); + break; } } @@ -1147,6 +1048,7 @@ void ConfigMgr::Load(QString filename) { keyphase_data->slot_ = slot; keyphase_data->card_type_ = static_cast(card_type_[i]); keyphase_data->version_ = temp_obj["version"].toInt(); + keyphase_data->relative_number = temp_obj["relative_number"].toInt(); keyphase_data->group = temp_obj["group"].toInt(); for (int j = 0; j < CHANNEL_COUNT_SPEED; ++j) { channel = temp_obj[QString::number(j + 1)].toObject(); diff --git a/data_config.h b/data_config.h index da979f4..4901f99 100644 --- a/data_config.h +++ b/data_config.h @@ -136,6 +136,15 @@ typedef enum{ kRMS = 6 } RectifierFuntion; +typedef enum{ + kNoProcessing = 0, + kSMAX = 1, + kDHE = 2, + kRST = 3, + kRSC = 4, + kDMF = 5 +}Funtion; + typedef enum{ kRMSSum = 0, kRMSSubtraction = 1, @@ -228,7 +237,8 @@ enum CMTCommand { kConfigMQTTBrokerInfo = 31, // 配置与获取MQTT broker信息 kConfigDeviceID = 32, // 配置设备编号,编号范围为1~99 kGetVoltageRangeValue = 33, // 获取子板动态电压范围 - kGetVibAuxProcessVersion = 34 + kGetVibAuxProcessVersion = 34, + kGetProcessID = 38 // 获取进程号 }; enum RS485Baudrate { kBaudrate2400 = 0, @@ -276,6 +286,7 @@ typedef struct SeismicMonitor_{ int function; float fisrt_channel_angle; float second_channel_angle; + int dmf_function; SeismicMonitor_(){ standby = false; active = false; @@ -897,6 +908,22 @@ typedef struct { uint8_t aux_version; // 辅助进程版本号 } GetAuxProcessVersionRsp; +typedef struct { + uint8_t head[3]; // 固定值:0xAA55AA + uint8_t cmd; // kGetProcessID + uint8_t version; // 版本号,默认为1 + uint8_t card_id; // 0xff为cpu卡,其它1-15 +} GetCardProcessIDReq; + +typedef struct { + uint8_t head[3]; // 固定值:0xAA55AA + uint8_t cmd; // kGetProcessID + uint8_t version; // 版本号,默认为1 + uint8_t code; + uint16_t pid1; // 主进程进程号 + uint16_t pid2; // 辅助进程进程号,只有振动板有这个号 +} GetCardProcessIDRsp; + struct BaseHeader { uint8_t head[3]; // 固定 0xAA 0x55 0xAA uint8_t cmd; diff --git a/keyphase.cpp b/keyphase.cpp index 5c4c2df..78ade46 100644 --- a/keyphase.cpp +++ b/keyphase.cpp @@ -213,7 +213,8 @@ void KeyPhase::Init() { ui->spinBox_events_per_revolution_4->setValue(keyphase_data->variables_[i].events_per_revolution); } } - ui->comboBox_group->setCurrentIndex(base_ptr->group + 1); + ui->comboBox_relative_number->setCurrentIndex(base_ptr->relative_number); + ui->comboBox_group->setCurrentIndex(base_ptr->group -1); } void KeyPhase::on_pushButton_confirm_clicked() { std::shared_ptr base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot_no); @@ -222,6 +223,8 @@ void KeyPhase::on_pushButton_confirm_clicked() { return; } base_ptr->group = ui->comboBox_group->currentIndex() + 1; + base_ptr->relative_number = ui->comboBox_relative_number->currentIndex(); + std::shared_ptr keyphase_data = std::dynamic_pointer_cast(base_ptr); UpdateData(keyphase_data); this->close(); diff --git a/keyphase.ui b/keyphase.ui index f2b7e73..a2b0d79 100644 --- a/keyphase.ui +++ b/keyphase.ui @@ -117,6 +117,107 @@ + + + + + + 相对编号: + + + + + + + + 50 + 0 + + + + + 0 + + + + + 1 + + + + + 2 + + + + + 3 + + + + + 4 + + + + + 5 + + + + + 6 + + + + + 7 + + + + + 8 + + + + + 9 + + + + + 10 + + + + + 11 + + + + + 12 + + + + + 13 + + + + + 14 + + + + + 15 + + + + + + diff --git a/mainwindow.cpp b/mainwindow.cpp index 02cb9dd..6aa7eb7 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -216,6 +216,7 @@ void MainWindow::createMenu(const QString &rootTitle, QPushButton *parent) { QAction *get_sub_log = mainMenu->addAction("获取日志"); QAction *get_sub_card_voltage = mainMenu->addAction("获取电压范围"); QAction *get_vib_version = mainMenu->addAction("获取振动板卡辅助程序版本"); + QAction *get_card_processID = mainMenu->addAction("获取进程号"); // 绑定 **鼠标事件过滤器**,确保只响应右键 // 设置右键菜单策略 @@ -243,7 +244,7 @@ void MainWindow::createMenu(const QString &rootTitle, QPushButton *parent) { QObject::connect(get_sub_log, &QAction::triggered, this, &MainWindow::onMenuActionTriggered); QObject::connect(get_sub_card_voltage, &QAction::triggered, this, &MainWindow::onMenuActionTriggered); QObject::connect(get_vib_version, &QAction::triggered, this, &MainWindow::onMenuActionTriggered); - + QObject::connect(get_card_processID, &QAction::triggered, this, &MainWindow::onMenuActionTriggered); } @@ -355,6 +356,13 @@ void MainWindow::onMenuActionTriggered() { return; } if (action->text() == "重置模块") { + QMessageBox *box = new QMessageBox(QMessageBox::Question, "提示", "是否重置板卡?", QMessageBox::Yes | QMessageBox::No, this); + box->button(QMessageBox::Yes)->setText("确认"); + box->button(QMessageBox::No)->setText("取消"); + int res = box->exec(); + if(QMessageBox::No == res){ + return; + } if (ConfigMgr::Instance()->card_type_[button_id - 1] == kCardRelayTMRPrimary) { map_slot_config[button_id].slot_type = ""; map_slot_config[button_id].slot_btn->setText(""); @@ -417,6 +425,8 @@ void MainWindow::onMenuActionTriggered() { GetVoltageRangeValue(button_id); }else if(action->text() == "获取振动板卡辅助程序版本"){ GetVibVersion(button_id); + }else if(action->text() == "获取进程号"){ + GetCardProcessID(button_id); } break; // 找到按钮后,跳出循环 } @@ -771,11 +781,13 @@ void MainWindow::sendUpgradePackage(int slot) { } qDebug() << "bytesSent" << bytesSent ; m_tcpClient->waitForRead(); - progressBar->reset(); - progressBar->setVisible(true); - QString upgrade_text = QStringLiteral("正在上传板卡 [ %1 ] …… %p%").arg(slot); - progressBar->setTextVisible(true); - progressBar->setFormat(upgrade_text); + if (slot != 0){ + progressBar->reset(); + progressBar->setVisible(true); + QString upgrade_text = QStringLiteral("正在上传板卡 [ %1 ] …… %p%").arg(slot); + progressBar->setTextVisible(true); + progressBar->setFormat(upgrade_text); + } file.close(); if (send_buf != NULL) { free(send_buf); @@ -857,6 +869,15 @@ void MainWindow::GetVibVersion(int slot){ m_tcpClient->waitForRead(); qDebug() << "bytesWritten: " << bytesWritten; } +void MainWindow::GetCardProcessID(int slot){ + slot_no = slot; + GetCardProcessIDReq get_card_processID_req = { {0xAA, 0x55, 0xAA}, kGetProcessID, 1,0}; + int length = sizeof(GetCardProcessIDReq); + get_card_processID_req.card_id = slot & 0xFF; + qint64 bytesWritten = m_tcpClient->sendData((char*)&get_card_processID_req, length); + m_tcpClient->waitForRead(); + qDebug() << "bytesWritten: " << bytesWritten; +} void MainWindow::readData(const QByteArray &data) { qDebug() << "Received from server:" << data; @@ -970,6 +991,16 @@ void MainWindow::readData(const QByteArray &data) { memcpy(&get_vib_version_rsp, data.data(), sizeof(GetAuxProcessVersionRsp)); QString str = QString("辅助程序版本: %1").arg(get_vib_version_rsp.aux_version); QMessageBox::information(this, QStringLiteral("提示"), str); + }else if(cmd == kGetProcessID){ + GetCardProcessIDRsp get_card_processID_rsp; + memcpy(&get_card_processID_rsp, data.data(), sizeof(GetCardProcessIDRsp)); + QString message = ""; + if(ConfigMgr::Instance()->card_type_[current_slot] == kCardVibSingle){ + message = QString("主进程进程号: %1 \n辅助进程进程号: %2").arg(get_card_processID_rsp.pid1).arg(get_card_processID_rsp.pid2); + }else { + message = QString("主进程进程号: %1").arg(get_card_processID_rsp.pid1); + } + QMessageBox::information(this, QStringLiteral("提示"), message); } } @@ -1041,7 +1072,7 @@ void MainWindow::onSetTime(){ qDebug() << "bytesWritten: " << bytesWritten; } void MainWindow::UploadConfigFile(uint8_t sub_cmd){ - QMessageBox *box = new QMessageBox(QMessageBox::Question, "提示", "确认上传配置文件?", QMessageBox::Yes | QMessageBox::No, this); + QMessageBox *box = new QMessageBox(QMessageBox::Question, "提示", "是否上传配置文件?", QMessageBox::Yes | QMessageBox::No, this); box->button(QMessageBox::Yes)->setText("确认"); box->button(QMessageBox::No)->setText("取消"); int res = box->exec(); @@ -1061,7 +1092,7 @@ void MainWindow::UploadConfigFile(uint8_t sub_cmd){ QByteArray fileData = file.readAll(); int fileSize = fileData.size(); if (fileSize > 10 * 1024 * 1024) { - QMessageBox::information(this, QStringLiteral("提示"), "文件大小超过10M,请重新选择!"); + QMessageBox::information(this, QStringLiteral("提示"), "文件大小超过10MB,请重新选择!"); file.close(); return; } diff --git a/mainwindow.h b/mainwindow.h index 8b64b80..6e06376 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -63,6 +63,7 @@ private: void UploadConfigFile(uint8_t sub_cmd); void GetVoltageRangeValue(int slot); void GetVibVersion(int slot); + void GetCardProcessID(int slot); private slots: diff --git a/seismic_monitor.cpp b/seismic_monitor.cpp index a3c9182..bb92f47 100644 --- a/seismic_monitor.cpp +++ b/seismic_monitor.cpp @@ -39,10 +39,14 @@ Seismic_monitor::Seismic_monitor(int slot,CardType cardtype, QWidget *parent) : ui->lineEdit_first_2->setVisible(false); ui->lineEdit_second_1->setVisible(false); ui->lineEdit_second_2->setVisible(false); + ui->comboBox_dual_math_function->setVisible(false); + ui->comboBox_dual_math_function_2->setVisible(false); ui->label_text_1->setVisible(false); ui->label_text_2->setVisible(false); ui->label_text_3->setVisible(false); ui->label_text_4->setVisible(false); + ui->label_text_5->setVisible(false); + ui->label_text_6->setVisible(false); Init(); } @@ -135,16 +139,42 @@ void Seismic_monitor::Init() { ui->doubleSpinBox_high_4->setValue(vib_data->base_config_[i].normal_voltage_high); }else if (i + 1 == 5) { - vib_data->base_config_[i].function = ui->comboBox_function_1->currentIndex(); - if(ui->comboBox_function_1->currentIndex() == 3){ - vib_data->base_config_[i].fisrt_channel_angle = ui->lineEdit_first_1->text().toFloat(); - vib_data->base_config_[i].second_channel_angle = ui->lineEdit_second_1->text().toFloat(); + ui->comboBox_function_1->setCurrentIndex(vib_data->base_config_[i].function); + if(vib_data->base_config_[i].function == kRST){ + ui->lineEdit_first_1->setVisible(true); + ui->lineEdit_second_1->setVisible(true); + ui->label_text_1->setVisible(true); + ui->label_text_2->setVisible(true); + ui->comboBox_dual_math_function->setVisible(false); + ui->label_text_5->setVisible(false); + ui->lineEdit_first_1->setText(QString::number(vib_data->base_config_[i].fisrt_channel_angle)); + ui->lineEdit_second_1->setText(QString::number(vib_data->base_config_[i].second_channel_angle)); + }else if(vib_data->base_config_[i].function == kDMF){ + ui->lineEdit_first_2->setVisible(false); + ui->lineEdit_second_2->setVisible(false); + ui->label_text_3->setVisible(false); + ui->label_text_4->setVisible(false); + ui->comboBox_dual_math_function->setVisible(true); + ui->label_text_5->setVisible(true); } }else if (i + 1 == 6) { - vib_data->base_config_[i].function = ui->comboBox_function_2->currentIndex(); - if(ui->comboBox_function_2->currentIndex() == 3){ - vib_data->base_config_[i].fisrt_channel_angle = ui->lineEdit_first_2->text().toFloat(); - vib_data->base_config_[i].second_channel_angle = ui->lineEdit_second_2->text().toFloat(); + ui->comboBox_function_2->setCurrentIndex(vib_data->base_config_[i].function); + if(vib_data->base_config_[i].function == kRST){ + ui->lineEdit_first_2->setVisible(true); + ui->lineEdit_second_2->setVisible(true); + ui->label_text_3->setVisible(true); + ui->label_text_4->setVisible(true); + ui->comboBox_dual_math_function_2->setVisible(false); + ui->label_text_6->setVisible(false); + ui->lineEdit_first_2->setText(QString::number(vib_data->base_config_[i].fisrt_channel_angle)); + ui->lineEdit_second_2->setText(QString::number(vib_data->base_config_[i].second_channel_angle)); + }else if(vib_data->base_config_[i].function == kDMF){ + ui->lineEdit_first_2->setVisible(false); + ui->lineEdit_second_2->setVisible(false); + ui->label_text_3->setVisible(false); + ui->label_text_4->setVisible(false); + ui->comboBox_dual_math_function_2->setVisible(true); + ui->label_text_6->setVisible(true); } } } @@ -229,13 +259,19 @@ void Seismic_monitor::UpdateData(std::shared_ptr vib_data) { if(ui->comboBox_function_1->currentIndex() == 3){ vib_data->base_config_[var].fisrt_channel_angle = ui->lineEdit_first_1->text().toFloat(); vib_data->base_config_[var].second_channel_angle = ui->lineEdit_second_1->text().toFloat(); + }else if(ui->comboBox_function_1->currentIndex() == 5){ + vib_data->base_config_[var].dmf_function = ui->comboBox_dual_math_function->currentIndex(); } + vib_data->base_config_[var].channel_type = kVib12; }else if (var + 1 == 6) { vib_data->base_config_[var].function = ui->comboBox_function_2->currentIndex(); if(ui->comboBox_function_2->currentIndex() == 3){ vib_data->base_config_[var].fisrt_channel_angle = ui->lineEdit_first_2->text().toFloat(); vib_data->base_config_[var].second_channel_angle = ui->lineEdit_second_2->text().toFloat(); + }else if(ui->comboBox_function_1->currentIndex() == 5){ + vib_data->base_config_[var].dmf_function = ui->comboBox_dual_math_function->currentIndex(); } + vib_data->base_config_[var].channel_type = kVib34; } } } @@ -613,21 +649,27 @@ void Seismic_monitor::on_comboBox_function_2_currentIndexChanged(int index) ui->comboBox_function_2->setCurrentIndex(0); return; } - if(index == 2){ - ui->pushButton_config_3_4->setEnabled(false); - }else{ - ui->pushButton_config_3_4->setEnabled(true); - } if(index == 3){ ui->lineEdit_first_2->setVisible(true); ui->lineEdit_second_2->setVisible(true); ui->label_text_3->setVisible(true); ui->label_text_4->setVisible(true); + ui->comboBox_dual_math_function_2->setVisible(false); + ui->label_text_6->setVisible(false); + }else if(index == 5){ + ui->lineEdit_first_2->setVisible(false); + ui->lineEdit_second_2->setVisible(false); + ui->label_text_3->setVisible(false); + ui->label_text_4->setVisible(false); + ui->comboBox_dual_math_function_2->setVisible(true); + ui->label_text_6->setVisible(true); }else{ ui->lineEdit_first_2->setVisible(false); ui->lineEdit_second_2->setVisible(false); ui->label_text_3->setVisible(false); ui->label_text_4->setVisible(false); + ui->comboBox_dual_math_function_2->setVisible(false); + ui->label_text_6->setVisible(false); } current_config_3_4 = index; } @@ -639,21 +681,27 @@ void Seismic_monitor::on_comboBox_function_1_currentIndexChanged(int index) ui->comboBox_function_1->setCurrentIndex(0); return; } - if(index == 2){ - ui->pushButton_config_1_2->setEnabled(false); - }else{ - ui->pushButton_config_1_2->setEnabled(true); - } if(index == 3){ ui->lineEdit_first_1->setVisible(true); ui->lineEdit_second_1->setVisible(true); ui->label_text_1->setVisible(true); ui->label_text_2->setVisible(true); + ui->comboBox_dual_math_function->setVisible(false); + ui->label_text_5->setVisible(false); + }else if(index == 5){ + ui->lineEdit_first_1->setVisible(false); + ui->lineEdit_second_1->setVisible(false); + ui->label_text_1->setVisible(false); + ui->label_text_2->setVisible(false); + ui->comboBox_dual_math_function->setVisible(true); + ui->label_text_5->setVisible(true); }else{ ui->lineEdit_first_1->setVisible(false); ui->lineEdit_second_1->setVisible(false); ui->label_text_1->setVisible(false); ui->label_text_2->setVisible(false); + ui->comboBox_dual_math_function->setVisible(false); + ui->label_text_5->setVisible(false); } current_config_1_2 = index; } diff --git a/seismic_monitor.ui b/seismic_monitor.ui index e9880b6..18d6dbd 100644 --- a/seismic_monitor.ui +++ b/seismic_monitor.ui @@ -1153,19 +1153,6 @@ 通道1-通道2 - - - - 110 - 220 - 93 - 28 - - - - 配置 - - @@ -1231,47 +1218,12 @@ - - - - 20 - 130 - 329 - 23 - - - - - - - - 200 - 0 - - - - - 200 - 16777215 - - - - - - - - 第一通道安装角度 - - - - - 20 170 - 329 + 311 23 @@ -1301,6 +1253,106 @@ + + + + 20 + 220 + 292 + 22 + + + + + + + + 200 + 0 + + + + + 200 + 16777215 + + + + + RMS Sum + + + + + RMS Subtraction + + + + + SUM + + + + + SUBTRACTION + + + + + X & Y MIN + + + + + X & Y MAX + + + + + + + + 双通道计算函数 + + + + + + + + + 21 + 131 + 304 + 22 + + + + + + + + 200 + 0 + + + + + 200 + 16777215 + + + + + + + + 第一通道安装角度 + + + + + @@ -2488,19 +2540,6 @@ - - - - 100 - 220 - 93 - 28 - - - - 配置 - - @@ -2571,6 +2610,71 @@ + + + + 20 + 220 + 292 + 22 + + + + + + + + 200 + 0 + + + + + 200 + 16777215 + + + + + RMS Sum + + + + + RMS Subtraction + + + + + SUM + + + + + SUBTRACTION + + + + + X & Y MIN + + + + + X & Y MAX + + + + + + + + 双通道计算函数 + + + + +