Skip to content
View in the app

A better way to browse. Learn more.

The AVSIM Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Switch with more than 2 positions - StreamDeck

Featured Replies

I am using Axis and Ohs with the StreamDeck plugin. I can use it successfully with a 2 position switch.

Is there a technique for a switch with more than 2 positions - sav with local variable values of 1,2,3? if so can you please provide an example.

Allan

  • Commercial Member

This is done with RPN scripts, using the iseq operator and a SliderGauge Action on the StreamDeck. The exact implementation depends on what kind of switch and variable it is. In essence you create an image strip with the different switch positions that the SliderGauge then pushes to the correct position using the switch variable. The iseq script moves through all the values of the variable in a sequence that you can choose (0-1-2-0-1-2... or 0-1-2-1-0-1-2.. or something completely different)

At the beginning, I'd suggest downloading a ready made StreamDeck profile from flightsim.to. That should contain a few examples for this.

Edited by Lorby_SI

LORBY-SI

I used this example code from the PDF manual for AAO to help me figure out how to do it. You can expand this to have even more positions. It's in section 5, scripting.

"Example: handling an LVar that can have three values 0, 1 and 2. This simulates a three-state switch 
cycling 0-1-2-1-0-1-2... with every click of a button
– The script is in the group „Pattern“ and has been called „Lvar_0_1_2_1_0“
– The code of the script is using two parameters, param1 is the LVar being handled, param2 is a 
local LVar storing the direction in which the switch is moving (0 = up, 1 = down)
(param1)·s0·
(param2)·s1·
l0·0·==·if{·l1·0·==·if{·1·s2·}·els{·1·s2·}·0·s1·}·
l0·1·==·if{·l1·0·==·if{·2·s2·}·els{·0·s2·}·}·
l0·2·==·if{·l1·0·==·if{·1·s2·}·els{·1·s2·}·1·s1·}·
l2·(>param1)·
l1·(>param2)·"

and this was the more specific actual code shown for a 3 position fuel switch.

"(L:SWS_FUEL_Switch_Pump_1, Enum)·s0·
(L:SwitchFPDir)·s1·
l0·0·==·if{·l1·0·==·if{·1·s2·}·els{·1·s2·}·0·s1·}·
l0·1·==·if{·l1·0·==·if{·2·s2·}·els{·0·s2·}·}·
l0·2·==·if{·l1·0·==·if{·1·s2·}·els{·1·s2·}·1·s1·}·
l2·(>L:SWS_FUEL_Switch_Pump_1, Enum)·
l1·(>L:SwitchFPDir)"

On the streamdeck, I have it setup for each press cycling the switch and reading the variable set to set the status of the switch icon. This works too if you expand it for rotary switches i.e. the caravan volt meter is a 4 way and the weather radar on the Blacksquare planes is a 7 way. 

 

 

 

 

Edited by bazonkers
added more info

  • Commercial Member

iseq: Here is an example for a 3 position BVar with the values 0, 1 and 2. 

0·1·2·1·(B:FUEL_Selector_1)·(L:KA_TANKSEL_IDX)·4·iseq·(>B:FUEL_Selector_1_Set)·(>L:KA_TANKSEL_IDX)

The LVar name is completely random, it is used only in this script to memorize the last position of the switch.

There is also the "seq" operator for simple sequences.

Check out the AAO manual, there is a table with all RPN operators in the chapter "Scripting".

Edited by Lorby_SI

LORBY-SI

Archived

This topic is now archived and is closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.