MobiFlight Community Support

Welcome to the forum for MobiFlight! Feel free to reach out to the community in case you have questions, issues or just want to share great ideas or details about your latest home cockpit project.

You like MobiFlight? Donate via PayPal and support the MobiFlight development. Thanks! 

05/03/2024 - This forum is read-only

The community support for MobiFlight has moved exclusively over to our Discord server. Register for free and enjoy more interactive functions like image and video upload, voice chat. More than 7,000 registered users around the world make it a great experience!

See you on our MobiFlight Community Discord server.

A HUGE Thank You to everyone who participated in the forum, especially obviously to Pizman and Stephan who did an outstanding job over so many years providing an incredible service to the MobiFlight community.

The forum is still providing a lot of good content, hence we keep this information accessible.

icon
Avatar
TheGerman
Posts: 9
I draw blanks when trying to figure out how to configure this:
- I got a switch (let's take VNAV on the MCP, PMDG 737) that is set up and working correctly
- Inside the switch, I have a LED that is tied to "PMDG_B737-7_MCP_VNAV_IND", so when the switch/VNAV is active, the LED turns on. Works well.

The question is, how can I set the PWM value for this switch? The "PMDG_B737-7_MCP_VNAV_IND" only provides on/off value and when I try to add a config reference (a MF variable 0-255), it dims the LED nicely, but does so independent of the "PMDG_B737-7_MCP_VNAV_IND" status. Goal is to use the MF variable for PWM values only if "PMDG_B737-7_MCP_VNAV_IND" = 1. So an "IF" clause needs to be added "somewhere"... Where is the big question :-)
2023-01-12 15:55
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6010
Supporter
Hi

Solution is simply Math:

The MF Variable you use is controlled i expect by a other thing ( e.g. a PMDG Value or a Encoder/Poti ...: Right?

So we got 2 Factors now.... The Value of the System ( 1 for ON 0 for OFF) .... And the Value of the Variable to define the Bright.

How to do....

1. Get sure the LED is connect on a Arduino via a PWM Pin. You can only controll Brightness/PWM on Pins that support this.
2. Read out the MF Variable in a own Output Config .... Lets call it e.g. "BrightState".

3. Create a Output Config for the LED itself.... Read here the Variable for the System.... In your case the the VNAV INDication.
Then enable in this config a "Config Refference/Placeholder" ( Lower area of the Tab)
Choose here for the Output Config "BirghtState" we create before.... And choose for a symbol.... lets say "a"

Finally you need a Transform and say there.... $*a

If Function is Off then value of Config is 0 .... So $*a means 0*a .....
Its no mater if Bright State is 0,1, or 255.... 0*0=0 .... 0*1=0 ....0*255=0 .... So LED is always OFF.
If Function is ON then Value is 1
Lets say Bright is 255 a.t.m. ..... Then 1*255= 255
If Bright is just 80 then 1*80=80
Good Luck !
2023-01-12 20:58
Avatar
TheGerman
Posts: 9
Thanks for the quick response!
I ended up creating two items per LED (on and off state) and two more variables for the brightness in FS as well as the "bright/dim" switch. Works nicely - that way, I could even get the "Test switch" to turn on all LEDs (so far only MCP, but the concept obviously is the same for the rest)...
2023-01-12 22:41
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6010
Supporter
iconTheGerman:

, I could even get the "Test switch" to turn on all LEDs (so far only MCP, but the concept obviously is the same for the rest)...



Here i not 100% sure how the PMDG work in FS2020.....

Within the years we got 4 different B737 from PMDG....
The "NG" (FS9 and FSX) .... the "NGX" (FSx and P3D) .... the "NGXu" (P3Dv5) .... and the new B737 for FS2020.

The first ones not include Battery or Lighttest Information.....
So e.g. the Gear Down Green LED just show if Gear is Down or not.....
If Gear is down but no Power was in Aircraft (Battery Off) the Data still show "1" cause gear was down already.
Inverted.... If you was inflight and Gear was Up the LED was OFF.... If you pressed Lighttest button the Virtual LED light but Offset was still "0" cause gear was Up in real.

As i know meanwhile the Offsets in FSUIPC ( and hopefully also the Simconnect Varibles ) include already this logics.

If not then you need to use our old workaround......

1. Read the Status of BatteryMaster ..... By read the Switch Position or the currend DC/AC Voltage.... To know if Cockpit is powerd.
Logic: Value 1 if powerd.... Value 0 if Not.
2. Read the Status of Light test.... Again by read the switch..... Logic: 1 if Active .... 0 if not.

Those 2 Configs are GLOBAL an will be used as "Refference" in all other needed configs like all LED.

3. In each LED Config you define this two Configs as placeholder Refference... eg.Lighttest =A and Batterystate = B

4. in all Transforms you say.... ($+A)*B

RESULT:
A is lighttest.... We expect its "1" if ON and "0" if OFF.
So if a function is currently OFF (0) and Lighttest is pressed then formula say 0+1=1 .... Means it will light whatever its Off.
If Function is already ON (1) then it says 1+1=2 .... So it will also light.... Cause all except 0 means LED is ON... 1,2,3,9999999 All is ON.

The second Part *B is the Battery State Logic.....
If Batery is ON (1) then we say x*1=x .... So a currently Lighted LED is still lighted.... A Currently OFF led is still OFF.
But if Batery is OFF then its "0" .... x*0 = 0 .... So whatever LED is ON at the moment it getting OFF ..... 1*0=0 .

*************
I hope this is no longer a fact....
Just to help you if on some spots PMDG not include this !
Good Luck !
2023-01-17 02:06
icon