Encoders
The encoders element consists of a list of encoders. Each encoder object can contain the following elements.
| Element | Mandatory | Description |
|---|---|---|
index |
Index of the encoder. 1-8 for layer A, 9-16 for layer B | |
event_up |
The event to execute for CW rotation ticks | |
event_down |
The event to execute for CCW rotation ticks | |
alternate_event_up |
The alternate event to execute for CW rotation ticks | |
alternate_event_down |
The alternate event to execute for CCW rotation ticks | |
event_press |
The event to execute when the button is pressed down | |
event_short_press |
The event to execute when the button is pressed and released | |
event_long_press |
The event to execute when the button is pressed for 0.5 seconds and released |
Event up, down
The most basic configuration of an encoder just consists of the index and the event_up / event_down. The next example modifies the Baro setting of the airplane. It does this by sending the KOHLSMAN_INC event when the encoder is rotated CW and sending the KOHLSMAN_DEC event for CCW rotation.
{
"index": 1,
"event_up": "KOHLSMAN_INC",
"event_down": "KOHLSMAN_DEC",
},
Event press
The event_press, event_short_press and event_long_press give the option to fire off an event when a button is pressed.
{
"index": 1,
"event_up": "KOHLSMAN_INC",
"event_down": "KOHLSMAN_DEC",
"event_press": "BAROMETRIC"
},
Alternate events
Sometimes you want to have a single encoder control multiple things. This can be achieved by setting up an alternate. The next example shows how to control the NAV1 radio. The encoder is able to control the whole increments and the fractional increments. When the button has a short press it sees the {alternate} keyword and therefore knows that the encoder must be switched between whole and fractional.
{
"index": 6,
"event_up": "NAV1_RADIO_WHOLE_INC",
"event_down": "NAV1_RADIO_WHOLE_DEC",
"alternate_event_up": "NAV1_RADIO_FRACT_INC",
"alternate_event_down": "NAV1_RADIO_FRACT_DEC",
"event_short_press": "{alternate}",
"event_long_press": "NAV1_RADIO_SWAP"
},