Skip to content

Suggestions regarding and issues with initial release. #2

Closed
@kattni

Description

@kattni

From @PaintYourDragon in attempting to adapt the Macropad_Hotkeys code to use the library:

Library inits NeoPixels to brightness=0.5 and auto_write=True, project code relies on 1.0 default for former and sets auto_write=False when declaring pixels … either those arguments could be passed into Macropad() and through to the NeoPixel constructor, or the project code can set the two values manually after the fact.

Project code relies on the keypad library to debounce the encoder button “free,” requires no extra import and it generates events in the same manner as the keys rather than handling it distinctly (each of the example configs assigns some macro to the button … the revised code, using the Macropad lib, now misses these). Could either make Macropad lib treat encoder as 13th button, or project code can be modified to discretely poll and act on the encoder switch.

Project code is also pulling a shenanigan of declaring 13 rather than 12 NeoPixels, so the same code can handle key press/release (with pixel) and encoder press/release (no physical pixel, but it writes data that’s off the end), and also just uses the 13th element of the 'macros' array that it imports. Same deal, lib or project code could go one way or other. But, if it’s the project code, this kind of undoes the “library to make the project code smaller” since the project code now needs extra stuff to handle this.

Key rotation is neat but skimming the code it seems to be incomplete … it’s rotating the keys but not the NeoPixels, indices won’t match up in rotated states, making it difficult to set the pixel corresponding to the key. The pre-rotated tables of key pins are speed-efficient, but to handle both I wonder if it’s better to always declare the key pins in the “upright” rotation and then change these to remapping tables and provide setters/getters for both the keys and pixels. Except then I don’t think this’ll work with events.get(), so maybe you need both the key pin tables AND remapping/setter/getter for the NeoPixels. I don’t know. Is this rotation thing really just trading one problem for another?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions