startBootloader(): deprecated.

This commit is contained in:
Gerhard Hoffmann 2023-09-09 14:52:40 +02:00
parent 3e925756cf
commit 6765b12f0c

View File

@ -1,5 +1,8 @@
#include "update.h"
#include "worker.h"
#include "utils.h"
#include "update_dc_event.h"
#include "mainwindow.h"
#include <QCoreApplication>
#include <QApplication>
@ -9,6 +12,7 @@
#include <QTextStream>
#include <QRegularExpression>
#include <QRegExp>
#include <QApplication>
//#include <iostream>
//#include <fstream>
@ -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;
}