Table of Contents
Rocview Gamepad Support
- Configuration | Locomotives Tab | Accelerators | Status Lights | Use multiple Gui's for viewing | Reports
- Language | General | Path | Trace | Programming | SVG Symbols | Clock | Gamepad support | MIC | Accelerators
Deprecated |
Rocview supports up to 4 connected gamepads for controlling locomotives.
The Gamepad support must be enabled.
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 Mobile selection |
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, msec=50778792 JsEvent dev=0, type=2, number=5, value=0, msec=50779824
Type 1 is a Button, type 2 are axis.
Setup in Rocview
Possible entries:
- V: button used for acceleration/decelleration
- Repeat: auto repeat interval in case the acceleration button is kept pressed, entry is in in msec.
- smaller numbers get higher repeat rate.
- "0" means autorepeat = off
- Direction: button to change loco direction, in case it is pressed loco will: decelerate , stop, accelerate in opposite direction
- Stop: button to stop the loco
- Decoder steps: defines how much decoder steps are accelerated/decelerated per keypress
- 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 /dev/input/js0 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://www.rocrail.net/doc/rocrail-wrappers/wrapper-en.html#jsmap
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 js 0162 JsEvent dev=0, type=2, number=4, value=0, msec=27128764 20071219.173903.640 g9999D js-reade OJS 0110 handle=9, devnr=0,type=2,number=3, value=0, msec=27128844 20071219.173903.641 g9999I main js 0162 JsEvent dev=0, type=2, number=3, value=0, msec=27128844
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 js 0162 JsEvent dev=0, type=1, number=0, value=1, msec=3162540 20071224.090543.720 g9999I main js 0162 JsEvent dev=0, type=1, number=0, value=0, msec=3162724 20071224.090553.122 g9999I main js 0162 JsEvent dev=0, type=1, number=1, value=1, msec=3172132 20071224.090553.313 g9999I main js 0162 JsEvent dev=0, type=1, number=1, value=0, msec=3172316 20071224.090556.663 g9999I main js 0162 JsEvent dev=0, type=1, number=2, value=1, msec=3175668 20071224.090556.824 g9999I main js 0162 JsEvent dev=0, type=1, number=2, value=0, msec=3175828 20071224.090557.689 g9999I main js 0162 JsEvent dev=0, type=1, number=3, value=1, msec=3176692 20071224.090557.852 g9999I main js 0162 JsEvent dev=0, type=1, number=3, value=0, msec=3176860
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="1" updown="5" repeat="500" reverse="4" stop="6" light="5" f1="0" f2="1" f3="2" f4="3" poweron="8" poweroff="7"/>