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,52 +488,45 @@ 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); bool updateBinaryRes = true;
QFile fn(fToWorkOn); // CONSOLE()
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;
qInfo() << "DOWNLOADING" << finfo.completeBaseName() << "TO DC"; 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;
++displayIndex;
emit m_worker->appendText(QString("\n(") + QString("%1").arg(displayIndex).rightJustified(2, ' ') + QString(")")
+ QString(" Update ") + QFileInfo(fToWorkOn).fileName(),
Worker::UPDATE_STEP_DONE);
}
m_hw->dc_autoRequest(true); // turn auto-request setting on // qCritical() << "downloaded binary" << fToWorkOn;
qInfo() << "SET AUTO-REQUEST=TRUE";
QStringList const &versions = Update::getDcSoftAndHardWareVersion(); ++displayIndex;
if (versions.size() >= 2) { emit m_worker->appendText(QString("\n(") + QString("%1").arg(displayIndex).rightJustified(2, ' ') + QString(")")
if (updateBinaryRes == true) { + QString(" Update ") + QFileInfo(fToWorkOn).fileName(),
qInfo() << "dc-hardware-version (UPDATED)" << versions[0]; Worker::UPDATE_STEP_DONE);
qInfo() << "dc-firmware-version (UPDATED)" << versions[1];
} else {
qInfo() << "dc-hardware-version (NOT UPDATED)" << versions[0];
qInfo() << "dc-firmware-version (NOT UPDATED)" << versions[1];
}
}
res = updateBinaryRes;
} }
#endif
if (fToWorkOn.contains("DC2C_print", Qt::CaseInsensitive) m_hw->dc_autoRequest(true); // turn auto-request setting on
&& fToWorkOn.endsWith(".json", Qt::CaseInsensitive)) {
// qInfo() << "SET AUTO-REQUEST=TRUE";
QStringList const &versions = Update::getDcSoftAndHardWareVersion();
if (versions.size() >= 2) {
if (updateBinaryRes == true) {
qInfo() << "dc-hardware-version (UPDATED)" << versions[0];
qInfo() << "dc-firmware-version (UPDATED)" << versions[1];
} else {
qInfo() << "dc-hardware-version (NOT UPDATED)" << versions[0];
qInfo() << "dc-firmware-version (NOT UPDATED)" << versions[1];
}
}
res = updateBinaryRes;
} else if (fToWorkOn.contains("DC2C_print", 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);
int const templateIdx = fToWorkOn.mid(i).midRef(10, 2).toInt(); int const templateIdx = fToWorkOn.mid(i).midRef(10, 2).toInt();