Controlling Panel Visibility with Device Switch

Peer support for Air Manager desktop users

Moderators: russ, Ralph

Message
Author
monkeysuncle
Posts: 60
Joined: Tue Nov 20, 2018 9:34 pm

Re: Controlling Panel Visibility with Device Switch

#21 Post by monkeysuncle »

I will try all of these suggestions, thank you all! This is for my steam gauges, so, yes, it may not make total realistic sense, but I'd like to overlay a semitransparent mask to simulate panel lighting turning on, probably with the battery switch.
IMG_4405.jpg

User avatar
Keith Baxter
Posts: 4674
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Re: Controlling Panel Visibility with Device Switch

#22 Post by Keith Baxter »

monkeysuncle wrote: Tue Jun 29, 2021 6:01 pm I will try all of these suggestions, thank you all! This is for my steam gauges, so, yes, it may not make total realistic sense, but I'd like to overlay a semitransparent mask to simulate panel lighting turning on, probably with the battery switch.
Dave,

For that you can add another dataref and change the opacity depending on the lighting.

It is probably better to change the opacity of the panel though.

Panel code and lua I am not tooooo sure of.
Whilst I asked for panel code some years back I just did what Corjan told me to do in the first place. :mrgreen:

Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board,  32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card 

User avatar
Keith Baxter
Posts: 4674
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Re: Controlling Panel Visibility with Device Switch

#23 Post by Keith Baxter »

Hi,

This principle is what Jacques is talking about glass instruments. So many things can be done with AM. It is such a wonderful and powerful product. Just takes a bit of thought and who know what one can achieve.

This instrument starts with the code I posted. It also has a back-lighting feature. Still to be implemented.





Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board,  32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card 

JackZ
Posts: 2262
Joined: Mon Feb 22, 2016 1:02 pm

Re: Controlling Panel Visibility with Device Switch

#24 Post by JackZ »

monkeysuncle wrote: Tue Jun 29, 2021 6:01 pm I will try all of these suggestions, thank you all! This is for my steam gauges, so, yes, it may not make total realistic sense, but I'd like to overlay a semitransparent mask to simulate panel lighting turning on, probably with the battery switch.

IMG_4405.jpg
Nice setup! The only thing that puzzled me was the strange position of the Airspeed indicator apparently located below the Turn indicator, this is usually the other way around

I noticed that your steam gauges are using (dummy?) light poles for instrument lighting, which was the way to go before instruments had internal lighting.
Why don't you use these poles to effectively light the screens? Would be way more realistic
I know a guy in France that sells such items for sim purposes, with a led already embedded, ready for 5V or 12Volts power supply
image.png
https://efde.fr/index.php?id_product=5 ... cklight-5v

Jacques
My YouTube Chanel on the A320 (Real SOPs by an Airline Pilot IRL):
https://www.youtube.com/playlist?list=P ... 0Q6SBASRqJ

monkeysuncle
Posts: 60
Joined: Tue Nov 20, 2018 9:34 pm

Re: Controlling Panel Visibility with Device Switch

#25 Post by monkeysuncle »

Yes the airspeed and turn coordinator are swapped. Good eye! The panel I found on eBay had an indentation for an encoder on the bottom so that’s where I put the airspeed. I could swap them though.

I’m happy with my dummy lights: I modeled them myself and 3D printed them. To be honest I can’t take on any more building, I need to get going and learn something!

And just now I think my PSU just failed so I’m very cranky.

Thanks for the great input though!

JackZ
Posts: 2262
Joined: Mon Feb 22, 2016 1:02 pm

Re: Controlling Panel Visibility with Device Switch

#26 Post by JackZ »

The relative gauges position of a standard six pack is set to help for a natural instrument scan, especially in instrument flying where the sole reference of airplane attitude is coming from these instruments. The traditional instrument scan is centered on the artificial horizon (or ADI) and is T-shaped.

The Turn coordinator is considered for this respect as a « secondary instrument », that is it should be included in the scan only once every three or full scan cycles of the primary instruments, and simply as a confirmation that the information is coherent.
Airspeed is on the other hand considered as a primary instrument as the information it provides is critical in confirming that the current pitch attitude you see on your ADI is coherent with the current speed trend and altitude. Cross checking information here is the key.

Jacques
My YouTube Chanel on the A320 (Real SOPs by an Airline Pilot IRL):
https://www.youtube.com/playlist?list=P ... 0Q6SBASRqJ

