Joystick: add named profile presets#3707
Open
HubMan17 wants to merge 1 commit intoArduPilot:masterfrom
Open
Conversation
Adds a profile manager on top of ExportConfig/ImportConfig from ArduPilot#3656. JoystickSetup gets a profile row (dropdown, Create, Delete). Profiles are stored as .joycfg files in Documents/Mission Planner/joystick_profiles/. Existing joystick XMLs are migrated to a Default profile on first run. The Default profile cannot be deleted from the UI. Switching reloads the form in place; deleting the active profile auto-switches to the first remaining one. Hardens the existing Export/Import: - ExportConfig writes to .tmp and then atomically replaces the target, so a killed process cannot leave a corrupt .joycfg. - loadconfig logs XML deserialization errors via log4net instead of silently swallowing them.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a named profile manager on top of the
ExportConfig/ImportConfigmethods that landed in #3656. Users can save the current joystick configuration under a name, switch between profiles, and import/export profiles as.joycfgfiles for sharing.UI
A new row appears in
JoystickSetup, below the device combo:The existing Export and Import buttons are kept and now operate on the active profile (Export saves the active profile to a chosen path; Import asks for a name and registers the file as a new profile). Switching profiles from the dropdown reloads the form in place, no window close/reopen.
Storage
Profiles are stored as
.joycfgfiles in:The
.joycfgformat from #3656 is reused as-is. The active profile name is persisted inSettingsunder the keyJoystickActiveProfile.Migration
On first run with existing
joystickbutton*.xml/joystickaxis*.xmlin the user data directory, those files are packaged into a profile namedDefaultand set as active. The Default profile cannot be deleted from the UI.Hardening of existing Export/Import
While in the area, two safety fixes:
ExportConfignow writes to<name>.tmpand then atomically replaces the target file. A killed process can no longer leave a half-written.joycfg.loadconfignow logs XML deserialization failures via log4net instead of swallowing them in an emptycatch.Files
ExtLibs/ArduPilot/Joystick/JoystickProfileManager.cs(new)ExtLibs/ArduPilot/Joystick/JoystickBase.csJoystick/JoystickSetup.csJoystick/JoystickSetup.Designer.csOut of scope
.joycfgformat (kept compatible with Joystick import export config #3656)Testing
.joycfgfilesJoystickActiveProfilein Settings (e.g. profile deleted between sessions) falls back to the first available profile viaEnsureDefault