Activate downloading device controller.

This commit is contained in:
Gerhard Hoffmann 2023-11-21 10:09:04 +01:00
parent b45f3a04b4
commit 4e92522578

View File

@ -488,28 +488,20 @@ bool Update::doUpdate(int &displayIndex, QStringList const &filesToWorkOn) {
for (it = filesToWorkOn.cbegin(); it != filesToWorkOn.cend(); ++it) { for (it = filesToWorkOn.cbegin(); it != filesToWorkOn.cend(); ++it) {
m_worker->startProgressLoop(); m_worker->startProgressLoop();
QString const &fToWorkOn = QDir::cleanPath(m_customerRepository + QDir::separator() + it->trimmed()); QString const &fToWorkOn = QDir::cleanPath(m_customerRepository + QDir::separator() + it->trimmed());
#if UPDATE_DC == 1
static const QRegularExpression version("^.*dc2c[.][0-9]{1,2}[.][0-9]{1,2}[.]bin.*$"); static const QRegularExpression version("^.*dc2c[.][0-9]{1,2}[.][0-9]{1,2}[.]bin.*$");
if (fToWorkOn.contains(version)) { if (fToWorkOn.contains(version)) {
Utils::printInfoMsg("DO-UPDATE FILE-TO-WORK-ON " + fToWorkOn);
QFile fn(fToWorkOn);
QFileInfo finfo(fn);
if (!fn.exists()) { // check for broken link
Utils::printCriticalErrorMsg("DO-UPDATE FILE-TO-WORK-ON "
+ fToWorkOn + " DOES NOT EXIST");
res = false;
} else {
bool updateBinaryRes = true; bool updateBinaryRes = true;
qInfo() << "DOWNLOADING" << finfo.completeBaseName() << "TO DC"; // CONSOLE()
m_hw->dc_autoRequest(false);// default: turn auto-request setting off m_hw->dc_autoRequest(false);// default: turn auto-request setting off
QThread::sleep(1); // wait to be sure that there are no more QThread::sleep(1); // wait to be sure that there are no more
// commands sent to dc-hardware // commands sent to dc-hardware
qInfo() << "SET AUTO-REQUEST=FALSE";
if ((updateBinaryRes = updateBinary(fToWorkOn.toStdString().c_str())) == true) { if ((updateBinaryRes = updateBinary(fToWorkOn)) == true) {
qCritical() << "downloaded binary" << fToWorkOn;
// qCritical() << "downloaded binary" << fToWorkOn;
++displayIndex; ++displayIndex;
emit m_worker->appendText(QString("\n(") + QString("%1").arg(displayIndex).rightJustified(2, ' ') + QString(")") emit m_worker->appendText(QString("\n(") + QString("%1").arg(displayIndex).rightJustified(2, ' ') + QString(")")
+ QString(" Update ") + QFileInfo(fToWorkOn).fileName(), + QString(" Update ") + QFileInfo(fToWorkOn).fileName(),
@ -517,7 +509,8 @@ bool Update::doUpdate(int &displayIndex, QStringList const &filesToWorkOn) {
} }
m_hw->dc_autoRequest(true); // turn auto-request setting on m_hw->dc_autoRequest(true); // turn auto-request setting on
qInfo() << "SET AUTO-REQUEST=TRUE";
// qInfo() << "SET AUTO-REQUEST=TRUE";
QStringList const &versions = Update::getDcSoftAndHardWareVersion(); QStringList const &versions = Update::getDcSoftAndHardWareVersion();
if (versions.size() >= 2) { if (versions.size() >= 2) {
@ -529,10 +522,10 @@ bool Update::doUpdate(int &displayIndex, QStringList const &filesToWorkOn) {
qInfo() << "dc-firmware-version (NOT UPDATED)" << versions[1]; qInfo() << "dc-firmware-version (NOT UPDATED)" << versions[1];
} }
} }
res = updateBinaryRes; res = updateBinaryRes;
}
#endif } else if (fToWorkOn.contains("DC2C_print", Qt::CaseInsensitive)
if (fToWorkOn.contains("DC2C_print", Qt::CaseInsensitive)
&& fToWorkOn.endsWith(".json", Qt::CaseInsensitive)) { && fToWorkOn.endsWith(".json", Qt::CaseInsensitive)) {
res = true; res = true;
int i = fToWorkOn.indexOf("DC2C_print", Qt::CaseInsensitive); int i = fToWorkOn.indexOf("DC2C_print", Qt::CaseInsensitive);