Henrik Bergvin Posted February 23, 2021 Report Posted February 23, 2021 Since I like to do things the hard way around, I have written a "generic" HID device handler for advanced button functionality, using the COM library. I've got tracking of button presses and releases right now, and events firing based on what button is pressed (B1_Press, B1_Release, etc), and fairly simple handling for this from lua scripts. Next up for me is to implement repeats and double presses. Right now, I'm polling the devices using an event.timer call on a poll rate of 1000/25 (that should be every 40ms?), and it feels very stable and I never seem to "miss" any events. However, I'm at a bit of a loss here regarding what event.timer is sending to the poll function. In the documentation it says "The time provided is NOT the same as the one returned by the ipc.elapsedtime function", but it actually doesn't say what time is provided. This information is rather vital for me if I'm to track double clicks or repeats in the script. Is it elapsed time, or is it time since last time the timer fired?
John Dowson Posted February 23, 2021 Report Posted February 23, 2021 1 hour ago, Henrik Bergvin said: Is it elapsed time, or is it time since last time the timer fired? I think it should be elapsed time, but you should easily be able to verify by just logging the value.
Henrik Bergvin Posted February 23, 2021 Author Report Posted February 23, 2021 36 minutes ago, John Dowson said: I think it should be elapsed time, but you should easily be able to verify by just logging the value. Yeah, I'll do that. While I have you here, I'm doing polling at a rate of 25 per second. Right now it's on 2 devices, but will that be safe to do on 3-4 devices without causing any issues? I have absolutely no issues with delays using the COM library, but as with everything, as you increase the amount of devices... yeah. I was also considering a faster poll rate to accommodate for a 20ms delay, 10ms repeat on held buttons (that's default in FSUIPC isn't it?).
John Dowson Posted February 23, 2021 Report Posted February 23, 2021 2 hours ago, Henrik Bergvin said: Right now it's on 2 devices, but will that be safe to do on 3-4 devices without causing any issues? Probably, but you need to try it and maybe adjust. 2 hours ago, Henrik Bergvin said: I was also considering a faster poll rate to accommodate for a 20ms delay, 10ms repeat on held buttons (that's default in FSUIPC isn't it?). Yes, 10ms is the default for button repeat. These things vary a lot depending n your computer specs, network latency, programs running, etc so its difficult to advise for a particular configuration. You are better of trying thigs out and adjusting your timings/poll rates so that your system can cope. Maybe try with the defaults first and then increase from there.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now