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
Wanikiki
Posts: 4
I am building an A320 flightdeck using Project Magenta Software and trying to dim each display.
Using offset 0x55F0 Capt. PFD
0x55F1 Capt. ND
0x55F2 Upper ECAM
0x55F3 Lower ECAM
0x55F4 F/O PFD
0x55F5 F/O ND
All offsets are 1 byte. According to PM manual 0 is inop 1 is dark and 100 is bright.
I am also using FSUIPC pay version.
Using MobiFlight and analog potentiometers with the @ symbol I was able to dim the Capt PFD/ND displays but not all the way dark. The rest of the display don't do anything.
Can anyone guide me I can't make this work. I have tried everything that I can think of. Someone told me its an 8 bit value from 0 to 255
but I don't know what to do with that. I have tried mask editing but don't know what am doing. If you know how to do it please explain in details how to input that into MobiFlight.
Thank you guys.
2022-01-18 00:50
Avatar
StephanHo
Moderator
From: EDDG, Germany
Posts: 1819
Supporter
Hi Wanikiki,

Welcome to MobiFlight!

If I see that correctly, you are missing the corresponding assignment of the values.

A potentiometer on MobiFlight rotated the values ​​from 0 to 1023 across the left to right range.

Project Magenta needs the value 0 for OFF and the values ​​1 to 100 for dimming.

Basically you can read the values ​​of the potentiometer directly in MobiFlight. Create an input config for the potentiometer, select the module and device and use the MobiFlight variable as the action type. Use Number as Type and assign e.g. the variable name Pot and value @.

In order to be able to look at this value, you create an output config that you call Testpot, for example. Now edit this config by right-clicking on "Edit" (...) and in the Sim Variable tab select MobiFlight Variable. Number again as the type and pot as the name again (always pay attention to the spelling!).
Now click on OK and turn the potentiometer.
On the right you see 2 columns: Flight Sim Value and Output Value.

Flight Sim Value is the current value of your potentiometer. Turn it now. You see an initial value and an end value. Turn the pot a few times. You'll find that the smallest value isn't necessarily 0, and the end value may not be 1023 either.

Let's say the starting value is in the range 10 to 17 and the ending range is 1023.
The start value is significant because we want to send a 0 when the start value is reached.
If the final value is e.g. 1023, we work with this, if you get a different value, you use that.
Now select the Input area again and click on Edit in the config for the potentiometer.
Select the Value line, which now only has the @ sign.

In this line we can manipulate the input value or change it with mathematics as we need it.
So let's write a formula in this line:

if(@<20,0,@/1023*100)

What does this formula do now?

So if the value of @ is less than 20 then MobiFlight should send a 0, else @/1023*100

So we divide the value that the potentiometer sends by 1023 and multiply the result by 100 again.

After entering this formula, switch back to the Output tab and observe the Output Value column. The values ​​there now move between 0 and 100 when you turn your potentiometer. Maybe the value 100 is not always reached, but 99 will do as well. These are tolerances that we have to accept.

But since you want to write this value to an offset, you now change the action type from MobiFlight variable to FSUIPC offset in the input config. Enter the offset in the area below and the type and size in bytes and in the set value line you enter the formula again. Don't you have it anymore? No problem. Set MF variable again and you have the formula again. Copy them by selecting them completely and then pressing CTRL-C. Set FSUIPC-Offset again, go to the Set Value line and enter the formula here again with CTRL-V.

That's it. You should now be able to dim your offset.
Please report if it worked.
Grüße,
Stephan (Time: UTC+1)
2022-01-18 13:09
Avatar
Wanikiki
Posts: 4
Thank you very much for all the info. I will try it and let you know.
Regards
Enrique
2022-01-18 14:49
Avatar
Wanikiki
Posts: 4
Sorry but I did everything the way you told me and it dims the display to almost dark and its not dimmable any more.
Maybe from 0 - 255 is the value I should use. I have been trying for days and doesn't work. Will keep on trying.
Thanks
Enrique
[Last edited by Wanikiki, 2022-01-18 19:28]
2022-01-18 17:28
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 5571
Supporter
In OUTPUT Configs the Line where you enter formulas is called "TRANSFORM"
In INPUT Configs this line is called "Value" .

Whatever Stephan give you the "full guide" ( Including find out the production tollereance on both sides) .....
Its much more easy to work with a "standard" formula.

