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

Macros: Rebuild with a completely different architecture #1094

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

algernon
Copy link
Contributor

@algernon algernon commented Dec 2, 2021

This is the work in progress pull request aiming to implement the architecture envisioned in #1093.

At the moment, it doesn't accomplish it yet, but goes a long way by reworking Macros.play() to be reusable by DynamicMacros. We do this in a similar way we allow EEPROM-Keymap to override keys, via Layer.getKey(): we make Macros.readMacroByte() a function that other plugins can override. As such, Macros.play() will read byte by byte from wherever we fancy, and play the macro. This lets us remove a large part of the duplication currently in DynamicMacros.

We're not where #1093 wants to go yet, though. We need the onMacroStep() event, which will require further changes. And there remains the problem of DynamicMacros.updateDynamicMacroCache() which has to parse macros, but not play them. Those will be addressed in future updates to this draft PR.

Instead of the `Macros` plugin reading from progmem unconditionally, allow one
to override a function (similar to how we can override `Layer.getKey()`), and
use that function to read macro data.

This allows `DynamicMacros` to re-use most of `Macros`, and not reimplement all
of it. The only remaining duplication is `updateDynamicMacroCache()`, which
walks the storage to build a macro index->offset map, and as such, needs to be
able to parse macros.

Signed-off-by: Gergely Nagy <[email protected]>
@algernon algernon added enhancement New feature or request plugin:macros design-change Proposals that incur potentially breaking design changes labels Dec 2, 2021
@algernon algernon added plugin Issues related to otherwise unlisted plugins and removed plugin:macros labels Jun 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design-change Proposals that incur potentially breaking design changes enhancement New feature or request plugin Issues related to otherwise unlisted plugins
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant