feat(manager): auto-compact player numbers after a pad stays off#8
Merged
Merged
Conversation
A pad switched off past the removal grace left a permanent hole in the player numbering (e.g. 1, 3, 4) — remaining pads kept their numbers on both the tray labels and the white player LEDs, and nothing ever closed the gap. Compact the connected pads to a contiguous 1..N, order-preserving so no two continuously-connected pads swap places, once a hole has stood for COMPACT_GRACE (5 min). The window is sized for a battery/accu swap: a pad that returns within it reclaims its old number and no renumber happens; only a pad that stays off past it gives up its slot. The absent pad's stale _players reservation is left untouched — a later return finds its old number worn by a lower-numbered peer and takes the next free one, so a reclaim never reopens a closed hole. A tray entry, "Renumber players", forces the compaction immediately and is shown only while a hole exists.
NicolasPogorzelski
force-pushed
the
feat/player-renumber-compaction
branch
from
July 15, 2026 07:22
dae1b08 to
9342b81
Compare
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
When a pad is switched off long enough to be dropped, its number left a permanent hole in the player numbering (e.g. 1, 3, 4) — remaining pads kept their numbers on both the tray labels and the white player LEDs, and nothing ever closed the gap.
This compacts the connected pads to a contiguous 1..N, order-preserving so no two continuously-connected pads swap places and nobody overtakes anybody:
COMPACT_GRACE(5 min). The window is sized for a battery/accu swap: a pad that returns within it reclaims its old number and no renumber happens; only a pad that stays off past it gives up its slot.The absent pad's stale
_playersreservation is left untouched — a later return finds its old number worn by a lower-numbered peer and takes the next free one, so a reclaim never reopens a closed hole.Design
Timer lives in the existing 2 s monitor (
_poll) via a_compact_duedeadline — no new thread, no GLib timer, no GUI toolkit. Discussed and chosen with the maintainer: order-preserving compaction, 5-minute grace, timer + manual tray entry.Tests & docs
tests/test_multi_pad.py: auto-compaction after the timer, battery-swap reclaim within the window (no renumber), manual renumber order-preserving, and the tray entry appearing/routing only on a gap.docs/decisions/player-leds.mdandrunbooks/verify-multi-controller.md.Verified live: manual renumber via the tray works; player LEDs and tray follow.