You can fully save the whole part to make a Mobiflight Variable.... To make a Output For testing.... And to rework the Configs once again on the End.

Solution:

Potis in MF have a Value of 0-1023 ..... As Stephan say some start at 0 others at 5, 10 or 20 . And some goes to 1023.... Others still end at 1012 e.g.
So we can simply say.... ALL below 30 = 0 All Above 1000 = 1024 ..... or in your case 0 and 100 for the PM Offsets.

So simply use in all Input configs the same formula....

if(@<30,0,if(@>1000,100,@/100))


Then Every Poti got a clear Zero.... a Clear 100% Bright and maybe 70 steps between.... More then you can ever see with your eys.

If you really have a feelable "delay" at the Ends ( e.g Poti do nothing when you turn it on the edges) then reduce the marge of Value....
e.g. if(@<15,0,if(@>1010,100,@/100))

So i think.... Not needed to go the difficult way here.... But good Stephan explane it so you "can" do it if you need it !


EDIT: SORRY... My Mistake !!!
It must be @/10 ..... NOT @/100 !
1024/100=10,24 ..... So this not work.
with Divide /10 it should work ! (Thanks Stephan for that call )
[Last edited by pizman82, 2022-01-19 01:09]
Good Luck !
2022-01-18 19:04
Avatar
Wanikiki
Posts: 4
Thank you guys for all your help but nothing works. Once you dim the pot thats it, it won't work again.
I think I'll give it a rest.
2022-01-18 19:37
Avatar
StephanHo
Moderator
From: EDDG, Germany
Posts: 1819
Supporter
Hi Enrique,

how is the behavior on the output side? Does the value chage in both direction,so from 0 to 100 and from 100 to 0 or did it stop at 0 and stays there?

Do not look on the display you want to dim. I only want to know, how is the behavior of MobiFlight.?

If MF works correct then the couse is not MF but Project Magenta or FSUIPC.
Grüße,
Stephan (Time: UTC+1)
2022-01-18 20:41
Avatar
DjNigelC
Posts: 1
Oh god, guys :D

What equations are you using here :)

You dont do ANY OF THAT

you go to the compare tab of the pot output and tick INTERPOLATE and set it to

0.................0
1024........100

That way the input from pot has 1024 steps, but the input into the sim only has 100 steps

Everything in between is calculated accordingly and automatically

This is literally what interpolation is there for

You can change -16383 to +16383
To come out as 0 to 32766 if you dont like minuses for example

It doesnt even have to be linear interpolation
You can set more than min and max values
You can add more
For example you can take this pot value of 0-1024 and make this

0........................0
100....................33
900....................66
1024................100

This would make the first and last 10% of potentiometer operate the first and last 25% of the dimmer.
And the remaining 80% of potentiometer movement (in the middle) would operate the remaining 50% of the dimmer

Meaning increased sensitivity in the middle of the pot because you would have 80% of pot travel operating 50% of the dimmer

The rest of course is sped up the closer you come to the min or max

Or you can do this
0..........................0
200......................10
400......................25
600......................45
800......................70
1024...................100
Which will be sensitive in the beginning and then become less sensitive as you turn the pot from min to max

Hope this helps
2022-02-09 02:16
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 5571
Supporter
Hi

Are you sure this workes ???

If yes i miss a basic thing.... Cause technical this can NOT work at the moment in case of a "bug" or better a "bad feature" of Mobiflight!

Mobiflight ( behind the Interpolation) gives not a "integer" Value.... It gives a "String" !

For example if we Read a Raw Value of 0-100
And we say Interpolation : 0=0 .... 30 = 50 ...... 100=100 ......
Then we have a "perfect" Value....
But Mobiflight e.g. for 30 will not execute "50" it will ececute the String "50 (30)" as TEXT !

For a Stepper or Servo this works..... But for a "Value Input" like $ this is not possible as i know !
Cause the Var/Event/Offset expect a integer like "50" and not can handle the String "50(30)"

https://github.com/MobiFlight/MobiFlight-Connector/issues/376

IMPORTANT: If this workes.... please reply.... We need to test this.... ( And we maybe can delete the "GitHub Issue Request" if this problem is no longer happen)
[Last edited by pizman82, 2022-02-09 03:29]
Good Luck !
2022-02-09 03:23
icon