Skip to content

Commit 2034934

Browse files
committed
qt: added bad block notification handling for write command
1 parent 8233402 commit 2034934

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

qt/programmer.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,7 @@ int Programmer::writeChip(uint8_t *buf, uint32_t addr, uint32_t len)
305305
WriteDataCmd *writeDataCmd;
306306
WriteEndCmd *writeEndCmd;
307307
RespHeader *status;
308+
RespBadBlock *badBlock;
308309
int ret;
309310

310311
writeStartCmd = (WriteStartCmd *)cdc_buf;
@@ -400,11 +401,15 @@ int Programmer::writeChip(uint8_t *buf, uint32_t addr, uint32_t len)
400401
return -1;
401402
}
402403

403-
if (status->info == STATUS_ERROR)
404+
if (status->info == STATUS_BAD_BLOCK)
404405
{
405-
qCritical() << "Programmer failed to write data.";
406-
return -1;
406+
badBlock = (RespBadBlock *)cdc_buf;
407+
qInfo() << "Bad block at" << QString("0x%1").
408+
arg(badBlock->addr, 8, 16, QLatin1Char( '0' ));
407409
}
410+
else
411+
return handleStatus(status);
412+
408413
}
409414
}
410415

0 commit comments

Comments
 (0)