Skip to content

button_callback changed in 0.2.1, receives [0, 0] on button down #7

@speleo3

Description

@speleo3

Up to version 0.2, the two buttons on my SpaceNavigator were sending [1, 0] (left) and [0, 1] (right) on button down.

# git checkout 0.2
# python spacenavigator.py
Devices found:
        SpaceNavigator
SpaceNavigator found
SpaceNavigator connected to 3Dconnexion Space Navigator version: 1056 [serial: ]
   x +0.00    y +0.00    z +0.00 roll +0.00 pitch +0.00  yaw +0.00    t -1.00
buttons=[1, 0]  <-- left button down
   x +0.00    y +0.00    z +0.00 roll +0.00 pitch +0.00  yaw +0.00    t -1.00
buttons=[0, 0]
   x +0.00    y +0.00    z +0.00 roll +0.00 pitch +0.00  yaw +0.00    t -1.00
buttons=[0, 1]  <-- right button down
   x +0.00    y +0.00    z +0.00 roll +0.00 pitch +0.00  yaw +0.00    t -1.00
buttons=[0, 0]

Since version 0.2.1, the left button sends [0, 1], and the right buttons sens [0, 0] on button down.

# git checkout 0.2.1
# python spacenavigator.py
Devices found:
        SpaceNavigator
SpaceNavigator found
9
1
1
1
1
1
1
SpaceNavigator connected to 3Dconnexion Space Navigator version: 1056 [serial: ]
   x +0.00    y +0.00    z +0.00 roll +0.00 pitch +0.00  yaw +0.00    t -1.00
   x +0.50    y +0.48    z +0.50 roll +0.49 pitch +0.50  yaw +0.50    t +1.51
buttons=[0, 1]  <-- left button down
buttons=[0, 0]
buttons=[0, 0]  <-- right button down
buttons=[0, 0]

In addition to that, if the button is pressed before any axis is touched, I get an exception:

# git checkout 0.2.1
# python spacenavigator.py
Devices found:
        SpaceNavigator
SpaceNavigator found
9
1
1
1
1
1
1
SpaceNavigator connected to 3Dconnexion Space Navigator version: 1056 [serial: ]
buttons=[]
Exception in thread Thread-1:
Traceback (most recent call last):
  File "spacenavigator.py", line 118, in <lambda>
    button_handler = lambda value, id, button_id=usage : self.button_handler(button_id, value)
  File "spacenavigator.py", line 151, in button_handler
    self.button_callback(self.tuple_state, self.tuple_state.buttons)
  File "spacenavigator.py", line 412, in toggle_led
    if buttons[0] == 1:
IndexError: list index out of range

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions