pit-ray / win-vind

You can operate Windows with key bindings like Vim.
https://pit-ray.github.io/win-vind/
MIT License
1.95k stars 45 forks source link

[Bug] Keys don't seem to work properly when they're pressed for <=1ms #153

Open lucordes opened 1 year ago

lucordes commented 1 year ago

About Bug

Steps to reproduce

  1. I'm using a programmable keyboard running on zmk.dev firmfare.

Environments

|Windows Edition|10 Home| |Architecture|[e.g. 64bit/32bit]| |win-vind Version|[e.g. 5.0.1.0]|

pit-ray commented 1 year ago

Do I need to buy some keyboards to reproduce it? Could you tell me details more?

Thanks.

lucordes commented 1 year ago

It is a keyboard running https://github.com/zmkfirmware/zmk firmware. It is workin for me now. I created deticated macros for each key to press the keys for 20ms. It does not look as nice but it works. This issue could be related https://github.com/zmkfirmware/zmk/issues/759 . Thank you very much for your great extention. Can this issue be closed?

pit-ray commented 1 year ago

Thanks for details.

Am I correct in understanding that this isuue is caused by mismatch of I/O timing between zmk and win-vind?

win-vind uses hardcoded interval, but modifilable, but I have not tried yet.

lucordes commented 1 year ago

I only press my keys on my programmable keyboard for 1ms it seems. If I sleep for 0ms it works but 5 or 1 ms doesn't work. Downside is that my cpu is at 33%. constexpr auto REPEAT_SAMPLING_DELTA_US = 25'600 ; Does not appear to make a change.

lucordes commented 1 year ago

I can wait for minmal 1ms. Nothing helps. Waiting ms would be nice but std::this_thread::sleep_for(std::chrono::microseconds(100)); waits a ms.

pit-ray commented 1 year ago

Did your std::this_thread::sleep_for work? If necessary I will create a version with modifiability for tests.

lucordes commented 1 year ago

I'd did not work. std::this_thread::sleep_for(std::chrono::microseconds(100)); sleeps for 1ms. And it does not work consistently. I'm not sure what you mean. I'm using a macros to artificial extend the tapping time to 20ms and it works consistently. Thanks for your activity on this program I use it every day.

pit-ray commented 1 year ago

Thanks for using win-vind.

Looking at Stack Overflow, it still seems to be difficult to get Windows to sleep for an exact short period of time. If you find a better solution, please send a pull request.