From 6765b12f0c508b0505f7607fc4f285ed24855e5d Mon Sep 17 00:00:00 2001 From: Gerhard Hoffmann Date: Sat, 9 Sep 2023 14:52:40 +0200 Subject: [PATCH] startBootloader(): deprecated. --- update.cpp | 45 ++++++++++++++++++++++++++++++++------------- 1 file changed, 32 insertions(+), 13 deletions(-) diff --git a/update.cpp b/update.cpp index 8b20404..38e0d28 100644 --- a/update.cpp +++ b/update.cpp @@ -1,5 +1,8 @@ #include "update.h" #include "worker.h" +#include "utils.h" +#include "update_dc_event.h" +#include "mainwindow.h" #include #include @@ -9,6 +12,7 @@ #include #include #include +#include //#include //#include @@ -81,6 +85,7 @@ Update::Update(hwinf *hw, QString customerRepository, QString customerNrStr, QString branchName, + QString pluginName, QString workingDir, bool dryRun, QObject *parent, @@ -94,8 +99,17 @@ Update::Update(hwinf *hw, , m_customerRepository(customerRepository) , m_customerNrStr(customerNrStr) , m_branchName(branchName) + , m_pluginName(pluginName) , m_workingDir(workingDir) , m_dryRun(dryRun) { + + qInfo() << "UPDATE: m_serialInterface ..." << m_serialInterface; + qInfo() << "UPDATE: m_baudrate ..." << m_baudrate; + qInfo() << "UPDATE: m_customerRepository ..." << m_customerRepository; + qInfo() << "UPDATE: m_customerNr ..........." << m_customerNrStr; + qInfo() << "UPDATE: m_branchName ..........." << m_branchName; + qInfo() << "UPDATE: m_pluginName ..........." << m_pluginName; + qInfo() << "UPDATE: m_workingDirectory ....." << m_workingDir; } Update::~Update() { @@ -221,22 +235,27 @@ Update::DownloadResult Update::dc_downloadBinary(QByteArray const &b) const { return res; } -bool Update::startBootloader() const { - qDebug() << "starting bootloader..."; - int nTry = 5; - while (--nTry >= 0) { +bool Update::startBootloader() const { // deprecated + return false; +#if 0 + int nStartTry = 5; + while (--nStartTry >= 0) { m_hw->bl_startBL(); - QThread::msleep(5000); - m_hw->bl_checkBL(); - if (m_hw->bl_isUp()) { - qInfo() << "starting bootloader...OK"; - QThread::msleep(5000); - return true; - } else { - qCritical() << "bootloader not up (" << nTry << ")"; + QThread::msleep(500); + int nCheckTry = 10; + while (--nCheckTry >= 0) { + m_hw->bl_checkBL(); + QThread::msleep(500); + if (m_hw->bl_isUp()) { + qInfo() << "starting bootloader...OK"; + return true; + } else { + qCritical() << "bootloader not up (" + << nStartTry << "," << nCheckTry << ")" << QThread::currentThread(); + } } } - qCritical() << "starting bootloader...FAILED"; + qCritical() << "starting bootloader...FAILED" << QThread::currentThread(); return false; }