Fixed sending to less blocks
This commit is contained in:
parent
defe492ec6
commit
8f7d4a203d
@ -188,7 +188,7 @@ hwapi::DownloadResult hwapi::sendNextAddress(int bNum) const {
|
||||
qDebug() << "addr-block" << bNum << "...";
|
||||
while (noAnswerCount <= 250) {
|
||||
bl_sendAddress(bNum);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||
DownloadResult const res = sendStatus(bl_wasSendingAddOK());
|
||||
if (res != DownloadResult::NOP) {
|
||||
if (res == DownloadResult::ERROR) {
|
||||
@ -246,24 +246,24 @@ hwinf::DownloadResult hwapi::sendNextDataBlock(QByteArray const &binary,
|
||||
}
|
||||
|
||||
hwinf::DownloadResult hwapi::dc_downloadBinary(QByteArray const &b) const {
|
||||
|
||||
int const nBlocks = (((b.size())%64)==0) ? (b.size()/64) : (b.size()/64)+1;
|
||||
|
||||
qInfo() << "total number of bytes to send to dc" << b.size();
|
||||
qInfo() << "total number of blocks to send to dc" << nBlocks;
|
||||
|
||||
for (int blockNumber = 0; blockNumber < nBlocks; ++blockNumber) {
|
||||
DownloadResult res = sendNextAddress(blockNumber);
|
||||
if (res == DownloadResult::NOP) { // no address had to be
|
||||
res = sendNextDataBlock(b, blockNumber); // sent, so send next block
|
||||
} // as data block
|
||||
if (res != DownloadResult::OK) {
|
||||
return res;
|
||||
int bNum = 0;
|
||||
DownloadResult res = DownloadResult::OK;
|
||||
while (res != DownloadResult::ERROR && bNum < nBlocks) {
|
||||
if ((res = sendNextAddress(bNum)) != DownloadResult::ERROR) {
|
||||
if ((res = sendNextDataBlock(b, bNum)) != DownloadResult::ERROR) {
|
||||
bNum += 1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (res != DownloadResult::ERROR) {
|
||||
bl_sendLastBlock();
|
||||
return DownloadResult::OK;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
bool hwapi::startBootloader() const {
|
||||
@ -2960,7 +2960,6 @@ void hwapi::bl_sendLastBlock(void) const
|
||||
|
||||
len=dcBL_writeLastPage(buf);
|
||||
sendWRcmd_setSendBlock160(len, buf);
|
||||
|
||||
}
|
||||
|
||||
uint8_t hwapi::bl_wasSendingDataOK(void) const
|
||||
|
Loading…
Reference in New Issue
Block a user