Rename randomize
to enable_interval_randomization
This commit is contained in:
parent
7886b374b6
commit
b25f325871
@ -22,13 +22,13 @@ 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 |
|
||||||
| :-----------------------: | :-----------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
| :-----------------------------: | :-----------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||||
| `interval` | `100` | The time between key taps sent in milliseconds. Note: `10` appears to be the minimum effective value. |
|
| `interval` | `100` | The time between key taps sent in milliseconds. Note: `10` appears to be the minimum effective value. |
|
||||||
| `timeout` | `200` | The amount of time in milliseconds the key must be held down before RapidFire activates. Useful if you want to be able to type with keys that have a low `interval` value. A value of `0` will result in no waiting period. |
|
| `timeout` | `200` | The amount of time in milliseconds the key must be held down before RapidFire activates. Useful if you want to be able to type with keys that have a low `interval` value. A value of `0` will result in no waiting period. |
|
||||||
| `randomize` | `False` | Add randomization to the value of `interval`. Useful for making the repetitive input look human in instances where you may be flagged as a bot otherwise. |
|
| `enable_interval_randomization` | `False` | Enable randomizing the value of `interval`. Useful for making the repetitive input look human in instances where you may be flagged as a bot otherwise. |
|
||||||
| `randomization_magnitude` | `15` | If `randomize` is `True`, the time between key taps sent will be `interval` plus or minus a random value up to this amount. |
|
| `randomization_magnitude` | `15` | If `enable_interval_randomization` is `True`, the time between key taps sent will be `interval` plus or minus a random value up to this amount. |
|
||||||
| `toggle` | `False` | If set to `True`, activating RapidFire will toggle it on or off. Useful if you don't want to have to keep the button held. Set `timeout` to `0` if you would like to toggle on tap. |
|
| `toggle` | `False` | If set to `True`, activating RapidFire will toggle it on or off. Useful if you don't want to have to keep the button held. Set `timeout` to `0` if you would like to toggle on tap. |
|
||||||
|
|
||||||
### Example Code
|
### Example Code
|
||||||
|
|
||||||
@ -38,7 +38,7 @@ from kmk.modules.rapidfire import RapidFire
|
|||||||
keyboard.modules.append(RapidFire())
|
keyboard.modules.append(RapidFire())
|
||||||
|
|
||||||
# After 200 milliseconds, repeatedly send Shift+A every 75-125 milliseconds while the button is held
|
# After 200 milliseconds, repeatedly send Shift+A every 75-125 milliseconds while the button is held
|
||||||
SPAM_A = KC.RF(KC.LSFT(KC.A), timeout=200, interval=100, randomize=True, randomization_magnitude=25)
|
SPAM_A = KC.RF(KC.LSFT(KC.A), timeout=200, interval=100, enable_interval_randomization=True, randomization_magnitude=25)
|
||||||
# Immediately toggle repeatedly sending Enter every 50 milliseconds on tap
|
# Immediately toggle repeatedly sending Enter every 50 milliseconds on tap
|
||||||
SPAM_ENTER = KC.RF(KC.ENT, toggle=True, timeout=0, interval=50)
|
SPAM_ENTER = KC.RF(KC.ENT, toggle=True, timeout=0, interval=50)
|
||||||
|
|
||||||
|
@ -10,14 +10,14 @@ class RapidFireMeta:
|
|||||||
kc,
|
kc,
|
||||||
interval=100,
|
interval=100,
|
||||||
timeout=200,
|
timeout=200,
|
||||||
randomize=False,
|
enable_interval_randomization=False,
|
||||||
randomization_magnitude=15,
|
randomization_magnitude=15,
|
||||||
toggle=False,
|
toggle=False,
|
||||||
):
|
):
|
||||||
self.kc = kc
|
self.kc = kc
|
||||||
self.interval = interval
|
self.interval = interval
|
||||||
self.timeout = timeout
|
self.timeout = timeout
|
||||||
self.randomize = randomize
|
self.enable_interval_randomization = enable_interval_randomization
|
||||||
self.randomization_magnitude = randomization_magnitude
|
self.randomization_magnitude = randomization_magnitude
|
||||||
self.toggle = toggle
|
self.toggle = toggle
|
||||||
|
|
||||||
@ -36,7 +36,7 @@ class RapidFire(Module):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def _get_repeat(self, key):
|
def _get_repeat(self, key):
|
||||||
if key.meta.randomize:
|
if key.meta.enable_interval_randomization:
|
||||||
return key.meta.interval + randint(
|
return key.meta.interval + randint(
|
||||||
-key.meta.randomization_magnitude, key.meta.randomization_magnitude
|
-key.meta.randomization_magnitude, key.meta.randomization_magnitude
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user