-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Skipping inputs when using macros #127
Comments
Could you send us the script you're using? |
Also, what command are you using to run th escript? Are you using the Command Line? |
|
Comand Line, in ubuntu 22.04 |
Looks good on first look. What kind of device are you using? Last question, are you using an external bluetooth dongle? |
I'm using an USB Bluetooth from TP-link connected to my pc(running ubuntu 22.04) |
After some troubleshooting, I think the problem is your script. This is the broken segment:
To press 2 buttons simultaneously, you use a macro command like: |
changed it and does the same, it doesn't work |
could you send is a demonstration of your script? A recording or replay would be nice as well |
|
Unfortunately I don't know much about BotW, but i can tell that random chance seems to be messing with it. Last question (i think), what input was skipped in this clip? |
X was skipped |
I have been trying to find out what causes it too as I had the same problem with inputs being suddenly skipped at seemingly random, just like you. From what I can see it might be a logic error in controller/server.py, specifically with how command durations longer than one tick are handled. This error occurs in line 184 to 186: sleep_time = 1/132 - duration_elapsed You might notice that there is no else statement following this for the case that the duration is longer than a tick, as mentioned. To fix the input skipping: insert the following lines and reinstall the local package:
-after line 186: Also, do note that the refresh rate of a Switch Pro Controller might actually be 132 as this file suggests, so pick the macro input times corresponding to that. I hope that resolves your issue, but I'm in the same boat as you are, so if you find any issues with this, please let me know. |
Was this issue fixed for you after making those changes @PolarisingEntity ? I make the same changes and it doesn't not seem to help. |
Sorry this has taken a bit for me to get around to. From my testing, the biggest culprits for input skipping are primarily caused by the following two factors:
I've attempted to address the first point in the dev branch with an overhauled timing system. The second point is trickier to address and, largely, comes down to process scheduling behaviour in the host OS. To provide context, NXBT is attempting to share a given CPU's resources with other processes. Maintaining a fast loop with consistent latency can be challenging since NXBT can get preempted (essentially, put to sleep temporarily) by other processes that want a fair share of their time on the CPU. The problem with the current timing strategy in the main branch is that NXBT is "trusting" the time.sleep function call. Sleeping, unfortunately, can be inaccurate, which results in large latency spikes and skipped or cut-short inputs. The new timing loop in the dev branch uses busy waiting, instead of sleeping, for increased accuracy between ticks. This should hopefully reduce the amount of skipped inputs people are encountering. As an aside, Windows, unfortunately, seems to be the least friendly platform for running fast loops on (results and discussion here). Inherent timing inaccuracies on Windows seem to result in NXBT skipping inputs more often than on macOS or Linux. Busy waiting still helps on Windows, but there might be some OS quirks that need to be worked around for Windows specifically. I'm going to make a few more adjustments to the dev branch before merging and slicing off a new version for PyPi. In the meantime, you can test the dev branch (if you want) by installing this version using the following commands: sudo pip install git+https://github.com/Brikwerk/nxbt@dev |
I am running into this as well, with some additional context: Platform: Linux It is still skipping inputs. I have tried this using the My Macro
I am running that macro in a loop (python Edit: I adjusted the timings in my macro so buttons are held a little longer (but not long enough to register as a long-held button, to move two menu-entries for instance). And I am also running the process as a linux real-time process with Not sure there's much more I can improve for the running environment here, giving it CPU priority on a realtime kernel. Edited macro
|
When i use macros, it sometimes doesn't send a key, why does it happen
The text was updated successfully, but these errors were encountered: