Skip to content

Fix random-mode toggle when altdomestick=1 is active#68

Merged
thePunderWoman merged 1 commit intomainfrom
fix/random-toggle-alt-button
Apr 24, 2026
Merged

Fix random-mode toggle when altdomestick=1 is active#68
thePunderWoman merged 1 commit intomainfrom
fix/random-toggle-alt-button

Conversation

@thePunderWoman
Copy link
Copy Markdown
Owner

Summary

  • When the alt button is held with altdomestick=1, enableAbsoluteStickMode() was overwriting fState even when the dome was in random mode. This caused toggleRandomMode() to see isRandomMode()==false and call enableRandomMode() instead of disableRandomMode(), so the toggle always turned random on and never off.
  • Fixed by skipping abs-stick engage when isRandomMode() is true — keeps fState as kStateRandom while alt is held so the toggle check works correctly.
  • Also added save/restore of fState across abs-stick engage/disengage as a general improvement (preserves any other active state, e.g. kStateGoToAngle).
  • Updates example_config.txt to move the random-toggle action from lb=5 (long-press) to ab=5 (alt-press).

Test plan

  • With altdomestick=1 and ab=5,9,0: toggle random mode on, then hold alt and press button 5 — random mode should turn off
  • Toggle random mode off, hold alt and press button 5 — random mode should turn on
  • With random mode active, holding alt should no longer briefly engage abs-stick mode
  • With random mode off, holding alt should still engage abs-stick mode as normal
  • pio test -e native passes (409/409)
  • pio run succeeds

🤖 Generated with Claude Code

When alt is held with altdomestick=1, enableAbsoluteStickMode() was
overwriting fState even when the dome was already in random mode.
This caused toggleRandomMode() to see isRandomMode()==false and
re-enable instead of disable, making the toggle always turn random on.

Two-part fix:
- Don't engage abs-stick mode at all when random mode is active, so
  the state stays kStateRandom while the alt button is held and the
  toggle check sees the correct value.
- Save/restore fState across abs-stick engage/disengage so other
  states (e.g. kStateGoToAngle) are also preserved on alt-release.

Also updates example_config.txt to move the random-toggle action from
lb=5 (long-press) to ab=5 (alt-press), matching the intended use.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@thePunderWoman thePunderWoman merged commit d44992b into main Apr 24, 2026
1 check passed
@thePunderWoman thePunderWoman deleted the fix/random-toggle-alt-button branch April 24, 2026 02:59
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.

1 participant