mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-03-15 07:29:15 +01:00
modified: ground/gcs/src/plugins/uploader/op_dfu.cpp
This commit is contained in:
parent
1ea729ecc6
commit
5f9f298a1d
@ -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