Jump to content

Using BUS LOOKUP etc. variables in Streamdeck


bazonkers

Recommended Posts

I'm puzzled at how to solve this and was hoping you might have an answer. I'm trying to get the status of circuits in MSFS to show up on a streamdeck. To find the BUS CONNECTION status, you need to pass a BUS LOOKUP INDEX to it first.

I can read the A:BUS·CONNECTION·ON var but without passing the LOOKUP INDEX first, it assumes it's always BUS 1. This actually works fine for me on one plane that has everything on BUS 1. 

I'm trying to implement this on something more complex though and can't figure out having streamdeck use other BUS values.

I can get a status using a local variable but only if I toggle from streamdeck. It gets out of sync (expectedly) as the sim doesn't update that local var.

Is what I'm trying to do possible?

Link to comment
Share on other sites

  • Commercial Member

Tricky. Unfortunately using type "S:" and RPN code in the read variable doesn't help, because it does not really execute the script, it only calculates the final value.

Try adding the necessary code on the SD actions' "autoscript" section

3 (>A:BUS LOOKUP INDEX, Number) (A:BUS CONNECTION ON:1, Bool) (>L:MyBusStatus1) 

Then you can read the status from the LVar (use a different LVar for each action)

I'm not entirely sure how this will turn out though, the script processing is asynchronous, and the values may be confounded. Can you please post an actual use case (what aircraft model, what I should be looking for) that I can use to test it?

If I'm correct and the variables are getting mixed up, send the scripts to the sim for processing:
(SIMPROC) 3 (>A:BUS LOOKUP INDEX, Number) (A:BUS CONNECTION ON:1, Bool) (>L:MyBusStatus1, Number) 

Another alternative would be to hijack the BVar to LVar feature in AAO. Asobo themselves are writing the bus status into LVars sometimes, for example in the 747 (see 747_8I_INTERIOR.xml, line 1992)

 

Edited by Lorby_SI

LORBY-SI

Link to comment
Share on other sites

I'm working with two airplanes at the moment. The JPL/WBSim Cessna 152 and the BlackSquare Analog C208. I'd guess that any of the BKSQ airplanes work the same in case you have something other than the Caravan. I pulled the BUS/Circuits from AnalogCaravan.xml file. 

On the C152, I have scripts to trip and reset the circuit breaker. This example is for the Strobe Light. I can call the script as normal in the stream deck, no issues here. 

5·1·(>K:2:ELECTRICAL_BUS_TO_BUS_CONNECTION_TOGGLE)

Because this on BUS 1, CIRCUIT 5, reading only A:BUS·CONNECTION·ON:5,·Bool in the stream deck works to find the status because it assumes BUS 1 without any other parameters. This is OK because all the breakers in this plane are on BUS 1. I have an OnOff button created with my toggle script in the Write Event boxes with 1 being on and 0 being off. My read variable is A:BUS·CONNECTION·ON:5. This works great and I can trip/reset the breakers and the stream deck is getting the current value from the sim. If I manually trip it in the sim with the mouse, the stream deck will update the status. 

In the Analog Caravan, it's a more complex plane so there are more circuits. I have identified all the circuit breakers in the plane and are able to trip and reset them from the stream deck with a similar script. This script trips and resets the breaker in Row 3, Column 5 for the OIL TEMP. 

19·4·(>K:2:ELECTRICAL_BUS_TO_CIRCUIT_CONNECTION_TOGGLE)

This one however, is on BUS 4. CIRCUIT 19 so I can't just query the status with  A:BUS·CONNECTION·ON:19 as it assumes BUS 1. I need to pass the BUS number to it first with this code:

4·(>A:BUS·LOOKUP·INDEX,·Number)·(A:BUS·CONNECTION·ON:19,·Bool)

As part of figuring this out, I also created a script based on a previous post of yours that I found that was the code you suggested:

(SIMPROC) 4 (>A:BUS LOOKUP INDEX, Number) (A:BUS CONNECTION ON:19, Bool) (>L:R3C5Status, Number) 

I can trip/reset the breaker with this code and use L:R3C5Status, Number as my read variable which works great on the stream deck as long as it's the only thing toggling the circuit breaker. If I trip it with a mouse click or I execute a script with 1·(>H:BKSQ_FAILURE_OIL_TEMP_GAUGE) to trigger a system failure, the status of the breaker doesn't update on the stream deck. 

I appreciate your help! 

Link to comment
Share on other sites

  • Commercial Member
47 minutes ago, bazonkers said:

the status of the breaker doesn't update on the stream deck. 

Configure your script to run as an Aircraft Automated Script every 250ms or so. Or use the Autoscript field in the StreamDeck action (if it has one)

Edited by Lorby_SI

LORBY-SI

Link to comment
Share on other sites

Thanks for the help, this idea should work but I've run into a snag trying to implement it. I've also run across this same issue when trying to use BUS LOOKUP on figuring out switch status to match the stream deck.

As per the above, I'm able to toggle circuit breakers and some switches with:

6·3·(>K:2:ELECTRICAL_BUS_TO_BUS_CONNECTION_TOGGLE)

I'm assuming it's updating the bool status of the connection with a 1 or a 0 and I can see switch movement and other annunciator alerts for this particular toggle so I know it's doing something. 

I tried using the code to get the status of this variable by writing it to L:AAO_status63 but the value never changes. 

6·(>A:BUS·LOOKUP·INDEX,·Number)·(A:BUS·CONNECTION·ON:3,·Bool)·(>L:AAO_status63,·number)

I've tried L:AAO_status63,·number, L:AAO_status63,·bool and just writing to L:AAO_status63 and no luck. I'm using one of your TextGauge addons to read and display the variable for troubleshooting this. 

Am I way off base with my scripting to query the status?

Edited by bazonkers
Link to comment
Share on other sites

I went back and carefully re-read your earlier post in this thread and I see my code is basically the same except I forgot to try (SIMPROC) with it. I'll test and see what happens. 

EDIT: lol I also carefully re-read MY earlier post where I forgot I actually solved this. This bus index thing is breaking my brain. Thanks for the help, your tool is a life saver! 

Edited by bazonkers
added info
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...