rocgui-gamepad-en
Differences
This shows you the differences between two versions of the page.
Previous revision | |||
— | rocgui-gamepad-en [2022/02/02 11:24] (current) – [Rocview Gamepad Support] besra | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ======Rocview Gamepad Support====== | ||
+ | [[: | ||
+ | [[: | ||
+ | * [[: | ||
+ | * [[: | ||
+ | |||
+ | // \\ // \\ | ||
+ | |||
+ | | Deprecated | | ||
+ | \\ | ||
+ | |||
+ | Rocview supports up to 4 connected gamepads for controlling locomotives.\\ | ||
+ | The __**[[: | ||
+ | In case a gamepad is connected, a locomotive can be selected with function 10 which pops up the selection dialog (see below).\\ | ||
+ | With the D-pad a locomotive from the list can be selected which must be activated with the function 10 button.\\ | ||
+ | |||
+ | |< >| | ||
+ | |{{: | ||
+ | | Dialogue **[[: | ||
+ | |||
+ | \\ | ||
+ | |||
+ | =====Predefined action mapping===== | ||
+ | | **Button** | **Action** | | ||
+ | | 1 to 4 | decoder function 1 to 4 | | ||
+ | | 5 | change direction | | ||
+ | | 6 | lights on/off | | ||
+ | | 7 | stop (not emergency) | | ||
+ | | 8 | track power off | | ||
+ | | 9 | track power on | | ||
+ | | 10 | select locomotive (dialog open/close) | | ||
+ | | D-pad | speed up/down, or scroll through the loc list | | ||
+ | |||
+ | {{: | ||
+ | |||
+ | These are the predefined button definitions.\\ | ||
+ | The values are zero indexed. (mapping 0 is button 1)\\ | ||
+ | |||
+ | \\ | ||
+ | |||
+ | =====How to map a GamePad===== | ||
+ | After the GamePad is connected and pressing the buttons and Axis you will get messages in the trace like these: | ||
+ | |||
+ | < | ||
+ | JsEvent dev=0, type=1, number=0, value=1, msec=50766908 | ||
+ | JsEvent dev=0, type=1, number=1, value=1, msec=50773640 | ||
+ | JsEvent dev=0, type=1, number=2, value=1, msec=50774584 | ||
+ | JsEvent dev=0, type=1, number=3, value=1, msec=50775384 | ||
+ | JsEvent dev=0, type=2, number=5, value=-32767, | ||
+ | JsEvent dev=0, type=2, number=5, value=0, msec=50779824 | ||
+ | </ | ||
+ | |||
+ | **Type 1** is a Button, **type 2** are axis.\\ | ||
+ | |||
+ | \\ | ||
+ | =====Setup in Rocview===== | ||
+ | {{rocguiini-gamepad-en.png}} | ||
+ | |||
+ | ==== Possible entries: ==== | ||
+ | * **V**: button used for acceleration/ | ||
+ | * **Repeat**: auto repeat interval in case the acceleration button is kept pressed, entry is in in msec. | ||
+ | * smaller numbers get higher repeat rate. | ||
+ | * " | ||
+ | * **Direction**: | ||
+ | * **Stop**: button to stop the loco | ||
+ | * **Decoder steps**: defines how much decoder steps are accelerated/ | ||
+ | * **Lights**: button to toggle lights | ||
+ | * **F1-12:** button to toggle F1-F12 | ||
+ | * -1 for not used | ||
+ | * **on/off:** button to switch on/off command station power (not all command station may support this) | ||
+ | |||
+ | \\ | ||
+ | =====Trouble shooting===== | ||
+ | Try todo the following test running Linux: | ||
+ | |||
+ | * open a console | ||
+ | * connect the gamepad | ||
+ | * type the command: | ||
+ | < | ||
+ | cat / | ||
+ | or | ||
+ | cat /dev/js0 | ||
+ | </ | ||
+ | * press all buttons one after another starting with button 1 | ||
+ | * press the D-Pad in all direction. | ||
+ | |||
+ | The console output should show something like this (depends on the console codepage settings): | ||
+ | {{: | ||
+ | //The Gamepad is not useable if there is no output on pressing a button or D-Pad.// | ||
+ | |||
+ | Now start the Rocview in a console: | ||
+ | < | ||
+ | ./rocview -debug | ||
+ | </ | ||
+ | * insert the gamepad | ||
+ | * touch all buttons and D-Pad direction as you did with the previouse test. | ||
+ | |||
+ | It is all a matter of mapping: | ||
+ | |||
+ | http:// | ||
+ | |||
+ | If your D-Pad generates different values like those ones: (rocview trace with debug lines) | ||
+ | < | ||
+ | 20071219.173903.558 g9999D js-reade OJS 0110 handle=9, devnr=0, type=2, number=4, value=0, msec=27128764 | ||
+ | 20071219.173903.559 g9999I main | ||
+ | 20071219.173903.640 g9999D js-reade OJS 0110 handle=9, devnr=0, | ||
+ | 20071219.173903.641 g9999I main | ||
+ | </ | ||
+ | |||
+ | Function button mapping: (rocview trace) | ||
+ | < | ||
+ | 20071224.090542.371 g9999I js-reade Logitech 0069 JS 1(Logitech Logitech Dual Action) has 6 axes and 12 buttons. Driver version is 2.1.0. | ||
+ | 20071224.090543.529 g9999I main | ||
+ | 20071224.090543.720 g9999I main | ||
+ | 20071224.090553.122 g9999I main | ||
+ | 20071224.090553.313 g9999I main | ||
+ | 20071224.090556.663 g9999I main | ||
+ | 20071224.090556.824 g9999I main | ||
+ | 20071224.090557.689 g9999I main | ||
+ | 20071224.090557.852 g9999I main | ||
+ | </ | ||
+ | The **number** corresponds to the number of the gamepad button subtracted with 1. | ||
+ | In this example the button 1 to 4 where pressed and meets the default values in the **jsmap**. | ||
+ | |||
+ | Adjust the jsmap in the rocgui.ini to meet your gamepad. | ||
+ | Example: | ||
+ | < | ||
+ | <jsmap step=" | ||
+ | </ |