Encoder Modes

SDC Supports the use of a rotary encoder. The encoder can be connected directly to the device, or alternatively can be used to control other devices remotely via the canbus.

As of version 1.40, encoder mode configurations are moved from the ini file to the pages xml definition. The rest of this explanation refers to versions from 1.40 and later. Use the screen designer to configure them.

In version 1.40 and above, configuration of the encoder modes has been moved to the pageset. The configuratiuon is now stored in the XML file that represents the pageset rather than the INI file (although some encoder settings remain there as they are global). This allows a different set of encoder configuration to be defined for each pageset.

The encoder modes are now configured from a dialog witihn the screen designer. To access them, press the “Encoder Modes…” button at the bottom right of thes screen designer window. A new dialog will open allowing the addition, deletion, or editing of up to 255 encoder modes. Note that there is no mode zero; modes start at 1 as they always have.

The encoder modes window includes an ‘import from ini file’ facility. This is to existing configurations to be migrated from the ini file to one or more pagesets. This must be done to keep the encoder working, as ini file encoder settings are ignored from version 1.40 onwards.

How Encoder Modes work

Encoder modes probably require a bit more detail for you to understand how to use them. The concept is that the encoder can be in one of up to 255 modes, enabling multiple sets of actions to be defined, and the active set is determined by the current encoder mode number.

By default, when the system boots, the encoder will be in mode 1. What actually happens in each mode is defined entirely by the actions that are specified in your pages xml definition, plus any specific settings on any Touch Gauges. Each mode can have its own set of left, right, and press settings. The touch actions defined in the settings allow the mode to be changed, thus you can jump between sets of actions as needed.

Here is an example definition and a description of how it works:

If you imagine a single screen system with a rotary knob, the most logical action for that knob when it is rotated is to cycle through the available pages on the system. However, you may also be using that screen to control another screen, or may have some settings you want to control such as speed limiter settings. Therefore it is useful if pressing the button on the encoder will bring up a menu. That is what the above example does:

  • The menu is on page 4.
  • When the system starts, the encoder mode is 1. Therefore rotating the knob changes to the next or previous page, and pressing the knob executes the actions encodermode=2;page=4 which changes the encoder mode to 2 and displays page 4 on the screen.
  • Now that the encoder mode is 2, twisting the knob now executes “PREVCONTROL” and “NEXTCONTROL” because the ‘2’ settings are active. Therefore page 4 is your menu page and can contain a series of Touch Gauges. Pressing the knob executes the action on the selected touch guage (the ‘go’ action).
  • To get back to mode 1, you can add an “EXIT” button to your menu page which includes the ENCODERMODE=1;page=<n> action. This changes the encoder mode back to mode 1 and selects a regular page.

The next and previous page actions will select the next page whose ‘carousel’ setting is enabled. Pages not flagged as part of the carousel will not be displayed unless directly accessed via a touch action. The order of pages is as defined in the XML file and you can change this order using the screen editor.

Instead of setting the page number to a specific page, the mode 1 press action could say encodermode=2;storepage;page=4 and the action on the exit touch gauge could say encodermode=1;restorepage. This would enable jumping to the manu page and returning back to the page you jumped to it from on pressing the exit button.

In all encoder modes, if the left or right action is left blank, the system looks at the left or right action specified in the control that is currently highlighted (currently only supported by the TouchGauge). If this is defined, then it is executed instead. This enables a touch gauge to be given a specific left and right action which is used to handle more complicated scenarios such as altering the value of a setting.

Encoder Mode 3

Mode 3 is treated slightly differently than the other two. When in mode 3 the currently highlighted control is not cancelled after 15 seconds like it is in the other modes. Therefore you should make sure you are in mode 3 when altering a setting.

Controlling a setting

To implement a setting using mode 3, you must carry out the following:

  • Add a setting to the ini file with a unique name
  • Put a control on the screen that displays the setting. Typically either a valuegauge or a horizontal gauge.
  • Add a touch gauge over the top of the gauge you added, with outline disabled
  • Set up the rotary left and right actions to empty (see above example) in the Encoder Modes dialog
  • Set up the mode 3 Press action value to be ‘encodermode=2’.
  • Set up the rotary left and right actions on the touch gauge you added to decsetting and incsetting accordingly. See Dec and Inc Settings for details of the format.
  • Set up the ‘go’ action on the touch gauge to be ‘encodermode=3’.

Note: You don’t have to use mode 3 for the setting but the difference in the way it highlights the gauge makes it a bit more user friendly. Also, to use mode 3 you must have modes 2 and 1 defined.

When done this way, with the encoder in mode 2 you will be able to twist the encoder to highlight the touch gauge over the top of the setting, press the button to swap it into mode 3, then twist the encoder again to alter the setting. Finally, you can press the button once more to commit the value and go back to mode 2, enabling other gauges to be selected.