Skip to content

Conversation

@OmkarSarkar204
Copy link
Contributor

Description

Fixes #1108
Resolves the issue where manually entered connection strings (e.g., udp:0.0.0.0:14560) were lost after restarting the application.

Changes

  1. Backend (backend_filesystem_program_settings.py):

    • Added connection_history list to the default settings.
    • Implemented get_connection_history() and store_connection() to save/load strings from settings.json.
    • Added logic to deduplicate entries and keep the list sorted by most recent use (capped at 10 items).
  2. Frontend (frontend_tkinter_connection_selection.py):

    • Updated __init__ to load historical connections into the dropdown on startup.
    • Updated add_connection to save the new string immediately upon user addition.

Testing

  • Verified that adding a custom UDP connection saves it to %APPDATA%\.ardupilot_methodic_configurator\settings.json.
  • Verified that the connection appears in the dropdown list after fully closing and restarting the application.

@OmkarSarkar204 OmkarSarkar204 force-pushed the feature/save-connection-history branch from 7ba4277 to 77f2221 Compare January 6, 2026 14:23
Copy link
Collaborator

@amilcarlucas amilcarlucas left a comment

Choose a reason for hiding this comment

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

Nice, thanks. Can you please follow pytest_testing_guidelines.md and add high-level BDD tests to the code you added?

@OmkarSarkar204 OmkarSarkar204 force-pushed the feature/save-connection-history branch 2 times, most recently from 18ad507 to 0a7f499 Compare January 6, 2026 16:32
@OmkarSarkar204
Copy link
Contributor Author

sure ill start working on it

@OmkarSarkar204 OmkarSarkar204 force-pushed the feature/save-connection-history branch 4 times, most recently from 4b9c0f4 to 5983593 Compare January 6, 2026 18:05
@OmkarSarkar204
Copy link
Contributor Author

OmkarSarkar204 commented Jan 6, 2026

Hi @amilcarlucas , I've added the BDD test for the connection saving logic as requested.

P.S. I spotted a typo in the pytest_testing_instructions.md (ruff formal instead of ruff format) and fixed it while I was in there. Let me know if everything looks good!

@OmkarSarkar204 OmkarSarkar204 force-pushed the feature/save-connection-history branch 2 times, most recently from 0136ad1 to a553bee Compare January 6, 2026 18:23
@amilcarlucas amilcarlucas added the enhancement New feature or request label Jan 7, 2026
Copy link
Collaborator

@amilcarlucas amilcarlucas left a comment

Choose a reason for hiding this comment

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

Nice clean PR. Thanks

@OmkarSarkar204 OmkarSarkar204 force-pushed the feature/save-connection-history branch from a553bee to 32fa1d2 Compare January 7, 2026 17:59
@OmkarSarkar204
Copy link
Contributor Author

Thanks! I've removed the comment, removed the file and updated the test file as requested.

amilcarlucas
amilcarlucas previously approved these changes Jan 7, 2026
@OmkarSarkar204
Copy link
Contributor Author

OmkarSarkar204 commented Jan 7, 2026

I noticed the CI failed on a Pylint error redefined-outer-name, so I pushed a fix. Passing locally now.

Could you please approve the workflows to run again? Thanks!

@amilcarlucas amilcarlucas force-pushed the feature/save-connection-history branch from 88d76e0 to e294d96 Compare January 7, 2026 19:39
@amilcarlucas
Copy link
Collaborator

Excelent. I added a commit on top with some fixes. can you sign-off your commit, and leave mine untouched?

@amilcarlucas amilcarlucas requested a review from Copilot January 7, 2026 19:45
@OmkarSarkar204 OmkarSarkar204 force-pushed the feature/save-connection-history branch from e294d96 to ee9f219 Compare January 7, 2026 19:55
@OmkarSarkar204
Copy link
Contributor Author

OmkarSarkar204 commented Jan 7, 2026

Excelent. I added a commit on top with some fixes. can you sign-off your commit, and leave mine untouched?

Done! I signed-off my commit.

Copy link
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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copy link
Collaborator

@amilcarlucas amilcarlucas left a comment

Choose a reason for hiding this comment

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

All looks good now. Will merge once all CI tests pass. Thanks for contributing

@OmkarSarkar204
Copy link
Contributor Author

All looks good now. Will merge once all CI tests pass. Thanks for contributing

Thank you so much for your patience and for guiding me through this process! This was my first significant open-source contribution, so I learned a lot.
If you have any specific advice on how I can improve my workflow for the next PR, I'd love to hear it. Thanks again!

@amilcarlucas
Copy link
Collaborator

@amilcarlucas
Copy link
Collaborator

The best workflow is "Test-Driven-Development" (TDD) and writing high-level tests instead of unit tests.

@amilcarlucas amilcarlucas merged commit edfaa48 into ArduPilot:master Jan 7, 2026
20 of 21 checks passed
Copy link
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

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

expected_result["annotate_docs_into_param_files"] = False # Added by default
expected_result["gui_complexity"] = "simple" # Added by default
expected_result["motor_test"] = {"duration": 2, "throttle_pct": 10} # Added by default
expected_result["connection_history"] = [] # Added for port connection string to save
Copy link

Copilot AI Jan 7, 2026

Choose a reason for hiding this comment

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

The comment is grammatically unclear. Consider rephrasing to: "Added to store connection string history" or "Added for saving port connection strings" for better clarity.

Suggested change
expected_result["connection_history"] = [] # Added for port connection string to save
expected_result["connection_history"] = [] # Added to store connection string history

Copilot uses AI. Check for mistakes.
@OmkarSarkar204
Copy link
Contributor Author

The best workflow is "Test-Driven-Development" (TDD) and writing high-level tests instead of unit tests.

Understood! I will definitely adopt the advice for my next contribution. I’ve saved the Contributing guide to study as well.
I have university exams starting next week, so I will be inactive for a short while. I plan to return in late January to pick up a bug fix and apply this workflow. Thanks again for the mentorship!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

New connection option not saved after restart

2 participants