| 
									
										
										
										
											2025-07-28 20:55:48 +08:00
										 |  |  | #include "dc_outputs.h"
 | 
					
						
							|  |  |  | #include "ui_dc_outputs.h"
 | 
					
						
							| 
									
										
										
										
											2025-08-04 12:25:12 +08:00
										 |  |  | #include <QListView>
 | 
					
						
							|  |  |  | #include "dc_output_channel.h"
 | 
					
						
							|  |  |  | #include <QDebug>
 | 
					
						
							|  |  |  | #include "config_mgr.h"
 | 
					
						
							|  |  |  | #include "data_config.h"
 | 
					
						
							|  |  |  | #include "vibrationdata.h"
 | 
					
						
							| 
									
										
										
										
											2025-07-28 20:55:48 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-06 22:11:14 +08:00
										 |  |  | ChannelUsed ch_used[SLOT_NUM][22]; | 
					
						
							| 
									
										
										
										
											2025-08-04 20:13:21 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-04 12:25:12 +08:00
										 |  |  | DC_Outputs::DC_Outputs(int slot_no_,int cardtype,QWidget *parent) : | 
					
						
							| 
									
										
										
										
											2025-07-28 20:55:48 +08:00
										 |  |  |     QWidget(parent), | 
					
						
							|  |  |  |     ui(new Ui::DC_Outputs) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     ui->setupUi(this); | 
					
						
							| 
									
										
										
										
											2025-08-04 12:25:12 +08:00
										 |  |  |     ui->comboBox_ch_output->setView(new QListView()); | 
					
						
							|  |  |  |     slot_no = slot_no_; | 
					
						
							|  |  |  |     car_type = static_cast<CardType>(cardtype); | 
					
						
							| 
									
										
										
										
											2025-08-04 20:13:21 +08:00
										 |  |  |     unit = ""; | 
					
						
							| 
									
										
										
										
											2025-08-04 12:25:12 +08:00
										 |  |  |     current_index = ui->comboBox_ch_output->currentIndex(); | 
					
						
							| 
									
										
										
										
											2025-08-05 20:49:25 +08:00
										 |  |  |     label_ch1[0] = ui->label_ch_1; | 
					
						
							|  |  |  |     label_ch1[1] = ui->label_ch_1_min; | 
					
						
							|  |  |  |     label_ch1[2] = ui->label_ch_1_min_unit; | 
					
						
							|  |  |  |     label_ch1[3] = ui->label_ch_1_max; | 
					
						
							|  |  |  |     label_ch1[4] = ui->label_ch_1_max_unit; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     label_ch2[0] = ui->label_ch_2; | 
					
						
							|  |  |  |     label_ch2[1] = ui->label_ch_2_min; | 
					
						
							|  |  |  |     label_ch2[2] = ui->label_ch_2_min_unit; | 
					
						
							|  |  |  |     label_ch2[3] = ui->label_ch_2_max; | 
					
						
							|  |  |  |     label_ch2[4] = ui->label_ch_2_max_unit; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     label_ch3[0] = ui->label_ch_3; | 
					
						
							|  |  |  |     label_ch3[1] = ui->label_ch_3_min; | 
					
						
							|  |  |  |     label_ch3[2] = ui->label_ch_3_min_unit; | 
					
						
							|  |  |  |     label_ch3[3] = ui->label_ch_3_max; | 
					
						
							|  |  |  |     label_ch3[4] = ui->label_ch_3_max_unit; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     label_ch4[0] = ui->label_ch_4; | 
					
						
							|  |  |  |     label_ch4[1] = ui->label_ch_4_min; | 
					
						
							|  |  |  |     label_ch4[2] = ui->label_ch_4_min_unit; | 
					
						
							|  |  |  |     label_ch4[3] = ui->label_ch_4_max; | 
					
						
							|  |  |  |     label_ch4[4] = ui->label_ch_4_max_unit; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-04 12:25:12 +08:00
										 |  |  |     Init(); | 
					
						
							| 
									
										
										
										
											2025-07-28 20:55:48 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | DC_Outputs::~DC_Outputs() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     delete ui; | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2025-08-04 12:25:12 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | void DC_Outputs::Init(){ | 
					
						
							|  |  |  |     std::shared_ptr<CardBase> base_ptr = ConfigMgr::Instance()->GetSlotPtr(slot_no); | 
					
						
							|  |  |  |     if (base_ptr == nullptr) { | 
					
						
							| 
									
										
										
										
											2025-08-05 20:49:25 +08:00
										 |  |  |         qCritical() << "[DC_Outputs::Init] should not be here"; | 
					
						
							| 
									
										
										
										
											2025-08-04 12:25:12 +08:00
										 |  |  |         return; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2025-08-04 20:13:21 +08:00
										 |  |  |     vib_dc_output_ptr = std::dynamic_pointer_cast<VibrationData>(base_ptr); | 
					
						
							| 
									
										
										
										
											2025-08-05 20:49:25 +08:00
										 |  |  |     QString unit_str = ""; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         if(vib_dc_output_ptr->dc_output[0].output_channel != -1){ | 
					
						
							|  |  |  |             unit_str  =  GetUnit(vib_dc_output_ptr->dc_output[0].output_channel); | 
					
						
							|  |  |  |             ui->label_ch_1->setText(ui->comboBox_ch_output->itemText(vib_dc_output_ptr->dc_output[0].output_channel)); | 
					
						
							|  |  |  |             ui->label_ch_1_min->setText(QString::number(vib_dc_output_ptr->dc_output[0].minmum)); | 
					
						
							|  |  |  |             ui->label_ch_1_max->setText(QString::number(vib_dc_output_ptr->dc_output[0].maxmum)); | 
					
						
							|  |  |  |             ui->label_ch_1_min_unit->setText(unit_str); | 
					
						
							|  |  |  |             ui->label_ch_1_max_unit->setText(unit_str); | 
					
						
							| 
									
										
										
										
											2025-08-06 22:11:14 +08:00
										 |  |  |             ch_used[slot_no][vib_dc_output_ptr->dc_output[0].output_channel].used[0] = true; | 
					
						
							| 
									
										
										
										
											2025-08-05 20:49:25 +08:00
										 |  |  |         } | 
					
						
							|  |  |  |         if(vib_dc_output_ptr->dc_output[1].output_channel != -1){ | 
					
						
							|  |  |  |             unit_str  =  GetUnit(vib_dc_output_ptr->dc_output[1].output_channel); | 
					
						
							|  |  |  |             ui->label_ch_2->setText(ui->comboBox_ch_output->itemText(vib_dc_output_ptr->dc_output[1].output_channel)); | 
					
						
							|  |  |  |             ui->label_ch_2_min->setText(QString::number(vib_dc_output_ptr->dc_output[1].minmum)); | 
					
						
							|  |  |  |             ui->label_ch_2_max->setText(QString::number(vib_dc_output_ptr->dc_output[1].maxmum)); | 
					
						
							|  |  |  |             ui->label_ch_2_min_unit->setText(unit_str); | 
					
						
							|  |  |  |             ui->label_ch_2_max_unit->setText(unit_str); | 
					
						
							| 
									
										
										
										
											2025-08-06 22:11:14 +08:00
										 |  |  |             ch_used[slot_no][vib_dc_output_ptr->dc_output[1].output_channel].used[1] = true; | 
					
						
							| 
									
										
										
										
											2025-08-05 20:49:25 +08:00
										 |  |  |         } | 
					
						
							|  |  |  |         if(vib_dc_output_ptr->dc_output[2].output_channel != -1){ | 
					
						
							|  |  |  |             unit_str  =  GetUnit(vib_dc_output_ptr->dc_output[2].output_channel); | 
					
						
							|  |  |  |             ui->label_ch_3->setText(ui->comboBox_ch_output->itemText(vib_dc_output_ptr->dc_output[2].output_channel)); | 
					
						
							|  |  |  |             ui->label_ch_3_min->setText(QString::number(vib_dc_output_ptr->dc_output[2].minmum)); | 
					
						
							|  |  |  |             ui->label_ch_3_max->setText(QString::number(vib_dc_output_ptr->dc_output[2].maxmum)); | 
					
						
							|  |  |  |             ui->label_ch_3_min_unit->setText(unit_str); | 
					
						
							|  |  |  |             ui->label_ch_3_max_unit->setText(unit_str); | 
					
						
							| 
									
										
										
										
											2025-08-06 22:11:14 +08:00
										 |  |  |             ch_used[slot_no][vib_dc_output_ptr->dc_output[2].output_channel].used[2] = true; | 
					
						
							| 
									
										
										
										
											2025-08-05 20:49:25 +08:00
										 |  |  |         } | 
					
						
							|  |  |  |         if(vib_dc_output_ptr->dc_output[3].output_channel != -1){ | 
					
						
							|  |  |  |             unit_str  =  GetUnit(vib_dc_output_ptr->dc_output[3].output_channel); | 
					
						
							|  |  |  |             ui->label_ch_4->setText(ui->comboBox_ch_output->itemText(vib_dc_output_ptr->dc_output[3].output_channel)); | 
					
						
							|  |  |  |             ui->label_ch_4_min->setText(QString::number(vib_dc_output_ptr->dc_output[3].minmum)); | 
					
						
							|  |  |  |             ui->label_ch_4_max->setText(QString::number(vib_dc_output_ptr->dc_output[3].maxmum)); | 
					
						
							|  |  |  |             ui->label_ch_4_min_unit->setText(unit_str); | 
					
						
							|  |  |  |             ui->label_ch_4_max_unit->setText(unit_str); | 
					
						
							| 
									
										
										
										
											2025-08-06 22:11:14 +08:00
										 |  |  |             ch_used[slot_no][vib_dc_output_ptr->dc_output[3].output_channel].used[3] = true; | 
					
						
							| 
									
										
										
										
											2025-08-05 20:49:25 +08:00
										 |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-04 20:13:21 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-04 12:25:12 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-05 20:49:25 +08:00
										 |  |  | QString DC_Outputs::GetUnit(int com_index){ | 
					
						
							|  |  |  |     int unit_num = -1,channel_num = 0; | 
					
						
							| 
									
										
										
										
											2025-08-04 20:13:21 +08:00
										 |  |  |     QString unit_str = ""; | 
					
						
							| 
									
										
										
										
											2025-08-05 20:49:25 +08:00
										 |  |  |     channel_num = com_index; | 
					
						
							|  |  |  |     if(com_index > 5 && com_index < 9){ | 
					
						
							|  |  |  |         channel_num = 0; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     if(com_index > 9 && com_index < 13){ | 
					
						
							|  |  |  |         channel_num = 1; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     if(com_index > 13 && com_index < 17){ | 
					
						
							|  |  |  |         channel_num = 2; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     if(com_index > 17 && com_index < 21){ | 
					
						
							|  |  |  |         channel_num = 3; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     if(com_index == 4) { | 
					
						
							|  |  |  |         channel_num = 0; | 
					
						
							|  |  |  |     }else if(com_index == 5){ | 
					
						
							|  |  |  |         channel_num = 2; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     std::shared_ptr<VariableBase> variable_base = vib_dc_output_ptr->GetChannelPtr(channel_num + 1); | 
					
						
							|  |  |  |     if (vib_dc_output_ptr->base_config_[channel_num].channel_type == kVibRadial) { | 
					
						
							| 
									
										
										
										
											2025-08-04 20:13:21 +08:00
										 |  |  |         std::shared_ptr<RadialVariable> variable_ptr = std::dynamic_pointer_cast<RadialVariable>(variable_base); | 
					
						
							|  |  |  |         unit_num = variable_ptr->general.engineering_unit; | 
					
						
							| 
									
										
										
										
											2025-08-05 20:49:25 +08:00
										 |  |  |         qDebug() << "unit_num1" << unit_num ; | 
					
						
							| 
									
										
										
										
											2025-08-04 20:13:21 +08:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2025-08-05 20:49:25 +08:00
										 |  |  |     if (vib_dc_output_ptr->base_config_[channel_num].channel_type == kVibAcc) { | 
					
						
							| 
									
										
										
										
											2025-08-04 20:13:21 +08:00
										 |  |  |         std::shared_ptr<AccVelVariable> variable_ptr = std::dynamic_pointer_cast<AccVelVariable>(variable_base); | 
					
						
							|  |  |  |         unit_num = variable_ptr->general.engineering_unit; | 
					
						
							| 
									
										
										
										
											2025-08-05 20:49:25 +08:00
										 |  |  |         qDebug() << "unit_num2" << unit_num ; | 
					
						
							| 
									
										
										
										
											2025-08-04 20:13:21 +08:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2025-08-05 20:49:25 +08:00
										 |  |  |     if (vib_dc_output_ptr->base_config_[channel_num].channel_type == kVibVelocity) { | 
					
						
							| 
									
										
										
										
											2025-08-04 20:13:21 +08:00
										 |  |  |         std::shared_ptr<AccVelVariable> variable_ptr = std::dynamic_pointer_cast<AccVelVariable>(variable_base); | 
					
						
							|  |  |  |         unit_num = variable_ptr->general.engineering_unit; | 
					
						
							| 
									
										
										
										
											2025-08-05 20:49:25 +08:00
										 |  |  |         qDebug() << "unit_num3" << unit_num ; | 
					
						
							| 
									
										
										
										
											2025-08-04 20:13:21 +08:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2025-08-05 20:49:25 +08:00
										 |  |  |     if (vib_dc_output_ptr->base_config_[channel_num].channel_type == kVibThrust) { | 
					
						
							| 
									
										
										
										
											2025-08-04 20:13:21 +08:00
										 |  |  |         std::shared_ptr<ThrustVariable> variable_ptr = std::dynamic_pointer_cast<ThrustVariable>(variable_base); | 
					
						
							|  |  |  |         unit_num = variable_ptr->general.engineering_unit; | 
					
						
							| 
									
										
										
										
											2025-08-05 20:49:25 +08:00
										 |  |  |         qDebug() << "unit_num4" << unit_num ; | 
					
						
							| 
									
										
										
										
											2025-08-04 20:13:21 +08:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2025-08-05 20:49:25 +08:00
										 |  |  |     if (vib_dc_output_ptr->base_config_[channel_num].channel_type == kVibPressurePulsation) { | 
					
						
							| 
									
										
										
										
											2025-08-04 20:13:21 +08:00
										 |  |  |         std::shared_ptr<PressurePulsationVariable> variable_ptr = std::dynamic_pointer_cast<PressurePulsationVariable>(variable_base); | 
					
						
							|  |  |  |         unit_num = variable_ptr->general.engineering_unit; | 
					
						
							| 
									
										
										
										
											2025-08-05 20:49:25 +08:00
										 |  |  |         qDebug() << "unit_num5" << unit_num ; | 
					
						
							| 
									
										
										
										
											2025-08-04 20:13:21 +08:00
										 |  |  |     } | 
					
						
							|  |  |  |     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; | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2025-08-04 12:25:12 +08:00
										 |  |  | void DC_Outputs::on_comboBox_ch_output_activated(int index) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2025-08-04 20:13:21 +08:00
										 |  |  |     current_index = index; | 
					
						
							| 
									
										
										
										
											2025-08-05 20:49:25 +08:00
										 |  |  |     QString unit_str = GetUnit(current_index); | 
					
						
							| 
									
										
										
										
											2025-08-06 22:11:14 +08:00
										 |  |  |     DC_Output_Channel *dc_output_channel = new DC_Output_Channel(slot_no,unit_str,current_index); | 
					
						
							| 
									
										
										
										
											2025-08-04 12:25:12 +08:00
										 |  |  |     dc_output_channel->setWindowModality(Qt::ApplicationModal); | 
					
						
							| 
									
										
										
										
											2025-08-05 20:49:25 +08:00
										 |  |  |     connect(dc_output_channel,SIGNAL(output_channel_data_sg(int,float,float,int)),this,SLOT(output_channel_data(int,float,float,int))); | 
					
						
							| 
									
										
										
										
											2025-08-04 12:25:12 +08:00
										 |  |  |     dc_output_channel->show(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-05 20:49:25 +08:00
										 |  |  | void DC_Outputs::output_channel_data(int channel,float minmun,float maxmum,int not_used){ | 
					
						
							| 
									
										
										
										
											2025-08-04 12:25:12 +08:00
										 |  |  |     qDebug() << channel << minmun << maxmum ; | 
					
						
							| 
									
										
										
										
											2025-08-05 20:49:25 +08:00
										 |  |  |     QString unit_str = GetUnit(current_index); | 
					
						
							| 
									
										
										
										
											2025-08-06 22:11:14 +08:00
										 |  |  |     for (int i = 0; i < CHANNEL_COUNT; i++) { | 
					
						
							|  |  |  |         if(ch_used[slot_no][current_index].used[i] && i != (channel - 1)){ | 
					
						
							|  |  |  |             if(i == 0){ | 
					
						
							|  |  |  |                 label_ch1[0]->setText("未使用"); | 
					
						
							|  |  |  |                 label_ch1[1]->setText("-----"); | 
					
						
							|  |  |  |                 label_ch1[2]->setText("-----"); | 
					
						
							|  |  |  |                 label_ch1[3]->setText("-----"); | 
					
						
							|  |  |  |                 label_ch1[4]->setText("-----"); | 
					
						
							|  |  |  |                 ch_used[slot_no][ui->comboBox_ch_output->currentIndex()].used[0] = false; | 
					
						
							|  |  |  |                 vib_dc_output_ptr->dc_output[0].output_channel = -1; | 
					
						
							|  |  |  |             }else if(i == 1){ | 
					
						
							|  |  |  |                 label_ch2[0]->setText("未使用"); | 
					
						
							|  |  |  |                 label_ch2[1]->setText("-----"); | 
					
						
							|  |  |  |                 label_ch2[2]->setText("-----"); | 
					
						
							|  |  |  |                 label_ch2[3]->setText("-----"); | 
					
						
							|  |  |  |                 label_ch2[4]->setText("-----"); | 
					
						
							|  |  |  |                 ch_used[slot_no][current_index].used[1] = false; | 
					
						
							|  |  |  |                 vib_dc_output_ptr->dc_output[1].output_channel = -1; | 
					
						
							|  |  |  |             }else if(i == 2){ | 
					
						
							|  |  |  |                 label_ch3[0]->setText("未使用"); | 
					
						
							|  |  |  |                 label_ch3[1]->setText("-----"); | 
					
						
							|  |  |  |                 label_ch3[2]->setText("-----"); | 
					
						
							|  |  |  |                 label_ch3[3]->setText("-----"); | 
					
						
							|  |  |  |                 label_ch3[4]->setText("-----"); | 
					
						
							|  |  |  |                 ch_used[slot_no][current_index].used[2] = false; | 
					
						
							|  |  |  |                 vib_dc_output_ptr->dc_output[2].output_channel = -1; | 
					
						
							|  |  |  |             }else if(i == 3){ | 
					
						
							|  |  |  |                 label_ch4[0]->setText("未使用"); | 
					
						
							|  |  |  |                 label_ch4[1]->setText("-----"); | 
					
						
							|  |  |  |                 label_ch4[2]->setText("-----"); | 
					
						
							|  |  |  |                 label_ch4[3]->setText("-----"); | 
					
						
							|  |  |  |                 label_ch4[4]->setText("-----"); | 
					
						
							|  |  |  |                 ch_used[slot_no][current_index].used[3] = false; | 
					
						
							|  |  |  |                 vib_dc_output_ptr->dc_output[3].output_channel = -1; | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2025-08-04 12:25:12 +08:00
										 |  |  |     if(channel == 1){ | 
					
						
							| 
									
										
										
										
											2025-08-05 20:49:25 +08:00
										 |  |  |         ui->label_ch_1->setText(ui->comboBox_ch_output->currentText()); | 
					
						
							| 
									
										
										
										
											2025-08-04 16:29:14 +08:00
										 |  |  |         ui->label_ch_1_min->setText(QString::number(minmun)); | 
					
						
							|  |  |  |         ui->label_ch_1_max->setText(QString::number(maxmum)); | 
					
						
							| 
									
										
										
										
											2025-08-05 20:49:25 +08:00
										 |  |  |         ui->label_ch_1_min_unit->setText(unit_str); | 
					
						
							|  |  |  |         ui->label_ch_1_max_unit->setText(unit_str); | 
					
						
							| 
									
										
										
										
											2025-08-06 22:11:14 +08:00
										 |  |  |         ch_used[slot_no][ui->comboBox_ch_output->currentIndex()].used[0] = true; | 
					
						
							| 
									
										
										
										
											2025-08-05 20:49:25 +08:00
										 |  |  |         vib_dc_output_ptr->dc_output[0].output_channel = current_index; | 
					
						
							|  |  |  |         vib_dc_output_ptr->dc_output[0].minmum = ui->label_ch_1_min->text().toFloat(); | 
					
						
							|  |  |  |         vib_dc_output_ptr->dc_output[0].maxmum = ui->label_ch_1_max->text().toFloat(); | 
					
						
							| 
									
										
										
										
											2025-08-04 12:25:12 +08:00
										 |  |  |     }else if(channel == 2){ | 
					
						
							| 
									
										
										
										
											2025-08-05 20:49:25 +08:00
										 |  |  |         ui->label_ch_2->setText(ui->comboBox_ch_output->currentText()); | 
					
						
							| 
									
										
										
										
											2025-08-04 16:29:14 +08:00
										 |  |  |         ui->label_ch_2_min->setText(QString::number(minmun)); | 
					
						
							|  |  |  |         ui->label_ch_2_max->setText(QString::number(maxmum)); | 
					
						
							| 
									
										
										
										
											2025-08-05 20:49:25 +08:00
										 |  |  |         ui->label_ch_2_min_unit->setText(unit_str); | 
					
						
							|  |  |  |         ui->label_ch_2_max_unit->setText(unit_str); | 
					
						
							| 
									
										
										
										
											2025-08-06 22:11:14 +08:00
										 |  |  |         ch_used[slot_no][ui->comboBox_ch_output->currentIndex()].used[1] = true; | 
					
						
							| 
									
										
										
										
											2025-08-05 20:49:25 +08:00
										 |  |  |         vib_dc_output_ptr->dc_output[1].output_channel = current_index; | 
					
						
							|  |  |  |         vib_dc_output_ptr->dc_output[1].minmum = ui->label_ch_2_min->text().toFloat(); | 
					
						
							|  |  |  |         vib_dc_output_ptr->dc_output[1].maxmum = ui->label_ch_2_max->text().toFloat(); | 
					
						
							| 
									
										
										
										
											2025-08-04 12:25:12 +08:00
										 |  |  |     }else if(channel == 3){ | 
					
						
							| 
									
										
										
										
											2025-08-05 20:49:25 +08:00
										 |  |  |         ui->label_ch_3->setText(ui->comboBox_ch_output->currentText()); | 
					
						
							| 
									
										
										
										
											2025-08-04 16:29:14 +08:00
										 |  |  |         ui->label_ch_3_min->setText(QString::number(minmun)); | 
					
						
							|  |  |  |         ui->label_ch_3_max->setText(QString::number(maxmum)); | 
					
						
							| 
									
										
										
										
											2025-08-05 20:49:25 +08:00
										 |  |  |         ui->label_ch_3_min_unit->setText(unit_str); | 
					
						
							|  |  |  |         ui->label_ch_3_max_unit->setText(unit_str); | 
					
						
							| 
									
										
										
										
											2025-08-06 22:11:14 +08:00
										 |  |  |         ch_used[slot_no][ui->comboBox_ch_output->currentIndex()].used[2] = true; | 
					
						
							| 
									
										
										
										
											2025-08-05 20:49:25 +08:00
										 |  |  |         vib_dc_output_ptr->dc_output[2].output_channel = current_index; | 
					
						
							|  |  |  |         vib_dc_output_ptr->dc_output[2].minmum = ui->label_ch_3_min->text().toFloat(); | 
					
						
							|  |  |  |         vib_dc_output_ptr->dc_output[2].maxmum = ui->label_ch_3_max->text().toFloat(); | 
					
						
							| 
									
										
										
										
											2025-08-04 12:25:12 +08:00
										 |  |  |     }else if(channel == 4){ | 
					
						
							| 
									
										
										
										
											2025-08-05 20:49:25 +08:00
										 |  |  |         ui->label_ch_4->setText(ui->comboBox_ch_output->currentText()); | 
					
						
							| 
									
										
										
										
											2025-08-04 16:29:14 +08:00
										 |  |  |         ui->label_ch_4_min->setText(QString::number(minmun)); | 
					
						
							|  |  |  |         ui->label_ch_4_max->setText(QString::number(maxmum)); | 
					
						
							| 
									
										
										
										
											2025-08-05 20:49:25 +08:00
										 |  |  |         ui->label_ch_4_min_unit->setText(unit_str); | 
					
						
							|  |  |  |         ui->label_ch_4_max_unit->setText(unit_str); | 
					
						
							| 
									
										
										
										
											2025-08-06 22:11:14 +08:00
										 |  |  |         ch_used[slot_no][ui->comboBox_ch_output->currentIndex()].used[3] = true; | 
					
						
							| 
									
										
										
										
											2025-08-05 20:49:25 +08:00
										 |  |  |         vib_dc_output_ptr->dc_output[3].output_channel = current_index; | 
					
						
							|  |  |  |         vib_dc_output_ptr->dc_output[3].minmum = ui->label_ch_4_min->text().toFloat(); | 
					
						
							|  |  |  |         vib_dc_output_ptr->dc_output[3].maxmum = ui->label_ch_4_max->text().toFloat(); | 
					
						
							|  |  |  |     }else if(channel == 5){ | 
					
						
							|  |  |  |         if(not_used == 0){ | 
					
						
							|  |  |  |             label_ch1[0]->setText("未使用"); | 
					
						
							|  |  |  |             label_ch1[1]->setText("-----"); | 
					
						
							|  |  |  |             label_ch1[2]->setText("-----"); | 
					
						
							|  |  |  |             label_ch1[3]->setText("-----"); | 
					
						
							|  |  |  |             label_ch1[4]->setText("-----"); | 
					
						
							| 
									
										
										
										
											2025-08-06 22:11:14 +08:00
										 |  |  |             ch_used[slot_no][ui->comboBox_ch_output->currentIndex()].used[0] = false; | 
					
						
							| 
									
										
										
										
											2025-08-05 20:49:25 +08:00
										 |  |  |             vib_dc_output_ptr->dc_output[0].output_channel = -1; | 
					
						
							|  |  |  |         }else if(not_used == 1){ | 
					
						
							| 
									
										
										
										
											2025-08-06 22:11:14 +08:00
										 |  |  |             label_ch2[0]->setText("未使用"); | 
					
						
							|  |  |  |             label_ch2[1]->setText("-----"); | 
					
						
							|  |  |  |             label_ch2[2]->setText("-----"); | 
					
						
							|  |  |  |             label_ch2[3]->setText("-----"); | 
					
						
							|  |  |  |             label_ch2[4]->setText("-----"); | 
					
						
							|  |  |  |             ch_used[slot_no][ui->comboBox_ch_output->currentIndex()].used[1] = false; | 
					
						
							| 
									
										
										
										
											2025-08-05 20:49:25 +08:00
										 |  |  |             vib_dc_output_ptr->dc_output[1].output_channel = -1; | 
					
						
							|  |  |  |         }else if(not_used == 2){ | 
					
						
							| 
									
										
										
										
											2025-08-06 22:11:14 +08:00
										 |  |  |             label_ch3[0]->setText("未使用"); | 
					
						
							|  |  |  |             label_ch3[1]->setText("-----"); | 
					
						
							|  |  |  |             label_ch3[2]->setText("-----"); | 
					
						
							|  |  |  |             label_ch3[3]->setText("-----"); | 
					
						
							|  |  |  |             label_ch3[4]->setText("-----"); | 
					
						
							|  |  |  |             ch_used[slot_no][ui->comboBox_ch_output->currentIndex()].used[2] = false; | 
					
						
							| 
									
										
										
										
											2025-08-05 20:49:25 +08:00
										 |  |  |             vib_dc_output_ptr->dc_output[2].output_channel = -1; | 
					
						
							|  |  |  |         }else if(not_used == 3){ | 
					
						
							| 
									
										
										
										
											2025-08-06 22:11:14 +08:00
										 |  |  |             label_ch4[0]->setText("未使用"); | 
					
						
							|  |  |  |             label_ch4[1]->setText("-----"); | 
					
						
							|  |  |  |             label_ch4[2]->setText("-----"); | 
					
						
							|  |  |  |             label_ch4[3]->setText("-----"); | 
					
						
							|  |  |  |             label_ch4[4]->setText("-----"); | 
					
						
							|  |  |  |             ch_used[slot_no][ui->comboBox_ch_output->currentIndex()].used[3] = false; | 
					
						
							| 
									
										
										
										
											2025-08-05 20:49:25 +08:00
										 |  |  |             vib_dc_output_ptr->dc_output[3].output_channel = -1; | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2025-08-04 16:29:14 +08:00
										 |  |  |     } | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2025-08-04 12:25:12 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-04 16:29:14 +08:00
										 |  |  | void DC_Outputs::on_pushButton_confirm_clicked() | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2025-08-04 20:13:21 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-05 20:49:25 +08:00
										 |  |  | //    if(ui->label_ch_1->text() != "未使用" && current_index){
 | 
					
						
							|  |  |  | //        vib_dc_output_ptr->dc_output[0].output_channel = current_index;
 | 
					
						
							|  |  |  | //        vib_dc_output_ptr->dc_output[0].dc_output_channel = 1;
 | 
					
						
							|  |  |  | //        vib_dc_output_ptr->dc_output[0].minmum = ui->label_ch_1_min->text().toFloat();
 | 
					
						
							|  |  |  | //        vib_dc_output_ptr->dc_output[0].maxmum = ui->label_ch_1_max->text().toFloat();
 | 
					
						
							|  |  |  | //    }
 | 
					
						
							|  |  |  | //    if(ui->label_ch_2->text() != "未使用"){
 | 
					
						
							|  |  |  | //        vib_dc_output_ptr->dc_output[1].output_channel = current_index;
 | 
					
						
							|  |  |  | //        vib_dc_output_ptr->dc_output[1].dc_output_channel = 2;
 | 
					
						
							|  |  |  | //        vib_dc_output_ptr->dc_output[1].minmum = ui->label_ch_2_min->text().toFloat();
 | 
					
						
							|  |  |  | //        vib_dc_output_ptr->dc_output[1].maxmum = ui->label_ch_2_max->text().toFloat();
 | 
					
						
							|  |  |  | //    }
 | 
					
						
							|  |  |  | //    if(ui->label_ch_3->text() != "未使用"){
 | 
					
						
							|  |  |  | //        vib_dc_output_ptr->dc_output[2].output_channel = current_index;
 | 
					
						
							|  |  |  | //        vib_dc_output_ptr->dc_output[2].dc_output_channel = 3;
 | 
					
						
							|  |  |  | //        vib_dc_output_ptr->dc_output[2].minmum = ui->label_ch_3_min->text().toFloat();
 | 
					
						
							|  |  |  | //        vib_dc_output_ptr->dc_output[2].maxmum = ui->label_ch_3_max->text().toFloat();
 | 
					
						
							|  |  |  | //    }
 | 
					
						
							|  |  |  | //    if(ui->label_ch_4->text() != "未使用"){
 | 
					
						
							|  |  |  | //        vib_dc_output_ptr->dc_output[3].output_channel = current_index;
 | 
					
						
							|  |  |  | //        vib_dc_output_ptr->dc_output[3].dc_output_channel = 4;
 | 
					
						
							|  |  |  | //        vib_dc_output_ptr->dc_output[3].minmum = ui->label_ch_4_min->text().toFloat();
 | 
					
						
							|  |  |  | //        vib_dc_output_ptr->dc_output[3].maxmum = ui->label_ch_4_max->text().toFloat();
 | 
					
						
							|  |  |  | //    }
 | 
					
						
							| 
									
										
										
										
											2025-08-04 20:13:21 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-04 16:29:14 +08:00
										 |  |  |     this->close(); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | void DC_Outputs::on_pushButton_cancel_clicked() | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     this->close(); | 
					
						
							| 
									
										
										
										
											2025-08-04 12:25:12 +08:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2025-08-04 16:29:14 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-08-04 20:13:21 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | void DC_Outputs::on_comboBox_ch_output_currentIndexChanged(int index) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2025-08-05 20:49:25 +08:00
										 |  |  |     qDebug() << "on_comboBox_ch_output_currentIndexChanged" ; | 
					
						
							|  |  |  | //    if(ui->label_ch_1->text() != "未使用"){
 | 
					
						
							|  |  |  | //        vib_dc_output_ptr->dc_output[0].output_channel = current_index;
 | 
					
						
							|  |  |  | //        vib_dc_output_ptr->dc_output[0].dc_output_channel = 1;
 | 
					
						
							|  |  |  | //        vib_dc_output_ptr->dc_output[0].minmum = ui->label_ch_1_min->text().toFloat();
 | 
					
						
							|  |  |  | //        vib_dc_output_ptr->dc_output[0].maxmum = ui->label_ch_1_max->text().toFloat();
 | 
					
						
							|  |  |  | //    }
 | 
					
						
							|  |  |  | //    if(ui->label_ch_2->text() != "未使用"){
 | 
					
						
							|  |  |  | //        vib_dc_output_ptr->dc_output[1].output_channel = current_index;
 | 
					
						
							|  |  |  | //        vib_dc_output_ptr->dc_output[1].dc_output_channel = 2;
 | 
					
						
							|  |  |  | //        vib_dc_output_ptr->dc_output[1].minmum = ui->label_ch_2_min->text().toFloat();
 | 
					
						
							|  |  |  | //        vib_dc_output_ptr->dc_output[1].maxmum = ui->label_ch_2_max->text().toFloat();
 | 
					
						
							|  |  |  | //    }
 | 
					
						
							|  |  |  | //    if(ui->label_ch_3->text() != "未使用"){
 | 
					
						
							|  |  |  | //        vib_dc_output_ptr->dc_output[2].output_channel = current_index;
 | 
					
						
							|  |  |  | //        vib_dc_output_ptr->dc_output[2].dc_output_channel = 3;
 | 
					
						
							|  |  |  | //        vib_dc_output_ptr->dc_output[2].minmum = ui->label_ch_3_min->text().toFloat();
 | 
					
						
							|  |  |  | //        vib_dc_output_ptr->dc_output[2].maxmum = ui->label_ch_3_max->text().toFloat();
 | 
					
						
							|  |  |  | //    }
 | 
					
						
							|  |  |  | //    if(ui->label_ch_4->text() != "未使用"){
 | 
					
						
							|  |  |  | //        vib_dc_output_ptr->dc_output[3].output_channel = current_index;
 | 
					
						
							|  |  |  | //        vib_dc_output_ptr->dc_output[3].dc_output_channel = 4;
 | 
					
						
							|  |  |  | //        vib_dc_output_ptr->dc_output[3].minmum = ui->label_ch_4_min->text().toFloat();
 | 
					
						
							|  |  |  | //        vib_dc_output_ptr->dc_output[3].maxmum = ui->label_ch_4_max->text().toFloat();
 | 
					
						
							|  |  |  | //    }
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | //    current_index = index;
 | 
					
						
							|  |  |  | //    QString unit_str = GetUnit();
 | 
					
						
							|  |  |  | //    if(vib_dc_output_ptr->dc_output[0].dc_output_channel == 1 && current_index == vib_dc_output_ptr->dc_output[0].output_channel){
 | 
					
						
							|  |  |  | //        ui->label_ch_1->setText(ui->comboBox_ch_output->itemText(vib_dc_output_ptr->dc_output[0].output_channel));
 | 
					
						
							|  |  |  | //        ui->label_ch_1_min->setText(QString::number(vib_dc_output_ptr->dc_output[0].minmum));
 | 
					
						
							|  |  |  | //        ui->label_ch_1_max->setText(QString::number(vib_dc_output_ptr->dc_output[0].maxmum));
 | 
					
						
							| 
									
										
										
										
											2025-08-06 22:11:14 +08:00
										 |  |  | //        ch_used[slot_no][current_index].used[0] = true;
 | 
					
						
							| 
									
										
										
										
											2025-08-05 20:49:25 +08:00
										 |  |  | //    }
 | 
					
						
							|  |  |  | //    if(vib_dc_output_ptr->dc_output[1].dc_output_channel == 2 && current_index == vib_dc_output_ptr->dc_output[1].output_channel){
 | 
					
						
							|  |  |  | //        ui->label_ch_2->setText(ui->comboBox_ch_output->itemText(vib_dc_output_ptr->dc_output[1].output_channel));
 | 
					
						
							|  |  |  | //        ui->label_ch_2_min->setText(QString::number(vib_dc_output_ptr->dc_output[1].minmum));
 | 
					
						
							|  |  |  | //        ui->label_ch_2_max->setText(QString::number(vib_dc_output_ptr->dc_output[1].maxmum));
 | 
					
						
							| 
									
										
										
										
											2025-08-06 22:11:14 +08:00
										 |  |  | //        ch_used[slot_no][current_index].used[1] = true;
 | 
					
						
							| 
									
										
										
										
											2025-08-05 20:49:25 +08:00
										 |  |  | //    }
 | 
					
						
							|  |  |  | //    if(vib_dc_output_ptr->dc_output[2].dc_output_channel == 3 && current_index == vib_dc_output_ptr->dc_output[2].output_channel){
 | 
					
						
							|  |  |  | //        ui->label_ch_3->setText(ui->comboBox_ch_output->itemText(vib_dc_output_ptr->dc_output[2].output_channel));
 | 
					
						
							|  |  |  | //        ui->label_ch_3_min->setText(QString::number(vib_dc_output_ptr->dc_output[2].minmum));
 | 
					
						
							|  |  |  | //        ui->label_ch_3_max->setText(QString::number(vib_dc_output_ptr->dc_output[2].maxmum));
 | 
					
						
							| 
									
										
										
										
											2025-08-06 22:11:14 +08:00
										 |  |  | //        ch_used[slot_no][current_index].used[2] = true;
 | 
					
						
							| 
									
										
										
										
											2025-08-05 20:49:25 +08:00
										 |  |  | //    }
 | 
					
						
							|  |  |  | //    if(vib_dc_output_ptr->dc_output[3].dc_output_channel == 4 && current_index == vib_dc_output_ptr->dc_output[3].output_channel){
 | 
					
						
							|  |  |  | //        ui->label_ch_4->setText(ui->comboBox_ch_output->itemText(vib_dc_output_ptr->dc_output[3].output_channel));
 | 
					
						
							|  |  |  | //        ui->label_ch_4_min->setText(QString::number(vib_dc_output_ptr->dc_output[3].minmum));
 | 
					
						
							|  |  |  | //        ui->label_ch_4_max->setText(QString::number(vib_dc_output_ptr->dc_output[3].maxmum));
 | 
					
						
							| 
									
										
										
										
											2025-08-06 22:11:14 +08:00
										 |  |  | //        ch_used[slot_no][current_index].used[3] = true;
 | 
					
						
							| 
									
										
										
										
											2025-08-05 20:49:25 +08:00
										 |  |  | //    }
 | 
					
						
							| 
									
										
										
										
											2025-08-04 20:13:21 +08:00
										 |  |  | } | 
					
						
							|  |  |  | 
 |