Activate downloading device controller.
This commit is contained in:
parent
b45f3a04b4
commit
4e92522578
69
update.cpp
69
update.cpp
@ -488,52 +488,45 @@ bool Update::doUpdate(int &displayIndex, QStringList const &filesToWorkOn) {
|
||||
for (it = filesToWorkOn.cbegin(); it != filesToWorkOn.cend(); ++it) {
|
||||
m_worker->startProgressLoop();
|
||||
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.*$");
|
||||
if (fToWorkOn.contains(version)) {
|
||||
Utils::printInfoMsg("DO-UPDATE FILE-TO-WORK-ON " + fToWorkOn);
|
||||
bool updateBinaryRes = true;
|
||||
|
||||
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;
|
||||
// CONSOLE()
|
||||
|
||||
qInfo() << "DOWNLOADING" << finfo.completeBaseName() << "TO DC";
|
||||
m_hw->dc_autoRequest(false);// default: turn auto-request setting off
|
||||
QThread::sleep(1); // wait to be sure that there are no more
|
||||
// commands sent to dc-hardware
|
||||
qInfo() << "SET AUTO-REQUEST=FALSE";
|
||||
m_hw->dc_autoRequest(false);// default: turn auto-request setting off
|
||||
QThread::sleep(1); // wait to be sure that there are no more
|
||||
// commands sent to dc-hardware
|
||||
|
||||
if ((updateBinaryRes = updateBinary(fToWorkOn.toStdString().c_str())) == 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);
|
||||
}
|
||||
if ((updateBinaryRes = updateBinary(fToWorkOn)) == true) {
|
||||
|
||||
m_hw->dc_autoRequest(true); // turn auto-request setting on
|
||||
qInfo() << "SET AUTO-REQUEST=TRUE";
|
||||
// qCritical() << "downloaded binary" << fToWorkOn;
|
||||
|
||||
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;
|
||||
++displayIndex;
|
||||
emit m_worker->appendText(QString("\n(") + QString("%1").arg(displayIndex).rightJustified(2, ' ') + QString(")")
|
||||
+ QString(" Update ") + QFileInfo(fToWorkOn).fileName(),
|
||||
Worker::UPDATE_STEP_DONE);
|
||||
}
|
||||
#endif
|
||||
if (fToWorkOn.contains("DC2C_print", Qt::CaseInsensitive)
|
||||
&& fToWorkOn.endsWith(".json", Qt::CaseInsensitive)) {
|
||||
|
||||
m_hw->dc_autoRequest(true); // turn auto-request setting on
|
||||
|
||||
// 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;
|
||||
int i = fToWorkOn.indexOf("DC2C_print", Qt::CaseInsensitive);
|
||||
int const templateIdx = fToWorkOn.mid(i).midRef(10, 2).toInt();
|
||||
|
Loading…
Reference in New Issue
Block a user