Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce a new event: onLayerChange #363

Merged
merged 3 commits into from
Nov 20, 2018
Merged

Introduce a new event: onLayerChange #363

merged 3 commits into from
Nov 20, 2018

Commits on Nov 20, 2018

  1. Introduce a new event: onLayerChange

    The intent is to make it easier for plugins to detect layer changes and schedule
    work accordingly. There event receives no arguments, the current state can
    always be queried with `Layer.getLayerState()`, and if a plugin requires the old
    state too, they can track that on their own.
    
    Signed-off-by: Gergely Nagy <algernon@keyboard.io>
    algernon committed Nov 20, 2018
    Configuration menu
    Copy the full SHA
    4456876 View commit details
    Browse the repository at this point in the history
  2. Colormap: Migrate to using onLayerChange

    Instead of tracking layer changes ourselves, use the new `onLayerChange` event
    to do that for us. This makes the code a tiny bit easier to follow.
    
    Signed-off-by: Gergely Nagy <algernon@keyboard.io>
    algernon committed Nov 20, 2018
    Configuration menu
    Copy the full SHA
    7214cc0 View commit details
    Browse the repository at this point in the history
  3. ActiveModColor: Improve latency by caching interesting keys on layer …

    …change
    
    Keys normally only change when switching layers, so instead of going through
    every key in every cycle to look for modifiers, do that once, when layers
    change (using the new `onLayerChange` event), and store the coordinates of keys
    we consider modifiers in an array (currently limited to 16 items).
    
    Then, when we want to highlight them, go over this array only, significantly
    reducing the work we need to do. In a typical case, on a full-size keyboard, one
    would have eight modifiers and a few layer keys, so instead of going through a
    hundred keys, we go through sixteen at most, but usually considerably less.
    
    This fixes #403, at the cost of noticeably higher PROGMEM and RAM use.
    
    Signed-off-by: Gergely Nagy <algernon@keyboard.io>
    algernon committed Nov 20, 2018
    Configuration menu
    Copy the full SHA
    38681b9 View commit details
    Browse the repository at this point in the history