Skip to content

Macropad RP2040 sometimes doesn't report position change. #5198

@PeterFalken

Description

@PeterFalken

CircuitPython version

Adafruit CircuitPython 7.0.0-alpha.6 on 2021-08-12; Adafruit Macropad RP2040 with rp2040

Code/REPL

## Imports
from adafruit_macropad import MacroPad

## Global variables
os_index = 0
app_index = 0

l_position = 0  ## last position

## Init
macropad = MacroPad()
text_lines = macropad.display_text(title="MacroPad Info")

## Main loop
while True:
    diff = macropad.encoder - l_position
    l_position = macropad.encoder
    if 0 != diff:
        if macropad.encoder_switch:
            if diff > 0:
                os_index+=1
            else:
                os_index-=1
            ## Reset app_selector
            app_index = 0
        else:
            if diff > 0:
                app_index+=1
            else:
                app_index-=1


    text_lines[0].text = "OS Selector {}".format(os_index)
    text_lines[1].text = "App Selector {}".format(app_index)
    text_lines[2].text = "Encoder switch: {}".format(macropad.encoder_switch)
    text_lines.show()

Behavior

No error message on console.

Description

If turning the rotary encoder fast - sometimes the app_index variable won't change value.
I'm trying to update the Macropad Hotkeys code so that pushing the encoder switch will change to different folder containing specific OS macros (basically grouping hotkey macro definitions by OS; Linux, macOS, Windows, etc.)

The onboard encoder has 20 stops per full rotation - each rotation should add/decrease the app_index variable in 20 units. But sometimes the increment is 10 units or 14 units.

Additional information

Connected through USB to macOS, but his issue should be OS independent.

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