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! 

icon
Avatar
pluckas
Posts: 104
Supporter
Hi all,

Apologies if this has already been covered. A quick search revealed a couple of similar but unresolved posts.

I’m considering how to control the ‘blue’ overhead annunciators that have two levels of brightness. In the case of the fuel crossfeed valve, the annunciator glows more bright while the valve is opening (ie, moving), and then is dimmed while open and off while closed.

The idea is to use an annunciator with two separate LED circuits:

Control one of the two LEDs using the conventional PMDG offset.

Control the second LED using some sort of condition; “when the fuel crossfeed switch is activated, enable the LED for 10 seconds”.

Is the second option possible in the latest version of Mobiflight? I haven’t done a lot of conditional programming and any advanced configuration I have done in Mobiflight is many months behind me.

Any pointers gratefully received.

Thanks,

Paul
2019-09-27 03:27
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 5501
Supporter
NO. Not directly.

At first Mobiflight not work with "timers" . So its not possible to say " Do something for 10 seconds" .
Here Mobiflight is "stupid" .... It just show the value of the Offset.... Is it 1 then its ON is it 0 then its OFF.

The main Problem in this situation is PMDG. Here you see the difference from a 90$ B737 and a 1000$+ System ( Maby like Prosim but i not know if PS realy include this)
In Virtual Cockpit the LED is working in 2 states.... But PMDG export only ONE Status to the Offset. So i can not see if the value of the dimmed LED is realy existing OR if PMDG do the same like you planned for and build a little timer inside there code that simply say "light for 10 seconds". But summary..... We not be able to READ this status.

A "good" AddOn Aircraft would simply support that Data to a Offset..... And then we can read it.

******************
About Hardware:
Here i agree. There will be also a way to work with one LED that is powered with 2 different lines (different resistors to have 2 different light levels) ..... But i think its more easy to simply connect 2 LED in the housing (1 bright 1 dimmed) and see it as 2 Outputs.

******************
Solution:
1. Check if a better AddOn support that data ( Only if you already like to invest a lot of money for a complete new Software)

2. Code Solution
Mobiflight only show the Offset Status ( And that is not existing here) ..... But with a Lua Script its possible to create a new Offset that do exactly what you like.
This offset say.... "Read Offset of Basic Function.... If Chage from 0-1 then write Offset X to 1 .... wait 10 seconds ..... Write Offset X Back to 0"
Finaly you read this Offset X by Mobiflight and controll the dimmed LED.

NOTE that those LED can have different situations.... Like same Dimmed status when turning off the main Function.... So all Conditions must be included in your "script" )
And finaly note that this is NOT realistic..... It is still a Dummy.... If Pump gets broke and you turn it ON your logik will light the dimmed LED ..... Caue the code not know its broke.

3. Hardware Solution
With electrical elements (timers, releais e.g.) you can build pretty sure a system that work..... But its advanced and not so multifunctional like a software solution.


********************

Summary.... For a "Beginner" Cockpit we should simply ignore this little fact. If your Cockpit is so high professional that you like Everything 1:1 Real then think about a high End Software that simply include EVERYTHING and specialy also this dimmed LED Values.
Good Luck !
2019-09-27 11:43
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 5501
Supporter
:-)

Yes Two years are gone.... and many new features come into Mobiflight.
So.... technical NOW this is possible.... But i must say in a "verry" umpracticable way....

Point 1: Brightness.
YES This is possible today in a easy way. we now support PWM Outputs.
Means we can use a couple of Pins ( check the Datasheet for your Boards) as a PWM.....
Means we no longer send 1/0 ( corespndending 0v or 5v ) to a LED.... we can send a Value via PWM ( not sure for now if it is 0-127 or 0-255)
BUT we can define the brightness of a LED within the Config !!
So YES.... We could set the LED to Dimmed or Bright now via Mobiflight within one single Config and by use one single LED.


Point 2: Missing Raw Data and Timer.....
This not change.... PMDG still not give us a Offset for that. And Also MF still not be able to use a timer ( and not will do in thhe future as i know).
BUT
In the last years also "Placeholders" come to MF..... And "Custom MF Variables" Come.....
So YES we can now use a tricky system to build this.

There exist a Offset that count the "seconds since system Start"..... Means a Number that increase by "1" every second.... Starting at the moment FSUIPC get activated after System Start (and pretty sure something simular is available in FS2020 too)
HOW to use.....
At first we Read this imaginary Offset with a Output Config (current seconds since system start)
When we need a "timer" we controll this with a Button..... And write the current value of the Seconds Offset to a Variable.
THEN we say in our LED Config for example it should light aslong the current Real time is xxx seconds bigger then the stored Variable Value.

For example.....

We like a LED light for 10 Seconds.....

After press a button we "store" the value of the global "seconds since start" offset ot a variable. Lets say Variable is called "Fuel Valve Timer" .... And lets say at moment of Button Press the Seconds Value is eactly 1000 ( 1000 seconds gone since sim was started).
So when we press the Button we write "1000" to the Variable "Fule Valve Timer"

Then we need a Second Config (Output) that READ this variable to be able to use it within other configs in formulas...... So we create e.g. " Fuel Timer" Output Config and read in this Config the Variable "Fuel Vale Timer".

3rd Stepp.... We create the LED Output Config and use here TWO Placeholders...... Lets say "Seconds since Systemstart" as "A" ..... And " Fuel Timer" as "B"
For the output we now use the Formula IF the Value Seconds since Systemstart is less the n "FuelTimer" PLUS 10 Seconds Then Light.... Else Not light.
in code.... if (a<b+10,1,0) .....:

