Use QThread::sleep() instead of std-C++-code.

This commit is contained in:
Gerhard Hoffmann 2023-07-06 14:24:19 +02:00
parent 17eaa7858f
commit a0d0de19c5

View File

@ -216,7 +216,7 @@ Update::DownloadResult Update::sendNextAddress(int bNum) const {
qDebug() << "addr-block" << bNum << "..."; qDebug() << "addr-block" << bNum << "...";
while (noAnswerCount <= 250) { while (noAnswerCount <= 250) {
m_hw->bl_sendAddress(bNum); m_hw->bl_sendAddress(bNum);
std::this_thread::sleep_for(std::chrono::milliseconds(100)); QThread::msleep(100);
DownloadResult const res = sendStatus(m_hw->bl_wasSendingAddOK()); DownloadResult const res = sendStatus(m_hw->bl_wasSendingAddOK());
if (res != DownloadResult::NOP) { if (res != DownloadResult::NOP) {
if (res == DownloadResult::ERROR) { if (res == DownloadResult::ERROR) {
@ -320,11 +320,11 @@ bool Update::startBootloader() const {
int nTry = 5; int nTry = 5;
while (--nTry >= 0) { while (--nTry >= 0) {
m_hw->bl_startBL(); m_hw->bl_startBL();
std::this_thread::sleep_for(std::chrono::milliseconds(500)); QThread::msleep(5000);
m_hw->bl_checkBL(); m_hw->bl_checkBL();
if (m_hw->bl_isUp()) { if (m_hw->bl_isUp()) {
qInfo() << "starting bootloader...OK"; qInfo() << "starting bootloader...OK";
std::this_thread::sleep_for(std::chrono::milliseconds(500)); QThread::msleep(5000);
return true; return true;
} else { } else {
qCritical() << "bootloader not up (" << nTry << ")"; qCritical() << "bootloader not up (" << nTry << ")";
@ -339,7 +339,7 @@ bool Update::stopBootloader() const {
int nTry = 5; int nTry = 5;
while (--nTry >= 0) { while (--nTry >= 0) {
m_hw->bl_stopBL(); m_hw->bl_stopBL();
std::this_thread::sleep_for(std::chrono::milliseconds(500)); QThread::msleep(500);
if (!m_hw->bl_isUp()) { if (!m_hw->bl_isUp()) {
qInfo() << "stopping bootloader...OK"; qInfo() << "stopping bootloader...OK";
return true; return true;
@ -368,7 +368,7 @@ bool Update::resetDeviceController() const {
qDebug() << "resetting device controller..."; qDebug() << "resetting device controller...";
m_hw->bl_rebootDC(); m_hw->bl_rebootDC();
// wait maximally 3 seconds, before starting bootloader // wait maximally 3 seconds, before starting bootloader
QThread::msleep(1500); QThread::sleep(1);
qInfo() << "resetting device controller...OK"; qInfo() << "resetting device controller...OK";
return true; return true;
} }