Skip to content

Conversation

@cal-pratt
Copy link
Contributor

@cal-pratt cal-pratt commented Feb 6, 2017

The LogitechExtremeJoystick now stores the last polled values of heave sway surge and yaw. If an axis event happens it will not cause the Joystick to emit the invalid values by polling data that has not yet been prepared by the joystick. Fixes #263

EDIT looking at this more closely I was able to remove the createAxes method in the Joystick source completely. We can get all the data we need from events. Same thing can be done for the buttons; just have to verify what all the component id's are for them.

@cal-pratt cal-pratt added this to the MATE 2017 milestone Feb 6, 2017
@cal-pratt cal-pratt self-assigned this Feb 6, 2017
@ConnorWhalen
Copy link
Contributor

Does isolating polling to a specific axis fix the problem? Are the invalid axis updates not going to be processed like every other axis update? Seems like behaviour will be unchanged

@cal-pratt
Copy link
Contributor Author

Does isolating polling to a specific axis fix the problem? Are the invalid axis updates not going to be processed like every other axis update? Seems like behaviour will be unchanged

Actually now that I think of it no... hahaha. will update this

@cal-pratt
Copy link
Contributor Author

Alright @ConnorWhalen I think I fixed it; does this make sense? On top of what was already changed I added the following logic:

        .skip(INITIAL_INPUT_DELAY, TimeUnit.MILLISECONDS, scheduler);

Now the initial events won't be seen by the joystick controller, and when events do happen, the -1 values are never polled because each axis is polled individually.

@ConnorWhalen
Copy link
Contributor

The logic is sound. I'll review the code then we can test it on thursday

@cal-pratt
Copy link
Contributor Author

Rabble Rabble Rabble!

Just tested this. The change prevents -1 being displayed, but it's still weird.

When the joystick reattaches we create a new LogitechExtremeJoystick object, meaning we lose the last values after a disconnect.. all the values go to zero. ie) if you set the slider to -1 then unplug, reconnect, and move the another axis, then only that axis value updates and it reports the slider value as 0.

At the same time it's still a lot safer than if the values go to -1. Additionally if we keep the old values we still don't know if the joystick was moved while it was unplugged. ie) Set the slider to -1. unplug, set the slider to 0. reconnect. move a different axis. slider would still be incorrect reporting -1 ...

So moral of the story is that joydev is lame and we should rewrite the kernal /s

Copy link
Contributor

@ConnorWhalen ConnorWhalen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is as good as it's going to get. I'm good with pushing this

@ConnorWhalen
Copy link
Contributor

Since there's no way to know the re-connected joystick's initial state setting every axis to zero is the safest option

@cal-pratt
Copy link
Contributor Author

cal-pratt commented Feb 11, 2017

There was a small bug on thursday, Axis RZ for yaw was set to be Axis RX. .. my bad
Am paranoid so I'd like to test this one more time before we push.

@cal-pratt cal-pratt force-pushed the per-axis-updates branch 3 times, most recently from 1f03d0d to c4d95ae Compare March 19, 2017 19:37
@cal-pratt cal-pratt merged commit 0dbde44 into master Mar 20, 2017
@cal-pratt cal-pratt deleted the per-axis-updates branch March 20, 2017 20:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Joystick initializes with incorrect values after a disconnect.

3 participants