Controlling Panel Visibility with Device Switch
-
- Posts: 60
- Joined: Tue Nov 20, 2018 9:34 pm
Re: Controlling Panel Visibility with Device Switch
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.
- Keith Baxter
- Posts: 4685
- Joined: Wed Dec 20, 2017 11:00 am
- Location: Botswana
Re: Controlling Panel Visibility with Device Switch
Dave,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.
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.
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
- Keith Baxter
- Posts: 4685
- Joined: Wed Dec 20, 2017 11:00 am
- Location: Botswana
Re: Controlling Panel Visibility with Device Switch
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
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
Re: Controlling Panel Visibility with Device Switch
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 aroundmonkeysuncle 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
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 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
https://www.youtube.com/playlist?list=P ... 0Q6SBASRqJ
-
- Posts: 60
- Joined: Tue Nov 20, 2018 9:34 pm
Re: Controlling Panel Visibility with Device Switch
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!
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!
Re: Controlling Panel Visibility with Device Switch
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
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
https://www.youtube.com/playlist?list=P ... 0Q6SBASRqJ
- Keith Baxter
- Posts: 4685
- Joined: Wed Dec 20, 2017 11:00 am
- Location: Botswana
Re: Controlling Panel Visibility with Device Switch
@Corjan
I can confirm that the panel switching when airframe is changed is now working 100% in AM4.1 beta.
Thank you.
Keith
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
-
- Posts: 60
- Joined: Tue Nov 20, 2018 9:34 pm
Re: Controlling Panel Visibility with Device Switch
Thanks, Jacques! I do have a lot to learn!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
-
- Posts: 60
- Joined: Tue Nov 20, 2018 9:34 pm
Re: Controlling Panel Visibility with Device Switch
Keith Baxter wrote: ↑Tue Jun 29, 2021 5:31 pmHi Dave,monkeysuncle wrote: ↑Tue Jun 29, 2021 3:41 pmHI! 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.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.
Thanks!
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)
Re: Controlling Panel Visibility with Device Switch
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
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
Air Manager panels at https://www.experimentalsimavionics.com
Youtube Channel https://www.youtube.com/channel/UC8ZqXX ... kfZMq5BKig
Air Manager API Tutorial Video Series https://youtube.com/playlist?list=PLNr0 ... baT4gJKg5D
Youtube Channel https://www.youtube.com/channel/UC8ZqXX ... kfZMq5BKig
Air Manager API Tutorial Video Series https://youtube.com/playlist?list=PLNr0 ... baT4gJKg5D