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:
commit
4966a45ebf
@ -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";
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user