Skip to content

Refactor: footswitch init and add tests#143

Merged
rreichenbach merged 8 commits into
TreeFallSound:pistomp-v3from
sastraxi:refactor/footswitch-init
May 21, 2026
Merged

Refactor: footswitch init and add tests#143
rreichenbach merged 8 commits into
TreeFallSound:pistomp-v3from
sastraxi:refactor/footswitch-init

Conversation

@sastraxi
Copy link
Copy Markdown
Contributor

@sastraxi sastraxi commented May 12, 2026

Renames Footswitch.enabled to toggled throughout the codebase. The old name was misleading as it tracked the toggle state of the switch (on/off), not whether the switch itself was enabled.

Disambiguating this frees us up to do the following:

  • disable: true already suppresses a footswitch for a given pedalboard; we now save its current value in the Footswitch object
  • longpress on an encoder now works the same way it already did on footswitches — pedalboard config can override the default callback, and an explicit null clears it. Required threading encoder GPIO switches through a new encoder_switch_map keyed by config id, populated by pistomptre at init.

Tests in tests/v3/test_hardware_config.py cover both the existing footswitch overlay behaviour (longpress set/override/reset/suppress, color persistence) and the new encoder + disable paths.

The pistompcore encoder init still hardcodes a single switch; added a brief XXX comment about it.

Copy link
Copy Markdown
Collaborator

@rreichenbach rreichenbach left a comment

Choose a reason for hiding this comment

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

This looks good and seems to work well.

@rreichenbach rreichenbach merged commit 5a4551b into TreeFallSound:pistomp-v3 May 21, 2026
1 check passed
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.

2 participants