Archomeda / lightfx-extender

Allows gamers to take advantage of LightFX on hardware other than Alienware's
GNU General Public License v2.0
36 stars 7 forks source link

Updates to lights should happen at a regular and same interval #11

Closed Archomeda closed 9 years ago

Archomeda commented 9 years ago

The lights of each device are being updated on a separate thread, which is good. But every time it completes one update (given that there's an update directly happening after that) it sleeps for 5ms before resuming. While this is good for short loops, this loop isn't short at all and might cause to stall updates and give a noticeable "stuttering" of color changes. To be clear, it's not a slower color transition (meaning it takes 2 seconds for a color transition instead of 1), but rather a color jump instead of a more smooth transition.

For example:

It's better to have an update every 5ms (which was intended) instead of extending an update time with 5ms. This way device A and B can have updates every 5ms (which is possible). Device C is still too slow for having it to update every 5ms, so it should just have to settle with an update every 12ms, the same amount it takes for it to update the lights.

After this has changed, it's probably a good idea to review if having an update every 5ms is good enough, or maybe too fast (it is 1/200th of a second after all). It's possible to expose it as a configuration in settings.json to let users decide what they want.

Archomeda commented 9 years ago

I'm leaving it unexposed for user configuration. Although it seemed useful at first, it really isn't when I was thinking a bit more about it.