修复bug

This commit is contained in:
zhangsheng 2026-03-07 17:07:45 +08:00
parent 8102b9dee7
commit 129d4bbc93
5 changed files with 30 additions and 23 deletions

View File

@ -443,7 +443,7 @@ typedef struct {
int percentage;
} RecorderOut;
typedef struct {
typedef struct TachometerVariables_{
int id;
QString point_name;
bool active;
@ -464,6 +464,9 @@ typedef struct {
bool overspeed_latching;
bool normal_latching;
bool fail;
TachometerVariables_(){
fail = true;
}
} TachometerVariables;
typedef struct {

View File

@ -178,9 +178,9 @@ void KeyPhase::Init() {
ui->doubleSpinBox_hysteresis_1->setValue(keyphase_data->variables_[i].hysteresis);
ui->spinBox_events_per_revolution_1->setValue(keyphase_data->variables_[i].events_per_revolution);
if(keyphase_data->variables_[i].fail)
ui->radioButton_falling_edge->setCheckable(true);
ui->radioButton_falling_edge->setChecked(true);
else
ui->radioButton_rising_edge->setCheckable(true);
ui->radioButton_rising_edge->setChecked(true);
} else if (i + 1 == 2) {
ui->checkBox_enable_2->setChecked(keyphase_data->variables_[i].active);
ui->doubleSpinBox_high_2->setValue(keyphase_data->variables_[i].normal_voltage_high);
@ -200,9 +200,9 @@ void KeyPhase::Init() {
ui->doubleSpinBox_hysteresis_2->setValue(keyphase_data->variables_[i].hysteresis);
ui->spinBox_events_per_revolution_2->setValue(keyphase_data->variables_[i].events_per_revolution);
if(keyphase_data->variables_[i].fail)
ui->radioButton_falling_edge_2->setCheckable(true);
ui->radioButton_falling_edge_2->setChecked(true);
else
ui->radioButton_rising_edge_2->setCheckable(true);
ui->radioButton_rising_edge_2->setChecked(true);
} else if (i + 1 == 3) {
ui->checkBox_enable_3->setChecked(keyphase_data->variables_[i].active);
ui->doubleSpinBox_high_3->setValue(keyphase_data->variables_[i].normal_voltage_high);
@ -222,9 +222,9 @@ void KeyPhase::Init() {
ui->doubleSpinBox_hysteresis_3->setValue(keyphase_data->variables_[i].hysteresis);
ui->spinBox_events_per_revolution_3->setValue(keyphase_data->variables_[i].events_per_revolution);
if(keyphase_data->variables_[i].fail)
ui->radioButton_falling_edge_3->setCheckable(true);
ui->radioButton_falling_edge_3->setChecked(true);
else
ui->radioButton_rising_edge_3->setCheckable(true);
ui->radioButton_rising_edge_3->setChecked(true);
} else if (i + 1 == 4) {
ui->checkBox_enable_4->setChecked(keyphase_data->variables_[i].active);
ui->doubleSpinBox_high_4->setValue(keyphase_data->variables_[i].normal_voltage_high);
@ -244,9 +244,9 @@ void KeyPhase::Init() {
ui->doubleSpinBox_hysteresis_4->setValue(keyphase_data->variables_[i].hysteresis);
ui->spinBox_events_per_revolution_4->setValue(keyphase_data->variables_[i].events_per_revolution);
if(keyphase_data->variables_[i].fail)
ui->radioButton_falling_edge_4->setCheckable(true);
ui->radioButton_falling_edge_4->setChecked(true);
else
ui->radioButton_rising_edge_4->setCheckable(true);
ui->radioButton_rising_edge_4->setChecked(true);
}
}
ui->comboBox_relative_number->setCurrentIndex(base_ptr->relative_number);

View File

@ -122,7 +122,7 @@ MainWindow::MainWindow(QWidget *parent)
//qInstallMessageHandler(messageHandler);
#endif
QDate buildDate = QLocale( QLocale::English ).toDate( QString(__DATE__).replace(" ", " 0"), "MMM dd yyyy");
QString Version = "V1.0_" + buildDate.toString("yyyyMMdd") + "_3609";
QString Version = "V1.0_" + buildDate.toString("yyyyMMdd") + "_8102";
ui->label_version->setText(Version);
}

View File

@ -276,6 +276,7 @@ void Tachometer::Init() {
}
std::shared_ptr<TachometerData> speed_data = std::dynamic_pointer_cast<TachometerData>(base_ptr);
for (int i = 0; i < CHANNEL_COUNT_SPEED; i++) {
qDebug() << "speed_data->variables_[i].fail" << i << speed_data->variables_[i].fail;
if (i + 1 == 1) {
ui->checkBox_chan_1->setChecked(speed_data->variables_[i].active);
ui->doubleSpinBox_high_1->setValue(speed_data->variables_[i].normal_voltage_high);
@ -299,10 +300,13 @@ void Tachometer::Init() {
ui->spinBox_events_per_revolution_1->setValue(speed_data->variables_[i].events_per_revolution);
ui->comboBox_record_output_1->setCurrentIndex(speed_data->variables_[i].record_output);
ui->checkBox_two_ma_clamp_1->setChecked(speed_data->variables_[i].two_ma_clamp);
if(speed_data->variables_[i].fail)
ui->radioButton_falling_edge->setCheckable(true);
else
ui->radioButton_rising_edge->setCheckable(true);
if(speed_data->variables_[i].fail){
ui->radioButton_falling_edge->setChecked(true);
}
else{
ui->radioButton_rising_edge->setChecked(true);
}
// -alarm
ui->lineEdit_danger_high_level->setText(QString::number(speed_data->danger_high[i].level));
ui->lineEdit_danger_high_hysteresis->setText(QString::number(speed_data->danger_high[i].hysteresis));
@ -351,9 +355,9 @@ void Tachometer::Init() {
ui->comboBox_record_output_2->setCurrentIndex(speed_data->variables_[i].record_output);
ui->checkBox_two_ma_clamp_2->setChecked(speed_data->variables_[i].two_ma_clamp);
if(speed_data->variables_[i].fail)
ui->radioButton_falling_edge_2->setCheckable(true);
ui->radioButton_falling_edge_2->setChecked(true);
else
ui->radioButton_rising_edge_2->setCheckable(true);
ui->radioButton_rising_edge_2->setChecked(true);
// -alarm
ui->lineEdit_danger_high_level_2->setText(QString::number(speed_data->danger_high[i].level));
ui->lineEdit_danger_high_hysteresis_2->setText(QString::number(speed_data->danger_high[i].hysteresis));
@ -402,9 +406,9 @@ void Tachometer::Init() {
ui->comboBox_record_output_3->setCurrentIndex(speed_data->variables_[i].record_output);
ui->checkBox_two_ma_clamp_3->setChecked(speed_data->variables_[i].two_ma_clamp);
if(speed_data->variables_[i].fail)
ui->radioButton_falling_edge_3->setCheckable(true);
ui->radioButton_falling_edge_3->setChecked(true);
else
ui->radioButton_rising_edge_3->setCheckable(true);
ui->radioButton_rising_edge_3->setChecked(true);
// -alarm
ui->lineEdit_danger_high_level_3->setText(QString::number(speed_data->danger_high[i].level));
ui->lineEdit_danger_high_hysteresis_3->setText(QString::number(speed_data->danger_high[i].hysteresis));
@ -453,9 +457,9 @@ void Tachometer::Init() {
ui->comboBox_record_output_4->setCurrentIndex(speed_data->variables_[i].record_output);
ui->checkBox_two_ma_clamp_4->setChecked(speed_data->variables_[i].two_ma_clamp);
if(speed_data->variables_[i].fail)
ui->radioButton_falling_edge_4->setCheckable(true);
ui->radioButton_falling_edge_4->setChecked(true);
else
ui->radioButton_rising_edge_4->setCheckable(true);
ui->radioButton_rising_edge_4->setChecked(true);
// -alarm
ui->lineEdit_danger_high_level_4->setText(QString::number(speed_data->danger_high[i].level));
ui->lineEdit_danger_high_hysteresis_4->setText(QString::number(speed_data->danger_high[i].hysteresis));

View File

@ -874,7 +874,7 @@
<property name="maximumSize">
<size>
<width>16777215</width>
<height>30</height>
<height>16777215</height>
</size>
</property>
<property name="text">
@ -893,7 +893,7 @@
<property name="maximumSize">
<size>
<width>16777215</width>
<height>30</height>
<height>16777215</height>
</size>
</property>
<property name="minimum">
@ -915,7 +915,7 @@
<property name="maximumSize">
<size>
<width>16777215</width>
<height>30</height>
<height>16777215</height>
</size>
</property>
<property name="text">