BlueMicro_BLE icon indicating copy to clipboard operation
BlueMicro_BLE copied to clipboard

KC_LSPO/KC_LSPC?

Open SleepyBrett opened this issue 2 years ago • 3 comments

Is your feature request related to a problem? Please describe. I picked up a bluemicro board for my kinesis advantage 2 (blue_wizard) but I've run into a problem with a QMK 'macro' that I've grown to depend on, specifically KC_LSPO/KC_LSPC aka the space cadet shifts.

For a clearer explanation those keycodes cause the left and right shift keys to work as normal unless they are not comboed with another key. If left shift is pressed and released immediately it will result in a ( being sent instead. If shift is comboed with say a 1 a ! will be sent as normal. I think there is a feature where if the shift is held down for long enough and then released nothing is sent.

Describe the solution you'd like I'd love for these keycodes/functionality to be ported over.

Describe alternatives you've considered I'm open to alternatives that I can implement by hand. With pointers into the codebase on where it would be added.

Additional context n/a

SleepyBrett avatar Feb 07 '22 19:02 SleepyBrett

I seem to remember configuring something like this a few months ago but can't remember exactly where, for who or how we got it going. I think we might have gone the Tap/Hold route:

Can you try the following: 1 - put ( in tap layer 2 - put shift in hold layer 3 - put nothing in press layer.

It won't be exactly as you have it and you may need to tweak the hold timing but it might be a reasonable alternative.

The tap works as follows: the keycode is sent if the key is pressed and released within a specific amount of time. The key is only sent at the time of release. Hold only works after a delay while keeping pressing.

jpconstantineau avatar Feb 07 '22 21:02 jpconstantineau

So we discussed this yesterday and I've been playing with the numbers, and I just can't find any values that actually work consistently. Either the hold time is so short that 'tap' doesn't register because it's transitioned into hold (my guess) and no paren is sent, OR the hold time is so long that half the time i try to shift a cap it doesn't register the shift.

This needs a state machine to function properly.

If user is pressing shift and releases it within some timer (between 130-200 mills) no action.

If the user is pressing shift and presses any other key (combos shift), then send shifted character.

If user is pressing shift and releases it before it crosses the timer, send paren.

SleepyBrett avatar Feb 08 '22 17:02 SleepyBrett

There is a state machine for handling each key individually. (see here).

Unfortunately, there isn't one for handling multi-key states. It would need to be inserted into the keyscanner.cpp code similarly to what's done for combos: https://github.com/jpconstantineau/BlueMicro_BLE/blob/master/firmware/KeyScanner.cpp#L299

The combo engine essentially re-writes the "active keys" depending on what it detects. The same would be needed to handle active key substitution but would need an internal state to keep track of what it saw.

The line to add would look like:

activeKeys = multikeymacros.process(activeKeys);

As for how it's done, the magic would be within that multikeymacros object. You can have a look here how the combos are processed but you will see that it doesn't keep a state. It simple replaces multiple keycodes by another one.

If you want to work on a module to take care of that (and perhaps even allow to do tap dance, leader keys and other functionality differently), I would gladly bring it in.

jpconstantineau avatar Feb 08 '22 18:02 jpconstantineau