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

#31 Post by monkeysuncle »

Hi Tony,
Yes I hadn’t decided which event I wanted to use yet so I put both in the with the intent of cleaning up the code and adding comments when I got it working the way I want.

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

Re: Controlling Panel Visibility with Device Switch

#32 Post by JackZ »

A bit more verbose code but probably easier to understand.
No need for two ifs.
No need for the avionics subscribe either, as Tony said since you don’t use it.

Code: Select all

img_mask = img_add_fullscreen("mask.png")

function new_data_fsx (Battery,Avionics)
    if Battery == true then 
        visible(img_mask, false)
    else
        visible(img_mask, true)
    end
end — missing end to close the function added

fsx_variable_subscribe("ELECTRICAL MASTER BATTERY", "Bool",
                    "CIRCUIT AVIONICS ON", "Bool",
                    new_data_fsx)
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

#33 Post by monkeysuncle »

Here is my result:
img_mask = img_add_fullscreen("mask.png")

function new_data_fsx (Battery)
visible(img_mask, not Battery)
end

fsx_variable_subscribe("ELECTRICAL MASTER BATTERY", "Bool", new_data_fsx)
Does exactly what I wanted to do!

As a thank you, I've uploaded the instrument to the store, as "Generic Panel Dimmer." My first instrument!

I also took what I learned and customized my Digital OAT instrument to turn the LED panel on/off with the battery.

Thanks every for the help!
Dave
Attachments
IMG_5345.jpg
IMG_5346.jpg

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

Re: Controlling Panel Visibility with Device Switch

#34 Post by Sling »

Glad you got what you wanted. Be best to post the .siff file here if you want to share as this is not really an instrument and it’s specific to your application. Not really for the store.

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

Re: Controlling Panel Visibility with Device Switch

#35 Post by JackZ »

Glad to know that you achieved what you wanted.
I understand that the panel with holes and recess is a Cessna original one?
Nice result!

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

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

Re: Controlling Panel Visibility with Device Switch

#36 Post by jph »

JackZ wrote: Sun Jul 04, 2021 5:17 am Glad to know that you achieved what you wanted.
I understand that the panel with holes and recess is a Cessna original one?
Nice result!

Jacques
Agreed, Looks superb. The actual facia does appear to be original with 3D printed bezels. Amazing result.
It would make a REALLY nice project for a CNC router with 12mm MDF and 'crinkle' finish paint also. Really gives me some ideas.
Beautiful work.
Joe
Joe. CISSP, MSc.

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

Re: Controlling Panel Visibility with Device Switch

#37 Post by monkeysuncle »

Crinkle finish! Stop giving me ideas! I have to stop building and start learning more than the basics.

Yes, its a real Cesssna 182RG panel, as is the sweet trim below the switch panel with the breakers. That was a great EBay find. I embraced the worn look of the real panels, it gave me permission to make mistakes and changes, without worrying about wrecking something pristine.

Thanks for all the feedback and kind words!

Post Reply