|
@ -20,6 +20,7 @@ QTimer *timer0; |
|
|
QTimer *timer1; |
|
|
QTimer *timer1; |
|
|
QTimer *timer2; |
|
|
QTimer *timer2; |
|
|
QTimer *timer3; |
|
|
QTimer *timer3; |
|
|
|
|
|
QTimer *checkConnectTimer0; |
|
|
#define TAG "MainWindow"
|
|
|
#define TAG "MainWindow"
|
|
|
|
|
|
|
|
|
static const char *fmt(const char *fmt, ...) { |
|
|
static const char *fmt(const char *fmt, ...) { |
|
@ -245,6 +246,19 @@ void MainWindow::refreshReadonlyPage2() { |
|
|
UPDATE(4); |
|
|
UPDATE(4); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bool MainWindow::checkConnected() { |
|
|
|
|
|
if (!G_QTDataChannel.isOpen()) { |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
uint32_t val; |
|
|
|
|
|
zaf_error_code_t ecode = m_clstc->reg_read(kreg_software_version, val); |
|
|
|
|
|
if (ecode != kaf_ec_success) { |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
return true; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
void MainWindow::refreshReadonlyPage3() { |
|
|
void MainWindow::refreshReadonlyPage3() { |
|
|
if (!G_QTDataChannel.isOpen()) { |
|
|
if (!G_QTDataChannel.isOpen()) { |
|
|
return; |
|
|
return; |
|
@ -632,6 +646,8 @@ void MainWindow::constructUI() { |
|
|
ui->ShutterX_InSigSelect_2->addItems(LightSrcX_TriSrc_QStringList); |
|
|
ui->ShutterX_InSigSelect_2->addItems(LightSrcX_TriSrc_QStringList); |
|
|
ui->ShutterX_InSigSelect_3->addItems(LightSrcX_TriSrc_QStringList); |
|
|
ui->ShutterX_InSigSelect_3->addItems(LightSrcX_TriSrc_QStringList); |
|
|
ui->ShutterX_InSigSelect_4->addItems(LightSrcX_TriSrc_QStringList); |
|
|
ui->ShutterX_InSigSelect_4->addItems(LightSrcX_TriSrc_QStringList); |
|
|
|
|
|
|
|
|
|
|
|
ui->InterClk_TriOutSignalFreq_Text->setDisabled(true); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { |
|
|
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { |
|
@ -654,22 +670,45 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWi |
|
|
constructUI(); |
|
|
constructUI(); |
|
|
|
|
|
|
|
|
// 创建定时器
|
|
|
// 创建定时器
|
|
|
timer0 = new QTimer(this); |
|
|
|
|
|
timer1 = new QTimer(this); |
|
|
|
|
|
timer2 = new QTimer(this); |
|
|
|
|
|
timer3 = new QTimer(this); |
|
|
|
|
|
|
|
|
timer0 = new QTimer(this); |
|
|
|
|
|
timer1 = new QTimer(this); |
|
|
|
|
|
timer2 = new QTimer(this); |
|
|
|
|
|
timer3 = new QTimer(this); |
|
|
|
|
|
checkConnectTimer0 = new QTimer(this); |
|
|
connect(timer0, &QTimer::timeout, this, [this]() { refreshReadonlyPage0(); }); |
|
|
connect(timer0, &QTimer::timeout, this, [this]() { refreshReadonlyPage0(); }); |
|
|
connect(timer1, &QTimer::timeout, this, [this]() { refreshReadonlyPage1(); }); |
|
|
connect(timer1, &QTimer::timeout, this, [this]() { refreshReadonlyPage1(); }); |
|
|
connect(timer2, &QTimer::timeout, this, [this]() { refreshReadonlyPage2(); }); |
|
|
connect(timer2, &QTimer::timeout, this, [this]() { refreshReadonlyPage2(); }); |
|
|
connect(timer3, &QTimer::timeout, this, [this]() { refreshReadonlyPage3(); }); |
|
|
connect(timer3, &QTimer::timeout, this, [this]() { refreshReadonlyPage3(); }); |
|
|
|
|
|
connect(checkConnectTimer0, &QTimer::timeout, this, [this]() { //
|
|
|
|
|
|
static bool connected = false; |
|
|
|
|
|
bool connect = checkConnected(); |
|
|
|
|
|
if (connect) { |
|
|
|
|
|
ui->DeviceConnectStateTB->setText("已连接"); |
|
|
|
|
|
ui->DeviceConnectStateTB->setStyleSheet("color: green"); |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
ui->DeviceConnectStateTB->setText("未连接"); |
|
|
|
|
|
ui->DeviceConnectStateTB->setStyleSheet("color: red"); |
|
|
|
|
|
} |
|
|
|
|
|
if (connected != connect) { |
|
|
|
|
|
connected = connect; |
|
|
|
|
|
if (connected) { |
|
|
|
|
|
refreshPage(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
timer0->setInterval(1100); // 每隔一秒触发一次
|
|
|
timer0->setInterval(1100); // 每隔一秒触发一次
|
|
|
timer1->setInterval(1200); // 每隔一秒触发一次
|
|
|
timer1->setInterval(1200); // 每隔一秒触发一次
|
|
|
timer2->setInterval(900); // 每隔一秒触发一次
|
|
|
timer2->setInterval(900); // 每隔一秒触发一次
|
|
|
timer3->setInterval(1000); // 每隔一秒触发一次
|
|
|
timer3->setInterval(1000); // 每隔一秒触发一次
|
|
|
|
|
|
checkConnectTimer0->setInterval(100); |
|
|
timer0->start(); |
|
|
timer0->start(); |
|
|
timer1->start(); |
|
|
timer1->start(); |
|
|
timer2->start(); |
|
|
timer2->start(); |
|
|
timer3->start(); |
|
|
timer3->start(); |
|
|
|
|
|
checkConnectTimer0->start(); |
|
|
|
|
|
|
|
|
// m_clstc->regRawDataListener([this](uart_message_type_t type, uint8_t *data, size_t len) {
|
|
|
// m_clstc->regRawDataListener([this](uart_message_type_t type, uint8_t *data, size_t len) {
|
|
|
// QString text;
|
|
|
// QString text;
|
|
|