Comments (3)
I've determined that the issue here is that we store macro keystrokes as the mapped key, rather than the "physical key" ((row, col) coordinate). Conversely, we select macro slots based on physical key rather than mapped key. When playing back a macro that contains a MACROPLAY
keypress, the following keypress (which is supposed to select a playback slot) is injected with UNKNOWN_KEYSWITCH_LOCATION
, and the macro-playback code can't determine which slot should be played.
We have perhaps three options here. There is a relevant philosophical question: when the user records a macro, do they intend to record a series of mapped keypresses, or a series of physical keypresses? If the former, a user who records a macro having the effect (at the time) of, say, "space c tab esc" intends that playing back that macro will always have the effect "space c tab esc" regardless of what those physical keys do or don't do at that later time. If the latter, the user intends that the physical key sequence is recorded, and that playing back that macro is always literally equivalent to playing back that same sequence of physical keypresses. If the keys' effects have changed (due to what layer is active, due to a macro being re-recorded, or anything else), the macro should change too.
- We could leave things as-is. This would leave all current behaviors intact - specifically, macros play back mapped keypresses, and nested macros do not work. Nested macros would simply not be something we support. We could still "fail intelligently" i.e. just ignore the
MACROPLAY
and the slot-selection keypress during macro playback (or even not record them in the first place). - We could record physical keypresses instead of mapped ones. Nested macros would work as expected. Macros would play back physical keypress sequences. Recording a (row, col) coordinate takes exactly the same amount of space as a mapped key, so it doesn't matter from that perspective. This option does depend on keyboardio/Kaleidoscope#205.
- We could identify macro slots by mapped key instead of physical key. This wasn't possible until recently, simply because of the sheer number of possible mapped keys (previously, we statically allocated at least a header for every possible macro slot) - but now, I think it should be possible. Nested macros would work as expected, and macros would play back mapped keypresses. A question arises whether we could still use all kinds of keys (even e.g. momentary-layer-switch keys) as macro slots, but I think we could. A more philosophical point, is that with this option, if the user has two keys that map the same (say, two Enter keys, or two
Keymap1_Momentary
keys as in the default Model 01 firmware, those would now also identify the same macro slot, whereas currently they are separate slots. I'm not sure what is desirable/intuitive here.
Options 2 and 3 seem best to me, but it's unclear to me at the moment which is better or results in the more intuitive behavior for end users.
from kaleidoscope-macrosonthefly.
There are a few issues with the second solution that I can see:
- What happens if the user changes their layout between recording the macro, and trying to use it (for example, by using
EEPROM-Keymap
&Focus
)? In this case, the macro will not map to the same keys anymore. - Similarly, if a macro is recorded with only the base layer active, playing it back with another layer active (if that is possible, and I think it should be) could also have keys map to different codes than when they were recorded.
The second case is much more likely than the first, likely enough to seriously think about whether recording locations only is sufficient. With the above two scenarios in mind, I think that recording mapped keys is the safest option.
from kaleidoscope-macrosonthefly.
Yes, that would be the case with the second option. It's a question of whether it's a feature or bug that the macro changes if the underlying keymap or layer changes. Clearly you think it's a bug, and on further thought, I'm inclined to agree; I think recording mapped keys is the more intuitive behavior for most users.
The question remains whether identifying macro slots by mapped keys or by physical locations is better. (I.e. option 1 or 3 above.) Most of the time, I suppose it won't make much difference. One of the most visible consequences of using mapped keys would be that if the user has two keys that map the same (say, two Enter keys, or two Keymap1_Momentary
keys as in the default Model 01 firmware), those would now also identify the same macro slot, whereas currently they are separate slots.
I think identifying macro slots by mapped keys is probably acceptable? even if it slightly reduces the number of available slots. Plus, we can support nested macros with option 3 but not with option 1.
from kaleidoscope-macrosonthefly.
Related Issues (12)
- Recording sequences including OneShot modifiers does not work correctly HOT 10
- Playback (on fn-prog) of a slot whose key has something on its function layer causes problems HOT 7
- Light up the slot being played back HOT 1
- With record set to "prog", program mode activated on boot after flash HOT 3
- Flashing is hard to initiate with prog mapped to record HOT 5
- Injected keys from SpaceCadet are not replayed HOT 1
- Keyboard left in FN layer after playing a macro HOT 1
- Feature Request: highlight available macro keys HOT 2
- Shift press-release isn't recorded properly HOT 4
- Fails to compile with newer firmware. HOT 1
- Fails to compile on macOS when added to KALEIDOSCOPE_INIT_PLUGINS HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kaleidoscope-macrosonthefly.