turn dc-download on
This commit is contained in:
parent
8d5831286d
commit
f5611cf826
@ -189,7 +189,7 @@ int main(int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Update u(fi.absoluteFilePath(), libca, debug, noaction);
|
Update u(fi.absoluteFilePath(), libca, debug, noaction);
|
||||||
u.run();
|
// u.run();
|
||||||
|
|
||||||
qInfo() << "<DC-UPDATE-FINISH>";
|
qInfo() << "<DC-UPDATE-FINISH>";
|
||||||
|
|
||||||
|
@ -130,16 +130,11 @@ Update::sendNextAddress(int bNum) const {
|
|||||||
if ( bNum==0 || bNum==1024 || bNum==2048 || bNum==3072 || bNum==4096 ) {
|
if ( bNum==0 || bNum==1024 || bNum==2048 || bNum==3072 || bNum==4096 ) {
|
||||||
// qDebug() << "addr-block" << bNum << "...";
|
// qDebug() << "addr-block" << bNum << "...";
|
||||||
while (noAnswerCount <= 250) {
|
while (noAnswerCount <= 250) {
|
||||||
// TODO
|
m_hw->bl_sendAddress(bNum);
|
||||||
// m_hw->bl_sendAddress(bNum);
|
|
||||||
|
|
||||||
QThread::msleep(100);
|
QThread::msleep(100);
|
||||||
|
|
||||||
// TODO
|
DownloadResult const res = sendStatus(m_hw->bl_wasSendingAddOK());
|
||||||
// DownloadResult const res = sendStatus(m_hw->bl_wasSendingAddOK());
|
|
||||||
|
|
||||||
DownloadResult const res = DownloadResult::OK;
|
|
||||||
|
|
||||||
if (res != DownloadResult::NOP) {
|
if (res != DownloadResult::NOP) {
|
||||||
if (res == DownloadResult::ERROR) {
|
if (res == DownloadResult::ERROR) {
|
||||||
if (++errorCount >= 10) {
|
if (++errorCount >= 10) {
|
||||||
@ -179,20 +174,14 @@ Update::sendNextDataBlock(QByteArray const &binary, int bNum) const {
|
|||||||
qInfo() << s.toUtf8().constData();
|
qInfo() << s.toUtf8().constData();
|
||||||
|
|
||||||
QThread::msleep(200);
|
QThread::msleep(200);
|
||||||
return DownloadResult::OK;
|
|
||||||
|
|
||||||
// QByteArray b((const char *)(&local[0]), 64);
|
QByteArray b((const char *)(&local[0]), 64);
|
||||||
// qCritical() << "SNDB" << bNum << b.size() << b.toHex();
|
qCritical() << "SNDB" << bNum << b.size() << b.toHex();
|
||||||
|
|
||||||
while (noAnswerCount <= 250) {
|
while (noAnswerCount <= 250) {
|
||||||
// TODO
|
m_hw->bl_sendDataBlock(64, local);
|
||||||
// m_hw->bl_sendDataBlock(64, local);
|
|
||||||
|
|
||||||
// TODO
|
|
||||||
// DownloadResult const res = sendStatus(m_hw->bl_wasSendingDataOK());
|
|
||||||
|
|
||||||
DownloadResult const res = DownloadResult::OK;
|
|
||||||
|
|
||||||
|
DownloadResult const res = sendStatus(m_hw->bl_wasSendingDataOK());
|
||||||
if (res != DownloadResult::NOP) {
|
if (res != DownloadResult::NOP) {
|
||||||
if (res == DownloadResult::ERROR) {
|
if (res == DownloadResult::ERROR) {
|
||||||
if (++errorCount >= 10) {
|
if (++errorCount >= 10) {
|
||||||
@ -213,12 +202,13 @@ Update::sendNextDataBlock(QByteArray const &binary, int bNum) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool Update::startBootloader() const {
|
bool Update::startBootloader() const {
|
||||||
|
#if 0
|
||||||
qInfo() << nextTimePoint().toUtf8().constData() << "start boot loader";
|
qInfo() << nextTimePoint().toUtf8().constData() << "start boot loader";
|
||||||
QThread::msleep(1000);
|
QThread::msleep(1000);
|
||||||
qInfo() << nextTimePoint().toUtf8().constData() << "start boot loader ...done";
|
qInfo() << nextTimePoint().toUtf8().constData() << "start boot loader ...done";
|
||||||
return true;
|
return true;
|
||||||
|
#else
|
||||||
|
|
||||||
#if 0
|
|
||||||
int nTry = 5;
|
int nTry = 5;
|
||||||
while (--nTry >= 0) {
|
while (--nTry >= 0) {
|
||||||
m_hw->bl_startBL();
|
m_hw->bl_startBL();
|
||||||
@ -234,16 +224,19 @@ bool Update::startBootloader() const {
|
|||||||
}
|
}
|
||||||
qCritical() << "starting bootloader...FAILED";
|
qCritical() << "starting bootloader...FAILED";
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Update::stopBootloader() const {
|
bool Update::stopBootloader() const {
|
||||||
|
#if 0
|
||||||
qInfo() << nextTimePoint().toUtf8().constData() << "stopping bootloader";
|
qInfo() << nextTimePoint().toUtf8().constData() << "stopping bootloader";
|
||||||
QThread::msleep(1000);
|
QThread::msleep(1000);
|
||||||
qInfo() << nextTimePoint().toUtf8().constData() << "stopping bootloader ...done";
|
qInfo() << nextTimePoint().toUtf8().constData() << "stopping bootloader ...done";
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
#if 0
|
#else
|
||||||
|
|
||||||
qDebug() << "stopping bootloader...";
|
qDebug() << "stopping bootloader...";
|
||||||
int nTry = 5;
|
int nTry = 5;
|
||||||
while (--nTry >= 0) {
|
while (--nTry >= 0) {
|
||||||
@ -256,13 +249,13 @@ bool Update::stopBootloader() const {
|
|||||||
}
|
}
|
||||||
qCritical() << "stopping bootloader...FAILED";
|
qCritical() << "stopping bootloader...FAILED";
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Update::resetDeviceController() const {
|
bool Update::resetDeviceController() const {
|
||||||
qInfo() << nextTimePoint().toUtf8().constData() << "resetting device controller";
|
qInfo() << nextTimePoint().toUtf8().constData() << "resetting device controller";
|
||||||
// TODO
|
m_hw->bl_rebootDC();
|
||||||
// m_hw->bl_rebootDC();
|
|
||||||
|
|
||||||
// wait maximally 3 seconds, before starting bootloader
|
// wait maximally 3 seconds, before starting bootloader
|
||||||
QThread::sleep(1);
|
QThread::sleep(1);
|
||||||
@ -280,12 +273,12 @@ QByteArray Update::loadBinaryDCFile(QString const &filename) const {
|
|||||||
if (!file.exists()) {
|
if (!file.exists()) {
|
||||||
qCritical() << "(" << __func__ << ":" << __LINE__ << ")"
|
qCritical() << "(" << __func__ << ":" << __LINE__ << ")"
|
||||||
<< file.fileName() << "does not exist";
|
<< file.fileName() << "does not exist";
|
||||||
return QByteArray();
|
return QByteArray{};
|
||||||
}
|
}
|
||||||
if (!file.open(QIODevice::ReadOnly)) {
|
if (!file.open(QIODevice::ReadOnly)) {
|
||||||
qCritical() << "(" << __func__ << ":" << __LINE__ << ")"
|
qCritical() << "(" << __func__ << ":" << __LINE__ << ")"
|
||||||
<< "cannot open file" << file.fileName();
|
<< "cannot open file" << file.fileName();
|
||||||
return QByteArray();
|
return QByteArray{};
|
||||||
}
|
}
|
||||||
|
|
||||||
qInfo() << nextTimePoint().toUtf8().constData()
|
qInfo() << nextTimePoint().toUtf8().constData()
|
||||||
@ -392,10 +385,8 @@ int Update::run() {
|
|||||||
|
|
||||||
qInfo() << "DC auto request OFF";
|
qInfo() << "DC auto request OFF";
|
||||||
|
|
||||||
// dennis einzelne linie
|
|
||||||
qCritical() << "start dc-update for" << m_dcFileName << "at" << m_start.toString(Qt::ISODate);
|
qCritical() << "start dc-update for" << m_dcFileName << "at" << m_start.toString(Qt::ISODate);
|
||||||
|
|
||||||
|
|
||||||
QByteArray ba = loadBinaryDCFile(m_dcFileName);
|
QByteArray ba = loadBinaryDCFile(m_dcFileName);
|
||||||
if (ba.size() > 0) {
|
if (ba.size() > 0) {
|
||||||
m_totalBlocks = (((ba.size())%64)==0) ? (ba.size()/64) : (ba.size()/64)+1;
|
m_totalBlocks = (((ba.size())%64)==0) ? (ba.size()/64) : (ba.size()/64)+1;
|
||||||
@ -415,8 +406,6 @@ int Update::run() {
|
|||||||
while (res != DownloadResult::ERROR && currentBlock < m_totalBlocks) {
|
while (res != DownloadResult::ERROR && currentBlock < m_totalBlocks) {
|
||||||
if ((res = sendNextAddress(currentBlock)) != DownloadResult::ERROR) {
|
if ((res = sendNextAddress(currentBlock)) != DownloadResult::ERROR) {
|
||||||
if ((res = sendNextDataBlock(ba, currentBlock)) != DownloadResult::ERROR) {
|
if ((res = sendNextDataBlock(ba, currentBlock)) != DownloadResult::ERROR) {
|
||||||
// TODO
|
|
||||||
// m_hw->dcDownloadSetCurrentBlockNumber(currentBlock);
|
|
||||||
currentBlock += 1;
|
currentBlock += 1;
|
||||||
} else break;
|
} else break;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user