1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-03-15 07:29:15 +01:00

Merged in physicsboy0709/librepilot (pull request #76) LP-143

modified:   ground/gcs/src/plugins/uploader/op_dfu.cpp modified:   ground/gcs/src/plugins/uploader/op_dfu.h
This commit is contained in:
Alessio Morale 2015-10-09 09:39:41 +02:00
commit 4966a45ebf

View File

@ -575,6 +575,19 @@ OP_DFU::Status DFUObject::StatusRequest()
buf[9] = 0;
int result = sendData(buf, BUF_LEN);
int retry_cnt = 0;
const int MaxSendRetry = 10, SendRetryIntervalMS = 1000;
while (result < 0 && retry_cnt < MaxSendRetry) {
retry_cnt++;
qWarning() << "StatusRequest failed, sleeping" << SendRetryIntervalMS << "ms";
delay::msleep(SendRetryIntervalMS);
qWarning() << "StatusRequest retry attempt" << retry_cnt;
result = sendData(buf, BUF_LEN);
}
if (retry_cnt >= MaxSendRetry) {
qWarning() << "StatusRequest failed too many times, aborting";
return OP_DFU::abort;
}
if (debug) {
qDebug() << "StatusRequest: " << result << " bytes sent";
}