From a0d0de19c5ddcf56aa2d1cd49799ac28edbb40ec Mon Sep 17 00:00:00 2001 From: Gerhard Hoffmann Date: Thu, 6 Jul 2023 14:24:19 +0200 Subject: [PATCH] Use QThread::sleep() instead of std-C++-code. --- update.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/update.cpp b/update.cpp index 8b520cb..f8cf320 100644 --- a/update.cpp +++ b/update.cpp @@ -216,7 +216,7 @@ Update::DownloadResult Update::sendNextAddress(int bNum) const { qDebug() << "addr-block" << bNum << "..."; while (noAnswerCount <= 250) { 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()); if (res != DownloadResult::NOP) { if (res == DownloadResult::ERROR) { @@ -320,11 +320,11 @@ bool Update::startBootloader() const { int nTry = 5; while (--nTry >= 0) { m_hw->bl_startBL(); - std::this_thread::sleep_for(std::chrono::milliseconds(500)); + QThread::msleep(5000); m_hw->bl_checkBL(); if (m_hw->bl_isUp()) { qInfo() << "starting bootloader...OK"; - std::this_thread::sleep_for(std::chrono::milliseconds(500)); + QThread::msleep(5000); return true; } else { qCritical() << "bootloader not up (" << nTry << ")"; @@ -339,7 +339,7 @@ bool Update::stopBootloader() const { int nTry = 5; while (--nTry >= 0) { m_hw->bl_stopBL(); - std::this_thread::sleep_for(std::chrono::milliseconds(500)); + QThread::msleep(500); if (!m_hw->bl_isUp()) { qInfo() << "stopping bootloader...OK"; return true; @@ -368,7 +368,7 @@ bool Update::resetDeviceController() const { qDebug() << "resetting device controller..."; m_hw->bl_rebootDC(); // wait maximally 3 seconds, before starting bootloader - QThread::msleep(1500); + QThread::sleep(1); qInfo() << "resetting device controller...OK"; return true; }