To explane.... if we press at "1000" ..... then we say "If current time is less then 1000+10 ( means 1010) Then 1 else 0.
So at second 1001 it is ON ( less then 1010) ...: At second 1002 its also ON (less 1010) ..... After ten Seconds the Current time is 1010..: Then LED goes OFF in case now its no longer "less" then 1010 ( 1000+10)


************************
So... Yes it workes.... But this mean Mobiflight must do a lot of coding in backround.... We need to read a Timer Offset all the time ( whatever we will press this button only once avery xxx hours ) . But otherwise.... MF have no problem to do this. So YES it workes !



LAST Note: I not write this.... But for sure also PWM is possible.....
You can say informula e.g. if (a<b+10,128,255) .... this means for 10 Seconds it light with 50% brightness..... After that it loight with 100% Brightness.
To also include the State of the switch you could say ..... if (a<b+10,$*128,$*255) So if $ ( Status of LED) is "0" then it not light anymore..... Only if Status is "1" it will light !


You see..... We NOW be able to do a lot.... But this is already a bad situation in case PMDG not simply export this simple 1/0 state via a Offset !
Good Luck !
2021-11-13 03:02
Avatar
pluckas
Posts: 104
Supporter
Apologies, I accidentally deleted my post while you were replying to it.

I'm experimenting with your suggestion now. I noticed that with PWM enabled there was some default 'dual brightness' while switching. I will report back once I figure out what is going on.

Thanks for your detailed information.

Edit: So here is a curious observation. With a default 'single pin' crossfeed annunciator in PMDG (offset 6469). With no PWM selected, the light comes on and off only - as expected. Now, with PWM selected on the 'Display' page, but with transform disabled, the annunciator operates in dual mode! It actually goes from bright to dim synchronised exactly with the PMDG 737 overhead. However (and this is a big however) the default brightness is very much dimmed.

Interesting?

Paul
[Last edited by pluckas, 2021-11-13 03:19]
2021-11-13 03:13
Avatar
pluckas
Posts: 104
Supporter
Update.

Something very interesting is going on here. With PWM enabled, and Transform $*100, the crossfeed annunciator (offset 6469) works perfectly in sync with the PMDG overhead panel with dimming in both directions (on to off, and off to on).

Perhaps some hidden PMDG logic?
2021-11-13 04:01
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 5501
Supporter
YEAH

There is "one" thing... Not know if this comes with the PMDG NGX"u" or if this was there all the time. ( NICE you find out.... i never read this !!!)

iconQuote:

6469 1 BYTE FUEL_annunXFEED_VALVE_OPEN
0: CLOSED
1: OPEN (dim)
2: IN TRANSIT (highlighted)



Means HERE we have the needed Raw Data!!!!

I not remember ( as said above) if the PWM Range is 127 or 255 .... But i think its 255 !

So.... In a standard Output ( Without PWM) there is a Value of 0 (0V OFF) OR 1 (5V, ON)
In a PWM Enabled output we have a Range of 0 ( 0V OFF) until 255 ( 5V ON) .... And for sure e.g. 128 = maybe 2,5V and 50% Brightness.
So without a Transform here we have "0" OFF ... "1" Dimmed extreme ( 0,5% Brightness) .... And "2" Already extreme dimmed ( 1% Bright)

Means your "$*100" is Nice and occure in ..... Value 0 (Closed) 0*100=0 .... So no Light. ...... Value 1 (Dimmed) 1*100=100 (Means ~~40% Bright) ..... And Value 2 (Transit) 2*100=200 (means nearly 75-80% Bright) .

A more logical solution would be for example $*127 instead of $*100 ....... then you have 0----127-----254 witch represent pretty exactly 0% ,50% and 100%

And just to show the Syntax also work with a IF Condition..... We could say..... if($=0,0,if($=1,127,254)) Will do the same like $*127

*********************
LAST Question: If i remember right there was additional Dimmed Lights ( Fuel Pumps or Generators if i remember right..... I not see these Offset Data for them.
Do you know what other Elements have this Dimmed System..... Or is it really only in the Fuel Valve ?
[Last edited by pizman82, 2021-11-13 16:00]
Good Luck !
2021-11-13 15:54
Avatar
pluckas
Posts: 104
Supporter
You're thinking of the blue anti-ice annunciators. Unfortunately these do not behave like the crossfeed annunciator using the above tests.

For the crossfeed annunciator, yes, $*127 works as the more logical mid point, but larger numbers reverse the effect (as you might expect). I'm running more annunciators than Stephan would approve from my Arduino Megas, so I am tempted to use PWM to reduce the amount of current draw on the Megas by dialling down the brightness a little. But I see some strange things while testing - not all annunciators behave the same.

In the mean time, the little 'win' with the cross-feed annunciator seems worth keeping.
[Last edited by pluckas, 2021-11-14 10:05]
2021-11-14 05:06
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 5501
Supporter
Hhhhmmmm.

Reduce Power by using PWM ??? Strange !!!

If you use more Power as recommend..... ( E.g. 40 LED with 20mA , that overdrive the 500mA Border )...... Why not simply split the LED´s over 2 Megas and have 2x20 .... means 2x400mA that is fine for TWO seperate Megas ??

Whatever.....

If there exist no Offset Raw Data for the Anti Ice Lights.... then maybe my basic idea is working here. Not realistic in case we use a timer instead of a real status..... But here we could say e.g. "Light xxx seconds in dimmed and then go to bright" .
Good Luck !
2021-11-14 23:55
icon