User avatar
Keith Baxter
Posts: 4674
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Re: Controlling Panel Visibility with Device Switch

#27 Post by Keith Baxter »

@Corjan

I can confirm that the panel switching when airframe is changed is now working 100% in AM4.1 beta.

Thank you.

Keith
AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board,  32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card 

monkeysuncle
Posts: 60
Joined: Tue Nov 20, 2018 9:34 pm

Re: Controlling Panel Visibility with Device Switch

#28 Post by monkeysuncle »

JackZ wrote: Wed Jun 30, 2021 8:36 am The relative gauges position of a standard six pack is set to help for a natural instrument scan, especially in instrument flying where the sole reference of airplane attitude is coming from these instruments. The traditional instrument scan is centered on the artificial horizon (or ADI) and is T-shaped.

The Turn coordinator is considered for this respect as a « secondary instrument », that is it should be included in the scan only once every three or full scan cycles of the primary instruments, and simply as a confirmation that the information is coherent.
Airspeed is on the other hand considered as a primary instrument as the information it provides is critical in confirming that the current pitch attitude you see on your ADI is coherent with the current speed trend and altitude. Cross checking information here is the key.

Jacques
Thanks, Jacques! I do have a lot to learn! :)

monkeysuncle
Posts: 60
Joined: Tue Nov 20, 2018 9:34 pm

Re: Controlling Panel Visibility with Device Switch

#29 Post by monkeysuncle »

Keith Baxter wrote: Tue Jun 29, 2021 5:31 pm
monkeysuncle wrote: Tue Jun 29, 2021 3:41 pm
navymustang wrote: Mon Jun 28, 2021 9:52 pm I have a three monitors (15" MFDs with 12 buttons) in my cockpit. Each screen has a black background screen that is visible. in front of all other layers. When the instrument senses that the master battery switch has been turned on, I turn off the visibility of the black screen.

Works great.
HI! Getting back my original post, can someone explain how to do this, or point me to a post that explains it? I like the approach of creating a black instrument that covers everything and just Show/Hide it based on a sim event.

Thanks!
Dave
Hi Dave,

I unintentionally derailed the thread a bit . Sorry for that

This is some code for xplane that will do what you want if I understand you correct.

You will have to find the event if it is for another sim.

If you are still not sure I can assist on the discord and get you up and going with the basics.

Code: Select all

--add a canvas that we will draw objects in later
my_canvas=canvas_add(0,0,1920,1080)

---Draw the canvas with a black rectangle. This could also be a circle or polygon. or multiple of any variants.
canvas_draw(my_canvas,function()

   _rect(0,0,1920,1080)
   _fill("black:)

end)

-- This function will be called when the sim avionics is switched and start show/hide the canvas.
function avionics_callback(av)
--add visibility when the avionics switch value is ==0
   visible(skin_off,av ==0)
end
xpl_dataref_subscribe("sim/cockpit2/switches/avionics_power_on","INT", avionics_callback)

Keith

I've never programmed in LUA before, here is what I've come up with, looking at the code for other instruments. I've created a simple mask image (png) that is 75% transparent grey. When I add it as an instrument that is just an image, it works. But my code to control its visibility with the battery switch has something wrong.

Code: Select all

img_mask = img_add_fullscreen("mask.png")

function new_data_fsx (Battery,Avionics)
    if Battery == true then 
        visible(img_mask, false)
    end
    if Battery == false then 
        visible(img_mask, true)
end
    
fsx_variable_subscribe("ELECTRICAL MASTER BATTERY", "Bool",
                    "CIRCUIT AVIONICS ON", "Bool",
                    new_data_fsx)
                   

User avatar
Sling
Posts: 5237
Joined: Mon Sep 11, 2017 2:37 pm
Contact:

Re: Controlling Panel Visibility with Device Switch

#30 Post by Sling »

Hi,

That’s a good start but you have a missing end in the subscribe callback which is why it’s not working. Rather do what you are doing in that callback it’s simpler to just do this. This simply makes the mask visible when the battery state is not true (false).

visible(img_mask, not Battery)

On another point I see you are subscribing also to the avionics variable but you are not using it. I guess you may experiment with it which is why it’s there. For completeness, it’s good practice to remove anything you don’t actually use when done.

Tony

Post Reply