3 pos Switch for External Power Unit

Questions about deployment and use of Air Manager Instruments

Moderators: russ, Ralph

Message
Author
User avatar
skymed
Posts: 46
Joined: Thu Mar 26, 2020 6:29 pm
Location: East Coast, Canada.

Re: 3 pos Switch for External Power Unit

#11 Post by skymed »

thank you...I have those sorted, but its the logic of the switch thats the issue......once the switch behaves as I want ( without any data refs) the datarefs are then easy to apply with "if elses".

The switch operation is the one stumping me as a multi position switch in air manager works well with the wiki code i quoted earlier if its a rotary type switch but not well with a multi-position toggle switch as the one im trying to make work.

User avatar
Ralph
Posts: 7933
Joined: Tue Oct 27, 2015 7:02 pm
Location: De Steeg
Contact:

Re: 3 pos Switch for External Power Unit

#12 Post by Ralph »

The position of the switch has to be set by the simulator. Therefore it is important to know the output from the simulator.

User avatar
skymed
Posts: 46
Joined: Thu Mar 26, 2020 6:29 pm
Location: East Coast, Canada.

Re: 3 pos Switch for External Power Unit

#13 Post by skymed »

I want to set the switch to a position and have the simulator react to that , not the other way round.

If the switch is up the GPU is on, if down the battery powers the bus and in the middle all power is off.

User avatar
Ralph
Posts: 7933
Joined: Tue Oct 27, 2015 7:02 pm
Location: De Steeg
Contact:

Re: 3 pos Switch for External Power Unit

#14 Post by Ralph »

That's not how it works. The simulator has to set the position, the simulator is always leading. The only thing you can do is ask the simulator to go to a certain switch position.

Lets say you set your set your switch to position 2 in your script, you say to the simulator to go to position 2, but the simulator says: "not today mate!" You'll have a discrepancy between your visual switch and the switch in the simulator.

Therefore: the switch position has to come from the simulator.

User avatar
jph
Posts: 2857
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: 3 pos Switch for External Power Unit

#15 Post by jph »

Hi @skymed
Take it to the private 'AM Sim Hardware / Pro User forum/server we use as usual ;) - drop me a line :D
Joe
Joe. CISSP, MSc.

SimPassion
Posts: 5346
Joined: Thu Jul 27, 2017 12:22 am

Re: 3 pos Switch for External Power Unit

#16 Post by SimPassion »

Hi @skymed, as Ralph mentioned, this is already reported here :
https://siminnovations.com/wiki/index.p ... ommended!)

Code: Select all

-- This is the recommended pattern to use when creating switches in your instrument

-- 1: The user clicks on the switch
-- 2: The switch_callback function is called (called 'callback' in this example)
-- 3: The instrument logic will send some kind of command to the flight simulator (in this case turn on/off the avionics) 
-- 4: The flight simulator will respond with a new state
-- 5: The instrument will set the switch accordingly

-- Using this pattern, the flight simulator determines the position the switch should have. This way all instrument switch states will be syncronized.

Post Reply