-
Notifications
You must be signed in to change notification settings - Fork 8
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
1s pause in the loop #1
Comments
The polling time of gaming peripherals is usually in the neighbourhood of 125 Hz, or every 8 milliseconds. 1000 milliseconds is way too long if that's the case. Someone is reporting improvements in the responsiveness by decreasing this delay: https://forum.clockworkpi.com/t/interface-speed/3015/8, this should be addressed. |
It's definitely not waiting one second between loops, all you need to do to prove that wrong is to notice that it can definitely register more than one button press per second. Line 93 in 9935fdc
TIMSK0 controls timer zero, the timer used to implement the delay function. I haven't looked into exactly how it works, but somehow the modification to TIMSK0 on line 93 speeds up the timer, making the delay function finish much more quickly. That said, it is still entirely possible that decreasing the delay could still help, but modifying timer zero is an unusual move and I wouldn't want to make any recommendations without knowing why they're doing that. |
@centuryglass That is an odd piece of code. That essentially boils down to Googling, it looks like setting TIMSK0 to 0 essentially disables delay(). I am trying to actually confirm this by outputting the value of micros() (which is what is called in delay()), but having difficulty setting up an Arduino project to compile everything. Will write back when I can. So it's looking like this Update: Confirmed this to be the case. Assigning TIMSK0 to 0 causes the time to overflow really quickly. Thus, if you have :
then, we will print a very large number. This leads to delay() to return almost immediately. |
Keypad/clockworkpi_keypad.ino
Line 111 in 9935fdc
If I'm correct, delay() take time in millisecond; so here we are waiting for 1 second, is this really wanted or just an error? (I can understand a bit of delay to not spam the USB with useless data) but 1s seems a lot
The text was updated successfully, but these errors were encountered: