Skip to content

Fix MAVFTP file transfers on slow telemetry links#1334

Merged
amilcarlucas merged 1 commit intomasterfrom
MAVFTP_fixes
Feb 27, 2026
Merged

Fix MAVFTP file transfers on slow telemetry links#1334
amilcarlucas merged 1 commit intomasterfrom
MAVFTP_fixes

Conversation

@amilcarlucas
Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings February 27, 2026 17:07
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses file transfer issues on slow telemetry links by modifying the burst read handling logic in the MAVFTP implementation. The changes focus on improving the control flow when processing burst read acknowledgments and errors.

Changes:

  • Modified the burst read continuation logic to return success immediately after sending more data
  • Changed the conditional structure from elif to if for Nack handling to allow both Ack and Nack paths to be evaluated
  • Simplified error logging by removing duplicate error handling paths

self.__send(more)
elif op.opcode == OP_Nack:
return MAVFTPReturn("BurstReadFile", ERR_None)
if op.opcode == OP_Nack:
Copy link

Copilot AI Feb 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing from elif to if creates a logic error. The code now returns success (line 694) when handling OP_Ack, but then immediately continues to check if op.opcode == OP_Nack (line 695). Since the function has already returned, the Nack check becomes unreachable code. The original elif structure was correct - after handling OP_Ack, the function should not check for OP_Nack on the same operation.

Suggested change
if op.opcode == OP_Nack:
elif op.opcode == OP_Nack:

Copilot uses AI. Check for mistakes.
Comment on lines 711 to +712
if self.ftp_settings.debug > 0:
logging.error("FTP: burst nack: %s", op)
return MAVFTPReturn("BurstReadFile", ERR_Fail)
logging.info("FTP: burst Nack (ecode:%u): %s", ecode, op)
Copy link

Copilot AI Feb 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After removing the return statement that was inside the elif block on the original line 713, the function now continues execution after logging this Nack message, eventually reaching line 715 which returns MAVFTPReturn("BurstReadFile", ERR_Fail). However, for EOF and ecode==0 cases (lines 697-710), the code has specific handling logic that may or may not return. This unconditional log at line 712 will now execute for all Nack cases that don't return early, which may not be the intended behavior. The removed duplicate error handling (original lines 711-714) suggests there was supposed to be different handling for different error codes.

Copilot uses AI. Check for mistakes.
@github-actions
Copy link
Copy Markdown
Contributor

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
11504 10474 91% 89% 🟢

New Files

No new covered files...

Modified Files

No covered modified files...

updated for commit: 86aa364 by action🐍

@github-actions
Copy link
Copy Markdown
Contributor

Test Results

    2 files  ±0      2 suites  ±0   28m 0s ⏱️ -56s
3 014 tests ±0  3 009 ✅ ±0   5 💤 ±0  0 ❌ ±0 
6 028 runs  ±0  6 018 ✅ ±0  10 💤 ±0  0 ❌ ±0 

Results for commit 86aa364. ± Comparison against base commit 549cf02.

@amilcarlucas amilcarlucas merged commit 8f44634 into master Feb 27, 2026
36 checks passed
@amilcarlucas amilcarlucas deleted the MAVFTP_fixes branch February 27, 2026 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants