UNPKG

node-red-contrib-xkeys_joystick

Version:

Xkeys joystick node for Node-RED using DCD Protocol

54 lines (35 loc) 3.37 kB
<p>X-keys input node, sends changes from the joystick control. Generates a <code>msg.payload</code> with X,Y,Z and delta Z info when the handle is moved. This node is only for the X,Y,Z data from the joystick.</p> <h3>Properties</h3> <p>By default this node will send analog events for any joystick on any X-keys connected by the USB. By setting these properties the node will only send events matching the desired criteria.</p> <li><b>Device:</b> Select from the list the name of specific source X-keys </li> <li><b>Product ID:</b> A specific PID can be set, usually the device name is sufficient and this can be left to the default.</li> <li><b>Unit ID:</b> A specific Unit can be selected, this is useful if there are 2 indentical X-keys. Each one can have a different UID if set using the xk Set Unit ID node. </li> <li><b>Controller #:</b> An Index if there are more than one joystick on one X-keys. Currently all units only have one. Leave this value at the default.</li> <h3>Outputs</h3> <p><code>msg.payload</code> An object that contains the compete information from the input event</p> <li><code>msg.payload.device</code> is an abbreviated name of the source device e.g. XK12JOYSTICK which represents the XK-12 Joystick device </li> <li><code>msg.payload.pid</code> is the Product ID of the source device e.g. 1065 for the XK-12 Joystick </li> <li><code>msg.payload.uid</code> is the Unit ID of the source device, typically 0 from the factory but assignable 0-255 using the xk Set Unit ID node </li> <li><code>msg.payload.index</code> is the Controller # which caused the event, default is 0 for devices with only 1 joystick. </li> <li><code>msg.payload.x</code> is the X motion, 0 to 127 from center to full right, 0 to -127 from center to full left. </li> <li><code>msg.payload.y</code> is the Y motion, 0 to 127 from center to full up, 0 to -127 from center to full down. </li> <li><code>msg.payload.z</code> is the Z Position, twist of stick, absolute 0 to 255, rolls over. </li> <li><code>msg.payload.delta_z</code> is the integer value of the change of the Z position since last read. Positive =CW, Negtive =CCW </li> <h3>Details</h3> <p>This node is used to get analog changes events from a Joystick on a connected X-keys. The xk button node would be used to get the button events. </p> <p>The X and Y axis are typical for a joystick. The Z (rotation of stick) is an absolute position; it is static and does not return to zero by a spring as a typical joystick. The delta_z payload compares the current value to the last value and accounts for the zero crossing of the position value. </p> <p>Several filters can be set in the node’s properties to make the node respond to specific X-keys and/or specific actions. Alternatively, the payload may be passed on to a switch node to branch the flow for each type of action or device. </p> <p>This node requires the X-keys Server to be installed. X-keys server requires an MQTT broker, which also must be installed.</p> <h3>References</h3> <ul> <li><a href="https://www.xkeys.com">For a full description of all X-keys products</a></li> <li><a href="https://gitlab.com/chris.willing/xkeys-server">X-keys server installation</a></li> </ul>