Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mapping for a DS3 like gamepad #1

Open
AnTeBiOss opened this issue May 4, 2022 · 4 comments
Open

Mapping for a DS3 like gamepad #1

AnTeBiOss opened this issue May 4, 2022 · 4 comments

Comments

@AnTeBiOss
Copy link

Thank you for help me to connect my gamepad

My pad works on, it is connected and react with cncjs as well. But no buttons are correctly mapped.

Could you help me to do it ?

@AnTeBiOss
Copy link
Author

AnTeBiOss commented May 4, 2022

When i rune in SIMULATOR mode with -vvv:

pi@raspberrypi:~/cncjs-pendant-gamepad $ bin/cncjs-pendant-gamepad.js -p /dev/ttyUSB0 -b 115200 -t grbl simulate -vvv run 
cncjs-pendant-gamepad is currently running. Stop running with Control-C
Use 'cncjs-pendant-gamepad --help' if you're expecting to see something else here.
CNCpad trace CLI       Creating the GamepadController instance.
CNCpad  info GAMEPAD   attach Sony PLAYSTATION(R)3 Controller (id 0)
CNCpad trace CLI       Starting the main connector service.
CNCpad  info SIMULATOR Attempting connect to ws://localhost:8000
CNCpad  info SIMULATOR Sending open request for /dev/ttyUSB0 at baud rate 115200
CNCpad  info SIMULATOR Connection to /dev/ttyUSB0 successful.
CNCpad  info SIMULATOR Ready to listen for message 'connect' from the socket.
CNCpad  info SIMULATOR Ready to listen for message 'error' from the socket.
CNCpad  info SIMULATOR Ready to listen for message 'close' from the socket.
CNCpad  info SIMULATOR Ready to listen for message 'serialport:open' from the socket.
CNCpad  info SIMULATOR Ready to listen for message 'serialport:close' from the socket.
CNCpad  info SIMULATOR Ready to listen for message 'serialport:error' from the socket.
CNCpad  info SIMULATOR Ready to listen for message 'serialport:read' from the socket.
CNCpad  info SIMULATOR Ready to listen for message 'serialport:write' from the socket.
CNCpad  info SIMULATOR Ready to listen for message 'controller:settings' from the socket.
CNCpad  info SIMULATOR Ready to listen for message 'controller:state' from the socket.
CNCpad  info SIMULATOR Ready to listen for message 'workflow:state' from the socket.
CNCpad trace CLI       Starting the actions service.
CNCpad  info SIMULATOR Ready to listen for message 'serialport:read' from the socket.

I'm trying to make a keymap in chord with my gamepad :)

@AnTeBiOss
Copy link
Author

Here i have done my keymap :

A press { id: 0, num: 0, button: 'KEYCODE_BUTTON_X' }
B press { id: 0, num: 1, button: 'KEYCODE_BUTTON_A' }
X press { id: 0, num: 3, button: 'KEYCODE_BUTTON_Y' }
Y press { id: 0, num: 2, button: 'KEYCODE_BUTTON_B' }
L1 press { id: 0, num: 4, button: 'KEYCODE_BUTTON_L1' }
R1 press { id: 0, num: 5, button: 'KEYCODE_BUTTON_R1' }
L2 press { id: 0, num: 6, button: 'KEYCODE_BUTTON_LTRIGGER' }
  move { id: 0, axis: 2, value: 1, button: 'AXIS_Z' }
R2 press { id: 0, num: 7, button: 'KEYCODE_BUTTON_RTRIGGER' }
  move { id: 0, axis: 5, value: 1, button: 'AXIS_RZ' }
Start press { id: 0, num: 9, button: 'KEYCODE_BUTTON_START' }
Select press { id: 0, num: 8, button: 'KEYCODE_BACK' }
Home press { id: 0, num: 10, button: 'KEYCODE_BUTTON_THUMBL' }
  Left Thumb Enabled:true, Right Thumb Enabled:false
press { id: 0, num: 13, button: 'KEYCODE_BUTTON_TOUCHPAD' }
press { id: 0, num: 16, button: undefined }
press { id: 0, num: 14, button: undefined }
press { id: 0, num: 15, button: undefined }
LS ▲▼ move { id: 0, axis: 1, value: -0.3333333134651184, button: 'AXIS_X' }
LS ◄ ► move { id: 0, axis: 0, value: 0.20000004768371582, button: 'AXIS_Y' }
RS ▲▼ move { id: 0, axis: 4, value: -0.270588219165802, button: 'AXIS_RTRIGGER' }
RS ◄ ► move { id: 0, axis: 3, value: 0.2705882787704468, button: 'AXIS_LTRIGGER' }
LS clic press { id: 0, num: 11, button: 'KEYCODE_BUTTON_THUMBR' }
  Left Thumb Enabled:false, Right Thumb Enabled:true
RS Clic press { id: 0, num: 12, button: 'KEYCODE_HOME' }

With the hope it is well enough.

Thanks by advance

@AnTeBiOss
Copy link
Author

I have tried to add this in gamepad_controler.ts without success :

'Sony PLAYSTATION(R)3 Controller': {

    'buttons': {
      '3': 'KEYCODE_BUTTON_X',
      '0': 'KEYCODE_BUTTON_A',
      '1': 'KEYCODE_BUTTON_B',
      '2': 'KEYCODE_BUTTON_Y',
      '4': 'KEYCODE_BUTTON_L1',
      '5': 'KEYCODE_BUTTON_R1',
      '6': 'KEYCODE_BUTTON_LTRIGGER', // note: ALSO activates the axis.
      '7': 'KEYCODE_BUTTON_RTRIGGER', // note: ALSO activates the axis.
      '8': 'KEYCODE_BACK',
      '9': 'KEYCODE_BUTTON_START',
      '10': 'KEYCODE_BUTTON_THUMBL',
      '11': 'KEYCODE_BUTTON_THUMBR',
      '12': 'KEYCODE_HOME',
      '13': 'KEYCODE_BUTTON_TOUCHPAD'
    },

    'axes': {
      '0': 'AXIS_Y',
      '1': 'AXIS_X',
      '2': 'AXIS_Z',
      '3': 'AXIS_LTRIGGER', // note: also activates the button.
      '4': 'AXIS_RTRIGGER', // note: also activates the button.
      '5': 'AXIS_RZ',
      '6': 'AXIS_HAT_X',
      '7': 'AXIS_HAT_Y'
    }
  },

@AnTeBiOss
Copy link
Author

Even a Microsoft X-Box 360 pad do not work :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant