diff --git a/doc/env.rst b/doc/env.rst index ec04510..5ab3cd4 100644 --- a/doc/env.rst +++ b/doc/env.rst @@ -14,6 +14,12 @@ Usage:: RIVALCFG_DRY=1 +RIVALCFG_DEBUG_NO_COMMAND_DELAY +------------------------------- + +When set, this remove the delay between commands. This is only usefull to allow tests to run faster, you may not use this with real devices, they may hang or even crash. See :py:attr:`~rivalcfg.mouse.Mouse.command_delay`. + + RIVALCFG_PROFILE ---------------- @@ -26,3 +32,4 @@ Usage:: For example, to load the Rival 100 profile and list its CLI options:: RIVALCFG_PROFILE=1038:1702 RIVALCFG_DRY=1 rivalcfg --help + diff --git a/noxfile.py b/noxfile.py index 63c99f1..bdbb9ec 100644 --- a/noxfile.py +++ b/noxfile.py @@ -33,6 +33,7 @@ def test(session): "test", env={ "RIVALCFG_DRY": "1", + "RIVALCFG_DEBUG_NO_COMMAND_DELAY": "1", }, ) diff --git a/rivalcfg/mouse.py b/rivalcfg/mouse.py index c8aec6d..a0a77db 100644 --- a/rivalcfg/mouse.py +++ b/rivalcfg/mouse.py @@ -1,3 +1,4 @@ +import os import time from . import usbhid @@ -291,7 +292,8 @@ def _hid_write( raise ValueError("Invalid HID report type: %2x" % report_type) # Avoids sending multiple commands to quickly - time.sleep(self._command_approve_delay) + if "RIVALCFG_DEBUG_NO_COMMAND_DELAY" not in os.environ: + time.sleep(self._command_approve_delay) def __getattr__(self, name): # Handle every set_xxx methods generated from device's profiles