添加升级串口打开失败后继续尝试的逻辑。

This commit is contained in:
luocai
2024-08-09 18:10:24 +08:00
parent 9d495d487d
commit 928326efb2
3 changed files with 14 additions and 4 deletions

View File

@ -13,6 +13,7 @@
#include <QProgressBar>
#include <QPushButton>
#include <QSerialPortInfo>
#include <QTimer>
#include <QVBoxLayout>
#include <filesystem>
@ -53,7 +54,8 @@ Widget::Widget(QWidget *parent) : QWidget(parent) {
setAcceptDrops(true);
}
Widget::~Widget() {}
Widget::~Widget() {
}
void Widget::start() {
m_progressBar->setValue(0);
@ -90,6 +92,9 @@ void Widget::start() {
void Widget::onCdcDeviceDiscovered(const QSerialPortInfo &info) {
auto status = m_updater->open(info);
LOG(info) << "open cdc port: " << info.portName().toStdString() << ", status: " << status;
if (!status) {
QTimer::singleShot(0, this, [this]() { m_updater->startSearchDevice(); });
}
}
void Widget::onSelectButtonClicked() {