Skip to content

preset_selector: rotary encoder direction reversed (clockwise decrements the preset) #975

@bwhitman

Description

@bwhitman

Reported in #amyboard (Discord) on 2026-06-02 by @chad.eby:

In the AMYboard World preset_selector sketch, turning the encoder clockwise decrements the preset, when I'd expect it to increment it.

Expected: turning the rotary encoder clockwise advances to the next preset (increment).
Actual: clockwise decrements the preset.

Where to look

The preset_selector AMYboard World example (/editor/?env=preset_selector&user=shorepine) reads the rotary encoder via read_encoder() in tulip/shared/amyboard-py/amyboard.py, which returns the raw cumulative seesaw position:

return struct.unpack(">i", result)[0]

The Adafruit seesaw quad encoder typically reports decreasing values for clockwise rotation, so a sketch that maps an increasing encoder value to "next preset" will move backwards on CW. Likely fixes:

  • Flip the sign where preset_selector consumes the encoder value, or
  • Normalize direction once in read_encoder() so CW increases — but note that would flip direction for every existing sketch (house_generator, acid_generator, etc.), so it's a behavior change to weigh.

Also worth checking the web/simulator path (_web_encoder_turn(delta) / _web_encoder_pos) so hardware and sim agree after the fix.

Filed from the community digest (item #1).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions