TeamMeanMachine / meanlib

A Kotlin FRC library
The Unlicense
17 stars 3 forks source link

Constantly process events #21

Closed andrewda closed 5 years ago

andrewda commented 5 years ago

This ensures events are always processed, even when the driver station is disconnected. I'll give this a test in a couple hours and make sure it works as expected.

@tylerscheuble -- I forgot exactly what you had suggested when we chatted at Clackamas, but I believe this should work. If you have any suggestions on how this could be done better, let me know.

tylerscheuble commented 5 years ago

Thanks for making these PRs! I've been meaning to do this but I haven't been able to find the time.

I think it would be better to process events on the main thread, because if Events.process() is called immediately after each DS packet, it helps to minimize the latency of button-triggered events. We could probably have events processing by putting a timeout on ds.waitForData(), checking for DS connection, or some combination of the two.

andrewda commented 5 years ago

That makes sense. Timeout of 0.02s sound good?

andrewda commented 5 years ago

I merged this into #23 because they need to go hand-in-hand.