Add some debug output to openSerial().
This commit is contained in:
parent
6765b12f0c
commit
9df46a1c49
74
update.cpp
74
update.cpp
@ -257,31 +257,77 @@ bool Update::startBootloader() const { // deprecated
|
|||||||
}
|
}
|
||||||
qCritical() << "starting bootloader...FAILED" << QThread::currentThread();
|
qCritical() << "starting bootloader...FAILED" << QThread::currentThread();
|
||||||
return false;
|
return false;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Update::stopBootloader() const {
|
bool Update::stopBootloader() const {
|
||||||
qDebug() << "stopping bootloader...";
|
// stop bootloader: this MUST work -> otherwise the PSA has to be restarted
|
||||||
int nTry = 5;
|
// manually
|
||||||
while (--nTry >= 0) {
|
emit m_worker->showErrorMessage("dc update", "stopping bootloader...");
|
||||||
m_hw->bl_stopBL();
|
|
||||||
QThread::msleep(500);
|
int nTryFinalize = 1; // could do this in an endless loop
|
||||||
if (!m_hw->bl_isUp()) {
|
|
||||||
qInfo() << "stopping bootloader...OK";
|
do {
|
||||||
return true;
|
// in principle, any value except BL_STOP will do, as we want to detect
|
||||||
|
// change to BL_STOP
|
||||||
|
m_worker->mainWindow()->setUpdateStep(UpdateDcEvent::UpdateStep::BL_CHECK);
|
||||||
|
|
||||||
|
QApplication::postEvent(
|
||||||
|
m_worker->mainWindow(),
|
||||||
|
new UpdateDcEvent(m_worker, UpdateDcEvent::UpdateStep::BL_STOP, nTryFinalize));
|
||||||
|
|
||||||
|
QThread::sleep(1);
|
||||||
|
|
||||||
|
int const cntLimit = 20;
|
||||||
|
int cnt = 0;
|
||||||
|
while (++cnt < cntLimit &&
|
||||||
|
m_worker->mainWindow()->updateStep() != UpdateDcEvent::UpdateStep::BL_STOP) {
|
||||||
|
// wait until bl_stopBL() has been sent
|
||||||
|
QThread::msleep(500);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
qCritical() << "stopping bootloader...FAILED";
|
QApplication::postEvent(
|
||||||
return false;
|
m_worker->mainWindow(),
|
||||||
|
new UpdateDcEvent(m_worker, UpdateDcEvent::UpdateStep::BL_CHECK, nTryFinalize));
|
||||||
|
QThread::sleep(1);
|
||||||
|
|
||||||
|
QApplication::postEvent(
|
||||||
|
m_worker->mainWindow(),
|
||||||
|
new UpdateDcEvent(m_worker, UpdateDcEvent::UpdateStep::BL_IS_UP, nTryFinalize));
|
||||||
|
QThread::sleep(1);
|
||||||
|
|
||||||
|
cnt = 0;
|
||||||
|
while (++cnt < cntLimit &&
|
||||||
|
m_worker->mainWindow()->updateStep() != UpdateDcEvent::UpdateStep::BL_IS_DOWN) {
|
||||||
|
// wait until done
|
||||||
|
QThread::msleep(200);
|
||||||
|
}
|
||||||
|
|
||||||
|
} while (++nTryFinalize <= MainWindow::BL_STOP_COUNT &&
|
||||||
|
m_worker->mainWindow()->updateStep() != UpdateDcEvent::UpdateStep::BL_IS_DOWN);
|
||||||
|
|
||||||
|
return (m_worker->mainWindow()->updateStep() == UpdateDcEvent::UpdateStep::BL_IS_DOWN);
|
||||||
}
|
}
|
||||||
|
|
||||||
// br is a index into a table, used for historical reasons.
|
// br is a index into a table, used for historical reasons.
|
||||||
bool Update::openSerial(int br, QString baudrate, QString comPort) const {
|
bool Update::openSerial(int br, QString baudrate, QString comPort) const {
|
||||||
qDebug() << "opening serial" << br << baudrate << comPort << "...";
|
qDebug() << "opening serial" << br << baudrate << comPort << "...";
|
||||||
if (m_hw->dc_openSerial(br, baudrate, comPort, 1)) { // 1 for connect
|
if (m_hw->dc_openSerial(br, baudrate, comPort, 1) == true) { // 1 for connect
|
||||||
qInfo() << "opening serial" << br << baudrate << comPort << "...OK";
|
Utils::printInfoMsg(
|
||||||
|
QString("OPENING SERIAL %1").arg(br)
|
||||||
|
+ " " + baudrate + " " + comPort + "...OK");
|
||||||
|
|
||||||
|
// m_hw->dc_autoRequest(true);
|
||||||
|
m_hw->dc_autoRequest(false);
|
||||||
|
QThread::sleep(1);
|
||||||
|
|
||||||
|
Utils::printInfoMsg(QString("IS PORT OPEN %1").arg(m_hw->dc_isPortOpen()));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
qCritical() << "opening serial" << br << baudrate << comPort << "...FAILED";
|
|
||||||
|
Utils::printCriticalErrorMsg(
|
||||||
|
QString("OPENING SERIAL %1").arg(br)
|
||||||
|
+ " " + baudrate + " " + comPort + "...FAILED");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user