-
Notifications
You must be signed in to change notification settings - Fork 493
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
pico_display_demo sleep (why?) #1001
Comments
It looks like a relatively old example into which not much thought was put. Could probably use some TLC, albeit I'd reserve that for after the PicoVector rewrite has been merged: #853 Accurate frame pacing is probably somewhat outside of the scope of a simple API demo, though, but could be nice in a standalone example. |
Removing the code that draws a load of trangles to create a sort of windmill effect so you've just got the bouncing balls left and removing the sleep increases the speed to > 60FPS - making it a bit more realistic But, yeah, the display demos prob need a bit of an overhaul |
Covered more fully in other issues |
I just made a small tweak to the pico_display demo for the pico display pack
I noticed the code has sleep_ms(1000 / 60);
I set a variable to time_us_64() at the start of the main loop then calculated the elapsed time (i.e. frame time) at the end of the loop where the sleep is
The elapsed time was in the 62700 us region (fluctuates slightly) which is about 16 FPS
The sleep adds an extra 16667 us to the frame and is far less than the implied 60FPS it's seemingly trying to limit
OK, some screens could potentially go > 60FPS but surely it'd be better to at least check if the frame time was under the limit before adding more delay? Better in such cases would be to calc a more accurate value for the sleep....
The text was updated successfully, but these errors were encountered: