Skip to content

Conversation

amilcarlucas
Copy link
Collaborator

No description provided.

@Copilot Copilot AI review requested due to automatic review settings September 23, 2025 23:23
Copy link
Contributor

@Copilot 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 improves the robustness of MAVFTP operations on STM32 F4 processors by implementing increased timeouts, retry mechanisms, and optimized settings for better reliability under workload conditions.

Key changes:

  • Added increased timeout for ResetSessions operation from default 5s to 10s
  • Implemented robust MAVFTP settings with reduced burst sizes and increased retry times
  • Added retry logic with progressive timeout increases for parameter downloads

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
ardupilot_methodic_configurator/backend_mavftp.py Increased ResetSessions timeout to 10 seconds for better F4 processor compatibility
ardupilot_methodic_configurator/backend_flightcontroller.py Added robust MAVFTP settings helper method, retry logic for parameter downloads, and applied robust settings to all MAVFTP operations

Comment on lines +660 to +662
Returns:
MAVFTPSettings: Configured settings with increased timeouts and reduced burst sizes
Copy link
Preview

Copilot AI Sep 23, 2025

Choose a reason for hiding this comment

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

The docstring should specify what makes these settings 'robust' and explain the rationale behind the specific parameter values chosen for F4 processors.

Suggested change
Returns:
MAVFTPSettings: Configured settings with increased timeouts and reduced burst sizes
These settings are considered 'robust' because they are specifically tuned to address the limitations and reliability issues
observed with STM32 F4 flight controllers when performing MAVFTP operations under heavy load. F4 processors have limited
memory and processing power, and can be sensitive to communication bursts and timeouts. The chosen parameter values aim to:
- Reduce burst sizes (burst_read_size, write_size) to prevent overwhelming the controller and to improve stability.
- Lower max_backlog and write_qsize to minimize resource contention and avoid buffer overruns.
- Increase idle_detection_time, read_retry_time, and retry_time to allow more time for the controller to respond, reducing
the likelihood of failed transfers due to transient delays.
- Set packet loss parameters to zero to avoid unnecessary retransmissions, as F4 controllers typically operate in low-loss environments.
These values were determined empirically to maximize reliability and minimize transfer errors during MAVFTP operations on F4 hardware.
Returns:
MAVFTPSettings: Configured settings with increased timeouts and reduced burst sizes for improved reliability on F4 controllers.

Copilot uses AI. Check for mistakes.

]
)

def _download_params_via_mavftp( # pylint: disable=too-many-locals
Copy link
Preview

Copilot AI Sep 23, 2025

Choose a reason for hiding this comment

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

The pylint disable comment indicates high complexity. Consider refactoring the retry logic into a separate helper method to reduce the number of local variables.

Copilot uses AI. Check for mistakes.

else:
logging_error(_("All %d parameter download attempts failed"), max_retries)

except Exception as e: # pylint: disable=broad-exception-caught
Copy link
Preview

Copilot AI Sep 23, 2025

Choose a reason for hiding this comment

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

Catching broad exceptions can mask specific errors. Consider catching more specific exceptions like MAVFTPException or timeout-related exceptions instead of using a bare except.

Copilot uses AI. Check for mistakes.

Copy link
Contributor

Test Results

    2 files  ±0      2 suites  ±0   1m 35s ⏱️ +3s
1 743 tests ±0  1 742 ✅ ±0  1 💤 ±0  0 ❌ ±0 
3 486 runs  ±0  3 484 ✅ ±0  2 💤 ±0  0 ❌ ±0 

Results for commit 020a4d4. ± Comparison against base commit d225757.

Copy link
Contributor

☂️ Python Coverage

current status: ✅

Overall Coverage

Lines Covered Coverage Threshold Status
8078 6292 78% 73% 🟢

New Files

No new covered files...

Modified Files

File Coverage Status
ardupilot_methodic_configurator/backend_flightcontroller.py 34% 🟢
TOTAL 34% 🟢

updated for commit: 020a4d4 by action🐍

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.

1 participant