fix: stop multiple-joystick warning from repeatedly stealing control#2799
Open
rafaellehmkuhl wants to merge 1 commit into
Open
fix: stop multiple-joystick warning from repeatedly stealing control#2799rafaellehmkuhl wants to merge 1 commit into
rafaellehmkuhl wants to merge 1 commit into
Conversation
When another GCS was detected sending MANUAL_CONTROL, forwarding was disabled and the warning dialog shown. Because the conflict check ran on every joystick (re)connection, the dialog kept popping up and forwarding kept being disabled, making users lose control of the vehicle on busy test days. Only run the check when forwarding is neither active nor already prevented, and guard against concurrent checks racing to show the dialog more than once.
Automated PR Review (Claude)0. SummaryVerdict: READY TO MERGE This PR fixes a bug where the "Multiple joystick controllers detected" warning dialog kept re-appearing and repeatedly disabling forwarding on every joystick reconnection event, effectively stealing control from users. The fix adds three guard conditions — forwarding already active, forwarding already prevented, or a check already in flight — so the conflict detection runs at most once. The old 1. Correctness & Implementation Bugs — ✅2. AGENTS.md Adherence — ✅3. Security — ✅4. Performance — ✅5. UI / UX — ✅6. Code Quality & Style — ✅7. Commit Hygiene — ✅8. Tests — ✅9. Documentation — ✅10. Nitpicks / Optional — ✅Generated by Claude. This is advisory; a human reviewer must still approve. |
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.
Summary
The "Multiple joystick controllers detected" warning is triggered when Cockpit detects another ground control station sending
MANUAL_CONTROL/RC_CHANNELS_OVERRIDEto the vehicle (checkForOtherManualControlSources), not when two physical gamepads are plugged in. On busy test days with multiple computers/vehicles, that detection trips often.The check ran inside
processJoystickConnectionEvent, which fires on every joystick connect/disconnect (gamepad polling, Bluetooth roaming, etc.). Once another source was detected,enableForwardingwas set tofalse— and since forwarding was now off, the next reconnect re-ran the check, re-disabled forwarding, and re-showed the dialog. That's the reported "popup keeps spawning" + "user loses control" loop. The only workaround was the joystick config view'sonUnmountedhook force-enabling forwarding (the "twiddle the sticks and click out" trick).This PR makes the conflict check run only when forwarding is neither already active nor explicitly prevented, so the joystick already in use keeps control and the dialog is shown at most once.
enableForwardingis already on orpreventJoystickForwardingis set — reconnections no longer re-disable forwarding or re-pop the dialog.checkingForOtherManualControlSourcesin-flight guard so concurrent connection events can't race to show the dialog more than once (the async check can wait up to ~3s).return(which also skipped disconnect cleanup andcurrentMainJoystickrefresh); that logic now runs viacontinue.Test plan
MANUAL_CONTROL: dialog shows once, forwarding disabled.currentMainJoystickupdates correctly.Fixes #2798.