pikvm/pikvm#1563, pikvm/pikvm#1564: Customizable /api/hid/print delay

This commit is contained in:
Maxim Devaev
2025-07-28 21:00:32 +03:00
parent dc7f38a1b6
commit 9b5b6f6152
6 changed files with 38 additions and 18 deletions

View File

@@ -152,13 +152,13 @@ class BaseHid(BasePlugin): # pylint: disable=too-many-instance-attributes
self,
keys: Iterable[tuple[int, bool]],
no_ignore_keys: bool=False,
slow: bool=False,
delay: float=0.0,
) -> None:
for (key, state) in keys:
if no_ignore_keys or key not in self.__ignore_keys:
if slow:
await asyncio.sleep(0.02)
if delay > 0:
await asyncio.sleep(delay)
self.send_key_event(key, state, False)
def send_key_event(self, key: int, state: bool, finish: bool) -> None: