Comment some lines.
This commit is contained in:
		
							
								
								
									
										35
									
								
								update.cpp
									
									
									
									
									
								
							
							
						
						
									
										35
									
								
								update.cpp
									
									
									
									
									
								
							@@ -8,6 +8,10 @@
 | 
			
		||||
#include <QTextStream>
 | 
			
		||||
#include <QRegularExpression>
 | 
			
		||||
 | 
			
		||||
//#include <iostream>
 | 
			
		||||
//#include <fstream>
 | 
			
		||||
//#include <ctime>
 | 
			
		||||
 | 
			
		||||
#include "plugins/interfaces.h"
 | 
			
		||||
 | 
			
		||||
#include <QSharedMemory>
 | 
			
		||||
@@ -238,16 +242,12 @@ Update::DownloadResult Update::sendNextDataBlock(QByteArray const &binary,
 | 
			
		||||
    memcpy(local, binary.constData() + bAddr, 64);
 | 
			
		||||
    local[64] = local[65] = 0x00;
 | 
			
		||||
 | 
			
		||||
    //for (int i=0; i<4; ++i) {
 | 
			
		||||
    //    printf("%04d ", bNum);
 | 
			
		||||
    //    for (int j=0; j < 16; ++j) {
 | 
			
		||||
    //        printf("%02x ", local[i*16 + j]);
 | 
			
		||||
    //    } printf("\n");
 | 
			
		||||
    //}
 | 
			
		||||
    // QByteArray b((const char *)(&local[0]), 64);
 | 
			
		||||
    // qCritical() << "SNDB" << bNum << b.size() << b.toHex();
 | 
			
		||||
 | 
			
		||||
    while (noAnswerCount <= 250) {
 | 
			
		||||
        m_hw->bl_sendDataBlock(64, local);
 | 
			
		||||
        std::this_thread::sleep_for(std::chrono::milliseconds(10));
 | 
			
		||||
        QThread::msleep(10);
 | 
			
		||||
        DownloadResult const res = sendStatus(m_hw->bl_wasSendingDataOK());
 | 
			
		||||
        if (res != DownloadResult::NOP) {
 | 
			
		||||
            if (res == DownloadResult::ERROR) {
 | 
			
		||||
@@ -256,7 +256,7 @@ Update::DownloadResult Update::sendNextDataBlock(QByteArray const &binary,
 | 
			
		||||
                    return res;
 | 
			
		||||
                }
 | 
			
		||||
            } else {
 | 
			
		||||
                qInfo() << "data for block" << bNum << "OK";
 | 
			
		||||
                // qInfo() << "data for block" << bNum << "OK";
 | 
			
		||||
                return res;
 | 
			
		||||
            }
 | 
			
		||||
        } else {
 | 
			
		||||
@@ -803,21 +803,12 @@ bool Update::finishUpdate(bool swapCtrlFiles) {
 | 
			
		||||
        m_update_ctrl_file.close();
 | 
			
		||||
        m_update_ctrl_file_copy.close();
 | 
			
		||||
 | 
			
		||||
        QString const &fn = m_update_ctrl_file.fileName();
 | 
			
		||||
        QString const &fn_tmp = m_update_ctrl_file.fileName() + ".tmp";
 | 
			
		||||
        QString const &fn_copy = m_update_ctrl_file_copy.fileName();
 | 
			
		||||
        QFile tmp(fn_tmp);
 | 
			
		||||
        //std::ifstream source(m_update_ctrl_file_copy.fileName().toStdString().c_str(), std::ios::binary);
 | 
			
		||||
        //std::ofstream dest(m_update_ctrl_file.fileName().toStdString().c_str(), std::ios::binary);
 | 
			
		||||
 | 
			
		||||
        if (tmp.exists()) {
 | 
			
		||||
            tmp.remove();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (m_update_ctrl_file.rename(fn_tmp)) {
 | 
			
		||||
            if (m_update_ctrl_file_copy.rename(fn)) {
 | 
			
		||||
                return m_update_ctrl_file.rename(fn_copy);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return false;
 | 
			
		||||
        //dest << source.rdbuf();
 | 
			
		||||
        //source.close();
 | 
			
		||||
        //dest.close();
 | 
			
		||||
    }
 | 
			
		||||
    return true;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user