Browse Source

GCS_MAVLink: fixed a ftp duplicate reply

this fixes a bug in burst replies where the duplicate reply may have
the wrong offset. This causes the "paramftp bad type" error
zr-v5.1
Andrew Tridgell 5 years ago
parent
commit
fc28cd4fa2
  1. 12
      libraries/GCS_MAVLink/GCS_FTP.cpp

12
libraries/GCS_MAVLink/GCS_FTP.cpp

@ -168,6 +168,8 @@ void GCS_MAVLINK::ftp_worker(void) { @@ -168,6 +168,8 @@ void GCS_MAVLINK::ftp_worker(void) {
reply.session = -1; // flag the reply as invalid for any reuse
while (true) {
bool skip_push_reply = false;
while (!ftp.requests->pop(request)) {
// nothing to handle, delay ourselves a bit then check again. Ideally we'd use conditional waits here
hal.scheduler->delay(2);
@ -527,6 +529,11 @@ void GCS_MAVLINK::ftp_worker(void) { @@ -527,6 +529,11 @@ void GCS_MAVLINK::ftp_worker(void) {
reply.seq_number++;
}
if (reply.opcode != FTP_OP::Nack) {
// prevent a duplicate packet send for
// normal replies of burst reads
skip_push_reply = true;
}
break;
}
case FTP_OP::TruncateFile:
@ -539,7 +546,10 @@ void GCS_MAVLINK::ftp_worker(void) { @@ -539,7 +546,10 @@ void GCS_MAVLINK::ftp_worker(void) {
}
}
ftp_push_replies(reply);
if (!skip_push_reply) {
ftp_push_replies(reply);
}
continue;
}
}

Loading…
Cancel
Save