Comment some lines.

This commit is contained in:
Gerhard Hoffmann 2023-07-06 14:21:29 +02:00
parent 26557542f1
commit f2556412d8

View File

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