add dc output
This commit is contained in:
parent
1f780ef25b
commit
648b8b0f70
@ -37,8 +37,6 @@ class VariableBase {
|
||||
AlarmAlertLow gap_alert_low;
|
||||
|
||||
FrequencybandOutput freband_output[10];
|
||||
|
||||
DCOutput dc_output[4];
|
||||
};
|
||||
|
||||
// 位移
|
||||
|
@ -41,6 +41,7 @@ void ConfigMgr::Save(QString & file_path) {
|
||||
card_type_[i] != kCardRelaySingleNOK) {
|
||||
continue;
|
||||
}
|
||||
qDebug() << "i" << i ;
|
||||
// process slot
|
||||
QJsonObject slot_item;
|
||||
if (card_type_[i] != kCardRelaySingle &&
|
||||
@ -74,15 +75,26 @@ void ConfigMgr::Save(QString & file_path) {
|
||||
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;
|
||||
QJsonObject setpoint_data;
|
||||
QJsonObject dc_output;
|
||||
QJsonArray dc_output_array;
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
for(int var = 0 ; var < CHANNEL_COUNT; ++ var ){
|
||||
if(ptr->dc_output[cid][var].output_channel > 0){
|
||||
dc_output["output_channel"] = ptr->dc_output[cid][var].output_channel;
|
||||
dc_output["minmum"] = ptr->dc_output[cid][var].minmum;
|
||||
dc_output["maxmum"] = ptr->dc_output[cid][var].maxmum;
|
||||
dc_output_array.append(dc_output);
|
||||
}
|
||||
|
||||
}
|
||||
channel_item["dc_output"] = dc_output_array;
|
||||
// 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;
|
||||
@ -570,6 +582,16 @@ void ConfigMgr::Load(QString filename) {
|
||||
vib_data->base_config_[j].keyphase_slot = channel["keyphase_slot"].toInt();
|
||||
vib_data->base_config_[j].keyphase_ch = channel["keyphase_ch"].toInt();
|
||||
}
|
||||
// dc_output
|
||||
QJsonArray dc_output_array = channel["dc_output"].toArray();
|
||||
if(!dc_output_array.isEmpty()){
|
||||
for(int var = 0 ; var < CHANNEL_COUNT; ++var){
|
||||
QJsonObject dc_output_obj = dc_output_array[var].toObject();
|
||||
vib_data->dc_output[j][var].output_channel = dc_output_obj["output_channel"].toInt();
|
||||
vib_data->dc_output[j][var].minmum = dc_output_obj["minmum"].toInt();
|
||||
vib_data->dc_output[j][var].maxmum = dc_output_obj["maxmum"].toInt();
|
||||
}
|
||||
}
|
||||
// if(vib_data->base_config_[j].channel_type == kVibPressurePulsation){
|
||||
// vib_data->alert_danger_press[j].low_upper = setpoint_data["low_upper"].toDouble();
|
||||
// vib_data->alert_danger_press[j].low_enable = setpoint_data["low_enable"].toBool();
|
||||
|
@ -8,9 +8,13 @@
|
||||
typedef unsigned char uint8_t;
|
||||
typedef unsigned short uint16_t;
|
||||
|
||||
typedef struct {
|
||||
bool used[4]; // 是否已配置
|
||||
}ChannelUsed;
|
||||
|
||||
extern QString g_strServerIp; // 服务端IP
|
||||
extern QString g_version;
|
||||
|
||||
extern ChannelUsed ch_used;
|
||||
#define SLOT_NUM 15
|
||||
#define CHANNEL_COUNT 4
|
||||
#define RELAY_COUNT 16
|
||||
@ -54,7 +58,68 @@ typedef enum {
|
||||
kVibThrust = 3, //轴向位移
|
||||
kVibPressurePulsation = 4 //动态压力脉动
|
||||
} VibChannelType;
|
||||
enum TotalCalcValueType {
|
||||
// 转速
|
||||
kSpeedRpm = 0,
|
||||
|
||||
// 轴向位移
|
||||
kThrustGap = 2,
|
||||
|
||||
// 径向位移
|
||||
kRadialPk = 4,
|
||||
kRadialPk2Pk = 5,
|
||||
kRadialRmsScaledPeak = 6,
|
||||
kRadialRmsScaledPk2Pk = 7,
|
||||
|
||||
// 速度
|
||||
kVelPeak = 11,
|
||||
kVelRmsScaledPeak = 12,
|
||||
kVelRms = 13,
|
||||
|
||||
kVelDisPeak = 17,
|
||||
kVelDisPk2Pk = 18,
|
||||
kVelDisRmsScaledPeak = 19,
|
||||
kVelDisRmsScaledPk2Pk = 20,
|
||||
|
||||
// 加速度
|
||||
kAccPeak = 21,
|
||||
kAccRmsScaledPeak = 22,
|
||||
kAccRms = 23,
|
||||
|
||||
kAccVelPeak = 26,
|
||||
kAccVelRmsScaledPeak = 27,
|
||||
kAccVelRms = 28,
|
||||
|
||||
kAccDisPeak = 31,
|
||||
kAccDisPk2Pk = 32,
|
||||
kAccDisRmsScaledPeak = 33,
|
||||
kAccDisRmsScaledPk2Pk = 34,
|
||||
|
||||
// 压力脉动
|
||||
kPressPulsationPeak = 41,
|
||||
kPressPulsationRmsScaledPeak = 42,
|
||||
kPressPulsationRms = 43,
|
||||
|
||||
// kTriggerPressurePulsationLow = 11, // [10, 40]
|
||||
// kTriggerPressurePulsationMID1 = 12, // (40, 120]
|
||||
// kTriggerPressurePulsationMID2 = 13, // (120, 190]
|
||||
// kTriggerPressurePulsationHIGH1 = 14, // (190, 290]
|
||||
// kTriggerPressurePulsationHIGH2 = 15, // (290, 500]
|
||||
// kTriggerPressurePulsationHH1 = 16, // (500, 2000]
|
||||
// kTriggerPressurePulsationHH2 = 17, // (2000, 3200]
|
||||
// kTriggerPressurePulsationHH3 = 18, // (3200, 4200]
|
||||
// kTriggerPressurePulsationHH4 = 19, // (4200, 4600]
|
||||
// kTriggerPressurePulsationOA = 20, // [5, 500]
|
||||
|
||||
// 复合运算
|
||||
kSmax = 81, // 径向位移运算
|
||||
kDifferentialHousingExpansion = 82, // 差胀,针对轴向位移,做减法
|
||||
kRelativeShaftTaper = 83, // 径向位移,根据公式进行计算
|
||||
kRelativeShaftCollar = 84, // 径向位移,根据公式进行计算
|
||||
kDualMathematicalFunction = 85, // 公式计算
|
||||
|
||||
kDCValue = 100,
|
||||
};
|
||||
typedef enum{
|
||||
kTruePeak = 0,
|
||||
kTruePeakToPeak = 1,
|
||||
@ -74,7 +139,11 @@ typedef enum{
|
||||
kUnit6 = 5, // mm
|
||||
kUnit7 = 6, // mils
|
||||
kUnit8 = 7, // inch/s**2
|
||||
kUnit9 = 8 // user defined
|
||||
kUnit9 = 9, // mbar
|
||||
kUnit10 = 10, // bar
|
||||
kUnit11 = 11, // psi
|
||||
kUnit12 = 12, // pa
|
||||
kUnit13 = 13 // user defined
|
||||
} EngineeringUnit;
|
||||
|
||||
typedef struct SlotConfig_{
|
||||
@ -209,6 +278,8 @@ typedef struct DCOutput_{
|
||||
maxmum = 0;
|
||||
}
|
||||
} DCOutput;
|
||||
|
||||
|
||||
//typedef struct {
|
||||
// Filter filter[3]; // 0: kFilterTypeLowPass, 1: kFilterTypeHighPass, 2: kFilterTypeBandPass
|
||||
//} AllFilter;
|
||||
|
@ -1,12 +1,26 @@
|
||||
#include "dc_output_channel.h"
|
||||
#include "ui_dc_output_channel.h"
|
||||
#include <QMessageBox>
|
||||
#include "data_config.h"
|
||||
|
||||
DC_Output_Channel::DC_Output_Channel(QWidget *parent) :
|
||||
|
||||
|
||||
DC_Output_Channel::DC_Output_Channel(QString unit_str_,QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::DC_Output_Channel)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
unit_str = unit_str_;
|
||||
ui->label_min_unit->setText(unit_str);
|
||||
ui->label_max_unit->setText(unit_str);
|
||||
radiobtn[0] = ui->radioButton;
|
||||
radiobtn[1] = ui->radioButton_2;
|
||||
radiobtn[2] = ui->radioButton_3;
|
||||
radiobtn[3] = ui->radioButton_4;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if(ch_used.used[i])
|
||||
radiobtn[i]->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
DC_Output_Channel::~DC_Output_Channel()
|
||||
|
@ -2,6 +2,7 @@
|
||||
#define DC_OUTPUT_CHANNEL_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QRadioButton>
|
||||
|
||||
namespace Ui {
|
||||
class DC_Output_Channel;
|
||||
@ -12,7 +13,7 @@ class DC_Output_Channel : public QWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit DC_Output_Channel(QWidget *parent = nullptr);
|
||||
explicit DC_Output_Channel(QString unit_str_,QWidget *parent = nullptr);
|
||||
~DC_Output_Channel();
|
||||
signals:
|
||||
void output_channel_data_sg(int channel,float minmun,float maxmum);
|
||||
@ -23,6 +24,9 @@ private slots:
|
||||
|
||||
private:
|
||||
Ui::DC_Output_Channel *ui;
|
||||
QString unit_str;
|
||||
QRadioButton *radiobtn[4];
|
||||
bool channel_used[4] = {false,false,false,false};
|
||||
};
|
||||
|
||||
#endif // DC_OUTPUT_CHANNEL_H
|
||||
|
197
dc_outputs.cpp
197
dc_outputs.cpp
@ -7,6 +7,8 @@
|
||||
#include "data_config.h"
|
||||
#include "vibrationdata.h"
|
||||
|
||||
ChannelUsed ch_used;
|
||||
|
||||
DC_Outputs::DC_Outputs(int slot_no_,int cardtype,QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::DC_Outputs)
|
||||
@ -15,7 +17,7 @@ DC_Outputs::DC_Outputs(int slot_no_,int cardtype,QWidget *parent) :
|
||||
ui->comboBox_ch_output->setView(new QListView());
|
||||
slot_no = slot_no_;
|
||||
car_type = static_cast<CardType>(cardtype);
|
||||
memset(channel_used,0,sizeof(channel_used));
|
||||
unit = "";
|
||||
current_index = ui->comboBox_ch_output->currentIndex();
|
||||
Init();
|
||||
}
|
||||
@ -28,40 +30,120 @@ DC_Outputs::~DC_Outputs()
|
||||
void DC_Outputs::Init(){
|
||||
std::shared_ptr<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot_no);
|
||||
if (base_ptr == nullptr) {
|
||||
qCritical() << "[Acceleration::Init] should not be here";
|
||||
qCritical() << "[DC_Outputs"
|
||||
"::Init] should not be here";
|
||||
return;
|
||||
}
|
||||
std::shared_ptr<VibrationData> ptr = std::dynamic_pointer_cast<VibrationData>(base_ptr);
|
||||
std::shared_ptr<VariableBase> variable_base = ptr->GetChannelPtr(current_index + 1);
|
||||
if (variable_base == nullptr) {
|
||||
qDebug() << "[DC_Outputs::Init] no channel ptr";
|
||||
return;
|
||||
}
|
||||
if(variable_base->dc_output[0].output_channel == 1){
|
||||
vib_dc_output_ptr = std::dynamic_pointer_cast<VibrationData>(base_ptr);
|
||||
QString unit_str = GetUnit();
|
||||
if(vib_dc_output_ptr->dc_output[current_index][0].output_channel == 1){
|
||||
ui->label_ch_1->setText("通道1");
|
||||
ui->label_ch_1_min->setText(QString::number(variable_base->dc_output[0].minmum));
|
||||
ui->label_ch_1_max->setText(QString::number(variable_base->dc_output[0].maxmum));
|
||||
ui->label_ch_1_min->setText(QString::number(vib_dc_output_ptr->dc_output[current_index][0].minmum));
|
||||
ui->label_ch_1_max->setText(QString::number(vib_dc_output_ptr->dc_output[current_index][0].maxmum));
|
||||
ch_used.used[0] = true;
|
||||
}
|
||||
if(variable_base->dc_output[0].output_channel == 2){
|
||||
if(vib_dc_output_ptr->dc_output[current_index][1].output_channel == 2){
|
||||
ui->label_ch_2->setText("通道2");
|
||||
ui->label_ch_2_min->setText(QString::number(variable_base->dc_output[1].minmum));
|
||||
ui->label_ch_2_max->setText(QString::number(variable_base->dc_output[1].maxmum));
|
||||
ui->label_ch_2_min->setText(QString::number(vib_dc_output_ptr->dc_output[current_index][1].minmum));
|
||||
ui->label_ch_2_max->setText(QString::number(vib_dc_output_ptr->dc_output[current_index][1].maxmum));
|
||||
ch_used.used[1] = true;
|
||||
}
|
||||
if(variable_base->dc_output[0].output_channel == 3){
|
||||
if(vib_dc_output_ptr->dc_output[current_index][2].output_channel == 3){
|
||||
ui->label_ch_3->setText("通道3");
|
||||
ui->label_ch_3_min->setText(QString::number(variable_base->dc_output[2].minmum));
|
||||
ui->label_ch_3_max->setText(QString::number(variable_base->dc_output[2].maxmum));
|
||||
ui->label_ch_3_min->setText(QString::number(vib_dc_output_ptr->dc_output[current_index][2].minmum));
|
||||
ui->label_ch_3_max->setText(QString::number(vib_dc_output_ptr->dc_output[current_index][2].maxmum));
|
||||
ch_used.used[2] = true;
|
||||
}
|
||||
if(variable_base->dc_output[0].output_channel == 4){
|
||||
if(vib_dc_output_ptr->dc_output[current_index][3].output_channel == 4){
|
||||
ui->label_ch_4->setText("通道4");
|
||||
ui->label_ch_4_min->setText(QString::number(variable_base->dc_output[3].minmum));
|
||||
ui->label_ch_4_max->setText(QString::number(variable_base->dc_output[3].maxmum));
|
||||
ui->label_ch_4_min->setText(QString::number(vib_dc_output_ptr->dc_output[current_index][3].minmum));
|
||||
ui->label_ch_4_max->setText(QString::number(vib_dc_output_ptr->dc_output[current_index][3].maxmum));
|
||||
ch_used.used[3] = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
QString DC_Outputs::GetUnit(){
|
||||
int unit_num = -1;
|
||||
QString unit_str = "";
|
||||
std::shared_ptr<VariableBase> variable_base = vib_dc_output_ptr->GetChannelPtr(current_index + 1);
|
||||
if (vib_dc_output_ptr->base_config_[current_index].channel_type == kVibRadial) {
|
||||
std::shared_ptr<RadialVariable> variable_ptr = std::dynamic_pointer_cast<RadialVariable>(variable_base);
|
||||
unit_num = variable_ptr->general.engineering_unit;
|
||||
}
|
||||
if (vib_dc_output_ptr->base_config_[current_index].channel_type == kVibAcc) {
|
||||
std::shared_ptr<AccVelVariable> variable_ptr = std::dynamic_pointer_cast<AccVelVariable>(variable_base);
|
||||
unit_num = variable_ptr->general.engineering_unit;
|
||||
}
|
||||
if (vib_dc_output_ptr->base_config_[current_index].channel_type == kVibVelocity) {
|
||||
std::shared_ptr<AccVelVariable> variable_ptr = std::dynamic_pointer_cast<AccVelVariable>(variable_base);
|
||||
unit_num = variable_ptr->general.engineering_unit;
|
||||
}
|
||||
if (vib_dc_output_ptr->base_config_[current_index].channel_type == kVibThrust) {
|
||||
std::shared_ptr<ThrustVariable> variable_ptr = std::dynamic_pointer_cast<ThrustVariable>(variable_base);
|
||||
unit_num = variable_ptr->general.engineering_unit;
|
||||
}
|
||||
if (vib_dc_output_ptr->base_config_[current_index].channel_type == kVibPressurePulsation) {
|
||||
std::shared_ptr<PressurePulsationVariable> variable_ptr = std::dynamic_pointer_cast<PressurePulsationVariable>(variable_base);
|
||||
unit_num = variable_ptr->general.engineering_unit;
|
||||
}
|
||||
switch (unit_num) {
|
||||
case kUnit1:{
|
||||
unit_str = "g";
|
||||
break;
|
||||
}
|
||||
case kUnit2:{
|
||||
unit_str = "m/s**2";
|
||||
break;
|
||||
}
|
||||
case kUnit3:{
|
||||
unit_str = "mm/s";
|
||||
break;
|
||||
}
|
||||
case kUnit4:{
|
||||
unit_str = "inch/s";
|
||||
break;
|
||||
}
|
||||
case kUnit5:{
|
||||
unit_str = "um";
|
||||
break;
|
||||
}
|
||||
case kUnit6:{
|
||||
unit_str = "mm";
|
||||
break;
|
||||
}
|
||||
case kUnit7:{
|
||||
unit_str = "mils";
|
||||
break;
|
||||
}
|
||||
case kUnit8:{
|
||||
unit_str = "inch/s**2";
|
||||
break;
|
||||
}
|
||||
case kUnit9:{
|
||||
unit_str = "mbar";
|
||||
break;
|
||||
}
|
||||
case kUnit10:{
|
||||
unit_str = "bar";
|
||||
break;
|
||||
}
|
||||
case kUnit11:{
|
||||
unit_str = "psi";
|
||||
break;
|
||||
}
|
||||
case kUnit12:{
|
||||
unit_str = "pa";
|
||||
break;
|
||||
}
|
||||
}
|
||||
return unit_str;
|
||||
}
|
||||
void DC_Outputs::on_comboBox_ch_output_activated(int index)
|
||||
{
|
||||
DC_Output_Channel *dc_output_channel = new DC_Output_Channel();
|
||||
current_index = index;
|
||||
QString unit_str = GetUnit();
|
||||
DC_Output_Channel *dc_output_channel = new DC_Output_Channel(unit_str);
|
||||
dc_output_channel->setWindowModality(Qt::ApplicationModal);
|
||||
connect(dc_output_channel,SIGNAL(output_channel_data_sg(int,float,float)),this,SLOT(output_channel_data(int,float,float)));
|
||||
dc_output_channel->show();
|
||||
@ -69,58 +151,54 @@ void DC_Outputs::on_comboBox_ch_output_activated(int index)
|
||||
|
||||
void DC_Outputs::output_channel_data(int channel,float minmun,float maxmum){
|
||||
qDebug() << channel << minmun << maxmum ;
|
||||
QString unit_str = GetUnit();
|
||||
if(channel == 1){
|
||||
ui->label_ch_1->setText("通道1");
|
||||
ui->label_ch_1_min->setText(QString::number(minmun));
|
||||
ui->label_ch_1_max->setText(QString::number(maxmum));
|
||||
ch_used.used[0] = true;
|
||||
}else if(channel == 2){
|
||||
ui->label_ch_2->setText("通道2");
|
||||
ui->label_ch_2_min->setText(QString::number(minmun));
|
||||
ui->label_ch_2_max->setText(QString::number(maxmum));
|
||||
ch_used.used[1] = true;
|
||||
}else if(channel == 3){
|
||||
ui->label_ch_3->setText("通道3");
|
||||
ui->label_ch_3_min->setText(QString::number(minmun));
|
||||
ui->label_ch_3_max->setText(QString::number(maxmum));
|
||||
ch_used.used[2] = true;
|
||||
}else if(channel == 4){
|
||||
ui->label_ch_4->setText("通道4");
|
||||
ui->label_ch_4_min->setText(QString::number(minmun));
|
||||
ui->label_ch_4_max->setText(QString::number(maxmum));
|
||||
ch_used.used[3] = true;
|
||||
}
|
||||
}
|
||||
|
||||
void DC_Outputs::on_pushButton_confirm_clicked()
|
||||
{
|
||||
std::shared_ptr<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot_no);
|
||||
if (base_ptr == nullptr) {
|
||||
qCritical() << "[Acceleration::Init] should not be here";
|
||||
return;
|
||||
}
|
||||
std::shared_ptr<VibrationData> ptr = std::dynamic_pointer_cast<VibrationData>(base_ptr);
|
||||
std::shared_ptr<VariableBase> variable_base = ptr->GetChannelPtr(current_index);
|
||||
if (variable_base == nullptr ) {
|
||||
return ;
|
||||
}
|
||||
|
||||
if(ui->label_ch_1->text() != "未使用"){
|
||||
variable_base->dc_output[0].output_channel = 1;
|
||||
variable_base->dc_output[0].minmum = ui->label_ch_1_min->text().toFloat();
|
||||
variable_base->dc_output[0].maxmum = ui->label_ch_1_max->text().toFloat();
|
||||
vib_dc_output_ptr->dc_output[current_index][0].output_channel = 1;
|
||||
vib_dc_output_ptr->dc_output[current_index][0].minmum = ui->label_ch_1_min->text().toFloat();
|
||||
vib_dc_output_ptr->dc_output[current_index][0].maxmum = ui->label_ch_1_max->text().toFloat();
|
||||
}
|
||||
if(ui->label_ch_2->text() != "未使用"){
|
||||
variable_base->dc_output[1].output_channel = 2;
|
||||
variable_base->dc_output[1].minmum = ui->label_ch_2_min->text().toFloat();
|
||||
variable_base->dc_output[1].maxmum = ui->label_ch_2_max->text().toFloat();
|
||||
vib_dc_output_ptr->dc_output[current_index][1].output_channel = 2;
|
||||
vib_dc_output_ptr->dc_output[current_index][1].minmum = ui->label_ch_2_min->text().toFloat();
|
||||
vib_dc_output_ptr->dc_output[current_index][1].maxmum = ui->label_ch_2_max->text().toFloat();
|
||||
}
|
||||
if(ui->label_ch_3->text() != "未使用"){
|
||||
variable_base->dc_output[2].output_channel = 3;
|
||||
variable_base->dc_output[2].minmum = ui->label_ch_3_min->text().toFloat();
|
||||
variable_base->dc_output[2].maxmum = ui->label_ch_3_max->text().toFloat();
|
||||
vib_dc_output_ptr->dc_output[current_index][2].output_channel = 3;
|
||||
vib_dc_output_ptr->dc_output[current_index][2].minmum = ui->label_ch_3_min->text().toFloat();
|
||||
vib_dc_output_ptr->dc_output[current_index][2].maxmum = ui->label_ch_3_max->text().toFloat();
|
||||
}
|
||||
if(ui->label_ch_4->text() != "未使用"){
|
||||
variable_base->dc_output[3].output_channel = 4;
|
||||
variable_base->dc_output[3].minmum = ui->label_ch_4_min->text().toFloat();
|
||||
variable_base->dc_output[3].maxmum = ui->label_ch_4_max->text().toFloat();
|
||||
vib_dc_output_ptr->dc_output[current_index][3].output_channel = 4;
|
||||
vib_dc_output_ptr->dc_output[current_index][3].minmum = ui->label_ch_4_min->text().toFloat();
|
||||
vib_dc_output_ptr->dc_output[current_index][3].maxmum = ui->label_ch_4_max->text().toFloat();
|
||||
}
|
||||
ptr->variables_.push_back(variable_base);
|
||||
|
||||
this->close();
|
||||
}
|
||||
|
||||
@ -130,3 +208,34 @@ void DC_Outputs::on_pushButton_cancel_clicked()
|
||||
this->close();
|
||||
}
|
||||
|
||||
|
||||
void DC_Outputs::on_comboBox_ch_output_currentIndexChanged(int index)
|
||||
{
|
||||
current_index = index;
|
||||
QString unit_str = GetUnit();
|
||||
if(vib_dc_output_ptr->dc_output[current_index][0].output_channel == 1){
|
||||
ui->label_ch_1->setText("通道1");
|
||||
ui->label_ch_1_min->setText(QString::number(vib_dc_output_ptr->dc_output[current_index][0].minmum));
|
||||
ui->label_ch_1_max->setText(QString::number(vib_dc_output_ptr->dc_output[current_index][0].maxmum));
|
||||
ch_used.used[0] = true;
|
||||
}
|
||||
if(vib_dc_output_ptr->dc_output[current_index][1].output_channel == 2){
|
||||
ui->label_ch_2->setText("通道2");
|
||||
ui->label_ch_2_min->setText(QString::number(vib_dc_output_ptr->dc_output[current_index][1].minmum));
|
||||
ui->label_ch_2_max->setText(QString::number(vib_dc_output_ptr->dc_output[current_index][1].maxmum));
|
||||
ch_used.used[1] = true;
|
||||
}
|
||||
if(vib_dc_output_ptr->dc_output[current_index][2].output_channel == 3){
|
||||
ui->label_ch_3->setText("通道3");
|
||||
ui->label_ch_3_min->setText(QString::number(vib_dc_output_ptr->dc_output[current_index][2].minmum));
|
||||
ui->label_ch_3_max->setText(QString::number(vib_dc_output_ptr->dc_output[current_index][2].maxmum));
|
||||
ch_used.used[2] = true;
|
||||
}
|
||||
if(vib_dc_output_ptr->dc_output[current_index][3].output_channel == 4){
|
||||
ui->label_ch_4->setText("通道4");
|
||||
ui->label_ch_4_min->setText(QString::number(vib_dc_output_ptr->dc_output[current_index][3].minmum));
|
||||
ui->label_ch_4_max->setText(QString::number(vib_dc_output_ptr->dc_output[current_index][3].maxmum));
|
||||
ch_used.used[3] = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
12
dc_outputs.h
12
dc_outputs.h
@ -3,6 +3,7 @@
|
||||
|
||||
#include <QWidget>
|
||||
#include "data_config.h"
|
||||
#include "vibrationdata.h"
|
||||
|
||||
namespace Ui {
|
||||
class DC_Outputs;
|
||||
@ -20,13 +21,22 @@ public:
|
||||
private slots:
|
||||
void on_comboBox_ch_output_activated(int index);
|
||||
|
||||
void on_pushButton_confirm_clicked();
|
||||
|
||||
void on_pushButton_cancel_clicked();
|
||||
|
||||
void output_channel_data(int channel,float minmun,float maxmum);
|
||||
|
||||
void on_comboBox_ch_output_currentIndexChanged(int index);
|
||||
|
||||
private:
|
||||
Ui::DC_Outputs *ui;
|
||||
std::shared_ptr<VibrationData> vib_dc_output_ptr = nullptr;
|
||||
void Init();
|
||||
bool channel_used[4];
|
||||
QString GetUnit();
|
||||
|
||||
int current_index;
|
||||
QString unit;
|
||||
};
|
||||
|
||||
#endif // DC_OUTPUTS_H
|
||||
|
136
dc_outputs.ui
136
dc_outputs.ui
@ -213,12 +213,12 @@
|
||||
<rect>
|
||||
<x>300</x>
|
||||
<y>160</y>
|
||||
<width>101</width>
|
||||
<width>41</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>----- -----</string>
|
||||
<string>----- </string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_ch_2_min">
|
||||
@ -226,12 +226,12 @@
|
||||
<rect>
|
||||
<x>300</x>
|
||||
<y>200</y>
|
||||
<width>101</width>
|
||||
<width>31</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>----- -----</string>
|
||||
<string>-----</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_ch_1_max">
|
||||
@ -239,12 +239,12 @@
|
||||
<rect>
|
||||
<x>420</x>
|
||||
<y>160</y>
|
||||
<width>121</width>
|
||||
<width>31</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>----- -----</string>
|
||||
<string>-----</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_ch_2_max">
|
||||
@ -252,12 +252,12 @@
|
||||
<rect>
|
||||
<x>420</x>
|
||||
<y>200</y>
|
||||
<width>101</width>
|
||||
<width>31</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>----- -----</string>
|
||||
<string>-----</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_ch_3_min">
|
||||
@ -265,12 +265,12 @@
|
||||
<rect>
|
||||
<x>300</x>
|
||||
<y>240</y>
|
||||
<width>71</width>
|
||||
<width>31</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>----- -----</string>
|
||||
<string>-----</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_ch_4_min">
|
||||
@ -278,12 +278,12 @@
|
||||
<rect>
|
||||
<x>300</x>
|
||||
<y>280</y>
|
||||
<width>71</width>
|
||||
<width>31</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>----- -----</string>
|
||||
<string>-----</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_ch_3_max">
|
||||
@ -291,12 +291,12 @@
|
||||
<rect>
|
||||
<x>420</x>
|
||||
<y>240</y>
|
||||
<width>71</width>
|
||||
<width>31</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>----- -----</string>
|
||||
<string>-----</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_ch_4_max">
|
||||
@ -304,12 +304,12 @@
|
||||
<rect>
|
||||
<x>420</x>
|
||||
<y>280</y>
|
||||
<width>71</width>
|
||||
<width>31</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>----- -----</string>
|
||||
<string>-----</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="pushButton_confirm">
|
||||
@ -338,6 +338,110 @@
|
||||
<string>取消</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_ch_1_min_unit">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>340</x>
|
||||
<y>160</y>
|
||||
<width>41</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>----- </string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_ch_1_max_unit">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>460</x>
|
||||
<y>160</y>
|
||||
<width>41</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>----- </string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_ch_2_min_unit">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>340</x>
|
||||
<y>200</y>
|
||||
<width>41</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>----- </string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_ch_2_max_unit">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>460</x>
|
||||
<y>200</y>
|
||||
<width>41</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>----- </string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_ch_3_min_unit">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>340</x>
|
||||
<y>240</y>
|
||||
<width>41</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>----- </string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_ch_3_max_unit">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>460</x>
|
||||
<y>240</y>
|
||||
<width>41</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>----- </string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_ch_4_min_unit">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>340</x>
|
||||
<y>280</y>
|
||||
<width>41</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>----- </string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_ch_4_max_unit">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>460</x>
|
||||
<y>280</y>
|
||||
<width>31</width>
|
||||
<height>16</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>-----</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
@ -14,6 +14,7 @@ class VibrationData : public CardBase {
|
||||
std::vector<std::shared_ptr<VariableBase>> variables_;
|
||||
VibAlertDanger alert_danger[CHANNEL_COUNT];
|
||||
VibAlertDangerPress alert_danger_press[CHANNEL_COUNT];
|
||||
DCOutput dc_output[CHANNEL_COUNT][CHANNEL_COUNT];
|
||||
};
|
||||
|
||||
#endif // VIBRATIONDATA_H
|
||||
|
Loading…
x
Reference in New Issue
Block a user