[encoder]

This section is used to specify the inputs that will be used by a rotary encoder, which you can use to rotate through pages or through components on the page, and make selections with.

Setting Type Explanation
enabled Integer 1 or 0 If set to zero, the rotary encoder is disabled.If not present, the default is 0 (disabled). Therefore if you connect a rotary encoder to the system you must enable it by setting this entry to 1.
pin1 Integer Pin number of the Raspberry Pi GPIO pin used for one of the two pins required to decode the rotary input signal
pin2 Integer Pin number of the Raspberry Pi GPIO pin used for the second of the two pins required to decode the rotary input signal
button Integer Pin numer of the GPIO pin used for the momentary button (press). Note that this button is active low i.e. you must wire the button so that the specified pin is grounded when the button is pressed. This is the default for most rotary encoders.
halfstep 1 or 0 Specifies whether the encoder you are using supports a “halfstep” mode. If, when you twist the encoder, the action is executed twice for every notch (e.g. the highlight moves past 2 touch controls instead of 1), then set halfstep to 0. If, when you twist the encoder, then action is only executed every other notch, then set halfstep to 1. If not specified, halfstep is disabled by default.
encodertargetdevice Integer Enables the encoder connected to this device to control the Device ID specified. e.g. encodertargetdevice=3 sends all encoder actions on this device to the device with ID 3 using the canbus. If not specified, this feature is turned off. By specifying a remote device id you can control that device even though the encoder is not connected to it. The actions taken when the encoder is twisted or pressed are those configured in the remote device’s [encoder] section in its ini file. The encoder must be enabled on the local device but set to disabled via enabled=0 on the remote device (otherwise the floating input pins will cause it to behave oddly). Other locally configured encoder actions are ignored when controlling a remote device, and it is not possible to mix both local and remote control. If this setting is present, then any touch actions which set the encoder target device are ignored.

Valid actions

Although pretty much any action from the default set can be taken there are only a small number that are logically useful. These are:

Left and Right actions

  • nextpage - moves to the next page in the xml file (order as per order in the file). Any page used as a composite on another page is excluded from the set you will rotate through. Wraps around back to the first page after the last one is reached.
  • prevpage - moves to previous page, as above but in the other direction. Wraps around from first page to last page.
  • nextcontrol - moves to the next control on the page. The only gauges that will be visited by this action are guages of type “TouchGauge”.
  • prevcontrol - same but opposite direction.

Press action

  • go - executes the touch action on the currently highlighted touch gauge.
  • **encodermode=** - changes the encoder mode to the specified mode number
  • page=<page number> - changes the page number
  • storepage Stores the current page number.
  • restorepage Changes the current page number to the stored page number.

The ‘go’ press action would normally be used if you are implementing an icon based menu system. In which case you would likely use “nextcontrol” and “prevcontrol” for the rotary actions.

If the highlight or page moves counter intuitively, then swap the left and right actions over.

For more details on how to define and use encoder modes, see the Encoder Modes section in the Screen Designer help.