Use QThread::sleep() instead of std-C++-code.
This commit is contained in:
		
							
								
								
									
										10
									
								
								update.cpp
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								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;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user