qmk_firmware/users/muppetjones/readme/etchamouse.md
Stephen J Bush df8a538489
Userspace: muppetjones (#1) (#13461)
* Userspace: muppetjones (#1)

Add and update lily58 to work with userspace
Add and update kyria keymap to work with userspace
Add and update planck keymap with userspace
Add etchamouse code and docs to userpace
Add userspace
Update mouse encoder for smoother movement.
Encoder + mouse
Added casemodes by andrewjrae

* Rollback lily58 state reader and add missing GPL

* Apply suggestions from code review

Co-authored-by: Drashna Jaelre <drashna@live.com>
Co-authored-by: Joel Challis <git@zvecr.com>

* fix lily58 keymap

* Updates to user and lily for muppetjones.

Updated parameters for etchamouse for smoother mouse movement. Updated lily keymap and userspace to actually work together.

* Update keyboards/lily58/keymaps/muppetjones/config.h

Co-authored-by: Drashna Jaelre <drashna@live.com>

* Updated keymaps and userspace

* Little more cleanup.

* Update keyboards/lily58/keymaps/muppetjones/rules.mk

Co-authored-by: Ryan <fauxpark@gmail.com>

* Rollback accidental libchibios update

* Apply suggestions from code review

Co-authored-by: Drashna Jaelre <drashna@live.com>

* Update kyria keymap

* Move kyria keymap to splitkb/kyria

* Update planck keymap

* Remove all changes to keyboards/lily58/lib/layer_state_reader.c

* Update lily58 keymap

* Recommended change

* Update keymap readme

* Update kyria keymap and userspace

* Apply suggestions from code review

Co-authored-by: Drashna Jaelre <drashna@live.com>

* Renamed users/muppetjones/README.md to lc

* Update keyboards/lily58/keymaps/muppetjones/config.h

Co-authored-by: Drashna Jaelre <drashna@live.com>

Co-authored-by: Drashna Jaelre <drashna@live.com>
Co-authored-by: Joel Challis <git@zvecr.com>
Co-authored-by: Ryan <fauxpark@gmail.com>
2022-08-03 18:23:17 +01:00

70 lines
2.1 KiB
Markdown

# Etch-a-Mouse
Encoder-based mouse movement with acceleration!
## Usage
- Add the following to your rules.mk
```
ENCODER_ENABLE = yes
POINTING_DEVICE_ENABLE = yes
```
- Add the following block to your keymap.c
```
#ifdef ENCODER_ENABLE
void encoder_update_user(uint8_t index, bool clockwise) {
# ifdef POINTING_DEVICE_ENABLE
encoder_update_mouse(index, clockwise);
# endif
return;
#endif
```
> NOTE: I use the mousekey keycodes to add button one and two into my keymap.
## How It Works
> This implementation uses the pointing device library, but it reuses several
> of the same parameters from the mouse key acceleration.
> The PD library is very light weight, but it does not animate cursor movement.
> tl;dr: The mouse movement will not be smooth!
The acceleration has four parts:
```
initial speed + (delta * time * count)
```
1. **Initial Speed**. Uses the `MOUSEKEY_INITIAL_SPEED` parameter.
2. **Delta**. Uses the `MOUSEKEY_MOVE_DELTA` parameter.
3. **Time**. The faster you turn, the faster you move.
Subtract the time elapsed since the last actuation from a tapping term,
defined by `TAPPING_TERM_MOUSE_ENCODER`†, with a minimum value of 1.
4. **Count**. The more you turn, the faster you move.
Count of the total number of actuations. This value will decay over time.
† _I probably could and will eventually use `TAPPING_TERM`, but I did not want
to mess up my tap mods while experimenting with acceleration._
## Diagonal Movement
Counting the number of actuations for a given axis allows us to persist movement
along a given axis to give us some diagonal movement when moving both axes,
which also helps with the acceleration a bit and makes the movement less blocky.
## Time-based Decay (a.k.a., Deceleration)
Originally, the actuation count zeroed out once the tapping term elapsed, but
this made the movement very choppy. Instead, the count will degrade on every
refresh after the tapping term has been exceeded; unfortunately, a refresh only
occurs on an actuation on either axis, so once the time elapsed exceeds the
persistence term, the count is cleared, which also removes any movement in that
axis.