Jump to content
The simFlight Network Forums

Recommended Posts

Posted

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?

Posted
  On 2/23/2021 at 9:57 AM, John Dowson said:

I think it should be elapsed time, but you should easily be able to verify by just logging the value.

Expand  

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?).

Posted
  On 2/23/2021 at 10:40 AM, 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?

Expand  

Probably, but you need to try it and maybe adjust.

  On 2/23/2021 at 10:40 AM, 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?).

Expand  

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.

 

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.