Minor doc addition

This commit is contained in:
James Fitzgerald 2022-06-26 23:57:53 -04:00 committed by xs5871
parent 05d1a622dd
commit 654127bac7
2 changed files with 9 additions and 10 deletions

View File

@ -7,6 +7,7 @@ Some instances where this may be useful are:
- MMOs and other games where you are encouraged to repeatedly spam a key - MMOs and other games where you are encouraged to repeatedly spam a key
- More responsive volume up and volume down - More responsive volume up and volume down
- Faster cursor key navigation - Faster cursor key navigation
- Combine with the [Mouse Keys](https://github.com/KMKfw/kmk_firmware/blob/master/docs/mouse_keys.md) module to create rapid-fire mouse clicks
- Anywhere else you may need an ergonomic alternative to repetitive key tapping - Anywhere else you may need an ergonomic alternative to repetitive key tapping
## Keycodes ## Keycodes
@ -21,12 +22,12 @@ Each repeat counts as one full cycle of pressing and releasing. RapidFire works
The RapidFire keycode has a few different options: The RapidFire keycode has a few different options:
| Option | Default Value | Description | | Option | Default Value | Description |
| :-------------------: | :-----------: | :----------------------------------------------------------------------------------------------------------------------------------------------------------- | | :-------------------: | :-----------: | :------------------------------------------------------------------------------------------------------------------------------------------------- |
| `repeat` | `100` | The delay between repeats. Note: `2` appears to be the minimum effective value. If you run into issues, try increasing this value. | | `repeat` | `100` | The delay between repeats. Note: `2` appears to be the minimum effective value. If you run into issues, try increasing this value. |
| `wait` | `200` | The delay before starting to repeat. Useful if you want to be able to type with keys that have a low `repeat` value. | | `wait` | `200` | The delay before starting to repeat. Useful if you want to be able to type with keys that have a low `repeat` value. |
| `randomize_repeat` | `False` | Randomize the value of `repeat`. Useful for making the repetitive input look human in instances where you may be flagged as a bot otherwise. | | `randomize_repeat` | `False` | Randomize the value of `repeat`. Useful for making the repetitive input look human in instances where you may be flagged as a bot otherwise. |
| `randomize_magnitude` | `15` | The magnitude of the randomization. If randomization is enabled, the repeat delay will be `repeat` plus or minus a random value up to this amount. | | `randomize_magnitude` | `15` | The magnitude of the randomization. If randomization is enabled, the repeat delay will be `repeat` plus or minus a random value up to this amount. |
### Example Code ### Example Code

View File

@ -35,17 +35,15 @@ class RapidFire(Module):
def _on_timer_timeout(self, key, keyboard): def _on_timer_timeout(self, key, keyboard):
keyboard.tap_key(key.meta.kc) keyboard.tap_key(key.meta.kc)
repeat_timeout_key = keyboard.set_timeout( self._active_keys[key] = keyboard.set_timeout(
self._get_repeat(key), lambda: self._on_timer_timeout(key, keyboard) self._get_repeat(key), lambda: self._on_timer_timeout(key, keyboard)
) )
self._active_keys[key] = repeat_timeout_key
def _rf_pressed(self, key, keyboard, *args, **kwargs): def _rf_pressed(self, key, keyboard, *args, **kwargs):
keyboard.tap_key(key.meta.kc) keyboard.tap_key(key.meta.kc)
wait_timeout_key = keyboard.set_timeout( self._active_keys[key] = keyboard.set_timeout(
key.meta.wait, lambda: self._on_timer_timeout(key, keyboard) key.meta.wait, lambda: self._on_timer_timeout(key, keyboard)
) )
self._active_keys[key] = wait_timeout_key
def _rf_released(self, key, keyboard, *args, **kwargs): def _rf_released(self, key, keyboard, *args, **kwargs):
if key in self._active_keys: if key in self._active_keys: