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
slammer88
From: LTBJ, Turkey
Posts: 148
Hi there.

I'm currently integrating my setup to XP-11. As you may know, Values in X-Plane are not solid 0 or 1, they have a range between 0 and 1. So, if you dim a light, lets say, its output value becomes 0.5 from 1.

I'm trying to apply this on Mobiflight. Using 2 bits wont work. As long as the Input value decreases below 1, the output turns into 0 as well. Is there any chance to introduce such a range ?
2019-05-04 14:07
Avatar
StephanHo
From: EDDG, Germany
Posts: 1261
Supporter
Hi slammer,

it is technical impossible to have float values with one Bit. A bit only can be 0 or 1, nothing else.
If you mean a Byte (8 bit) then you can ave 256 values.
Grüße,
Stephan
2019-05-04 16:19
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 2533
Supporter
As Stephan startup .... If Value is a Float ( Decimal Number) then it must be 4 BYTES (32bits) long OR 8 BYTES (64 Bits)

Basicly your right.... Mobiflight see the Float Raw Value but behind the Config the Output Result is a full Number.....
So without any compare/transform a value like 0,1 or 0,99 is always "0" .... A Value like 1,77 is "1" . There is no Rounding. Mobiflight simply ignore all behind the Decimal.

To solve this:
If Raw Value is a Decimal like 0,01 , 0,99 until 1,00 then simply make a Transform : $*100
Then 0,01 result in 1 .... 0,77 result in 77 ..... and finaly 1,00 result in 100
Then you can Work with the Value (Like showing on Displays or using it for Motor Controlls)
Good Luck !
2019-05-04 20:39
Avatar
slammer88
From: LTBJ, Turkey
Posts: 148
iconpizman82:

As Stephan startup .... If Value is a Float ( Decimal Number) then it must be 4 BYTES (32bits) long OR 8 BYTES (64 Bits)

Basicly your right.... Mobiflight see the Float Raw Value but behind the Config the Output Result is a full Number.....
So without any compare/transform a value like 0,1 or 0,99 is always "0" .... A Value like 1,77 is "1" . There is no Rounding. Mobiflight simply ignore all behind the Decimal.

To solve this:
If Raw Value is a Decimal like 0,01 , 0,99 until 1,00 then simply make a Transform : $*100
Then 0,01 result in 1 .... 0,77 result in 77 ..... and finaly 1,00 result in 100
Then you can Work with the Value (Like showing on Displays or using it for Motor Controlls)



I'll give this a try and let you know, thank you!
2019-05-12 14:27
Avatar
slammer88
From: LTBJ, Turkey
Posts: 148
Using Float instead of Integer, changes the input value like 3,393479837-XX and using * or /100 won't affect it. Any ideas ?
2019-05-15 07:42
Avatar
StephanHo
From: EDDG, Germany
Posts: 1261
Supporter
Hi slammer,

what is your decimal, the dot (.) or the comma (,)? In MF the comma is a separator and not a part of a mathematical formula.

The values basicly can be manipulated via the transform-line.

So think about the mathematical rules: what is in brackets is calculated first, point before line calculation. the number of brackets on and off has to be equal.
Don't use spaces within the formulars.
If you use float instead of integer you have to change the number of bytes from 1 to 4 (or 8).
Grüße,
Stephan
2019-05-15 13:12
Avatar
slammer88
From: LTBJ, Turkey
Posts: 148
iconStephanHo:

Hi slammer,

what is your decimal, the dot (.) or the comma (,)? In MF the comma is a separator and not a part of a mathematical formula.

The values basicly can be manipulated via the transform-line.

So think about the mathematical rules: what is in brackets is calculated first, point before line calculation. the number of brackets on and off has to be equal.
Don't use spaces within the formulars.
If you use float instead of integer you have to change the number of bytes from 1 to 4 (or 8).



Great question! I don't remember now whether it's, or . I need to check tonight as I'm in work.

But thing is, I'm trying to use some functionalities of XP-11 with Mobi. What i want to implement -if possible- is to integrate the annunciators.

In 737, you have some annunciators which have 2 dim options such as X-FEED, Anti Ice etc. These are lit fully when activated first, but dims to half after a short while. When i track the dataref value within XP-11, I see, i.e Annunciator of Crossfeed is 1.0 when fully lit, and then goes back to 0.5 while its on. Note that Dataref system of XP is between 0 and 1, and it has integers in some cases.

Normally, most of the annunciators are either 0 or 1 being unlit & lit consecutively. And using INT for them works pretty much well.
2019-05-16 08:00
Avatar
StephanHo
From: EDDG, Germany
Posts: 1261
Supporter
Hi slammer,

regarding the dataref note that the dataref mostly are only one bit. With a bit you can't got a value other than 0 or 1. Perhaps are there two bits. One for on/off and one for undimmed/dimmed. Then this item can be operated with only one bit.
The problem will be the timing. If you want to lit an annunicator full and after 5 seconds dimmed you will not have a timer in MobiFlight who is able to realize it.
But it could be possible if you read out the sim-time and there only the seconds and calculate them with modulo 10 or 5. Then this value will be 1 min after 1 and max after 5 or 10 seconds so that you have here the reference. Try it ;)
Grüße,
Stephan
2019-05-16 16:44
Avatar
slammer88
From: LTBJ, Turkey
Posts: 148
iconStephanHo:

Hi slammer,

regarding the dataref note that the dataref mostly are only one bit. With a bit you can't got a value other than 0 or 1. Perhaps are there two bits. One for on/off and one for undimmed/dimmed. Then this item can be operated with only one bit.
The problem will be the timing. If you want to lit an annunicator full and after 5 seconds dimmed you will not have a timer in MobiFlight who is able to realize it.
But it could be possible if you read out the sim-time and there only the seconds and calculate them with modulo 10 or 5. Then this value will be 1 min after 1 and max after 5 or 10 seconds so that you have here the reference. Try it ;)



The raw value coming from XP is with "," its like 3,58273xxxx-E43 and no matter what i do, output value is 0.
2019-05-16 21:00
Avatar
StephanHo
From: EDDG, Germany
Posts: 1261
Supporter
Sorry slammer, that exceeds my knowledge.
Maybe you should look in an X-Plane forum or ask there.
Grüße,
Stephan
2019-05-16 23:19
Avatar
slammer88
From: LTBJ, Turkey
Posts: 148
Ok i've solved it, it was saying that for integers, i shall use either int, float or double. using double and adding " * 10" expression at the end solved the problem, the raw data translated from 0 / 1 / 0.5 to 0 / 100 / 50 consecutively, and I've modulated the output value accordingly.

Only thing is the LED's do not dim according to the data value, but no big deal for me. It's either off or on.
2019-05-17 09:47
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 2533
Supporter
:scared: Thats Nasty
iconslammer88:

Ok i've solved it, it was saying that for integers, i shall use either int, float or double. using double and adding " * 10" expression at the end solved the problem,



I´m not sure if i understand right ..... You say for a INT Value you should use "Double" (means a 32 Bit -8 Byte FLT) . This sounds strange.
Always remember.... The Key here is NOT the Datafef and how it looks like. The Key is XPUIPC !
XPUIPC will read the Dataref and "export" it to a Offset.
Hardly say. XPUIPC can use formulas.... It can say.... IF Dataref is 1 then set offset to 123456 If Datref is not 1 then set Offset to 999999
So basicly the Value on the Offset must NOT be simmular to a dataref. Also the format. If Dataref is a INT then Result of XPUIPC "can" be also a INT.... But it not have to !
Whatever a Dataref is for example a decimal Value between 0 and 1 ..... Then XPUIPC can simply say "If 1 then 1 Else 0" .... So it simply ignore all decimals and show only bool 1/0 .

Summary. You must work with the Data you get from XPUIPC. Here the List of FSUIPC Offsets is not 100% helpfull cause XPUIPC can use own Offsets and Typs/Size if it like.

*****
About Dim LED. Basicly Mobiflight not allowed a Dimming at the Moment. Here the Key is a Hardwaresolution at the moment. Basicly you must have a Indicator.
Like above you must have a Offset that is show you 1/0 if dimmed Status is active or not.
Then you can build a Hardware system that work. For example you can power a LED in 2 Ways (with Diodes and resistors) for a High and a Low Brightness Status.
If Dimmed is 1 then the Low Line is running.... If Dimmed is 0 and StatusLEd is 1 then High is running.... If Dimed is 0 and Status also 0 then both are OFF.

Another way is to work with 2 LED in the Anounciator.... A Bright and a dimmed. 2 Devices in Mobiflight. Simply use Preconditions to define the status.
Maby a Relais with a combined Circuit and a high resistor that get add into the LED Cirquet can be also a solution.

*********

Last Note:
As i said often.... XPUIPC allow us to add things on free Offsets (with a bit of scripting) .
If your raw Data (Dataref) show the dimmed status.... For example 0,5 for dimmed and 1 for Bright) then you can build a system that say.....
Offset A (Bool) should be 1 if Dataref is 1 (Bright) and 0 in all other ways .... Offset B should be 1 if Dataref is 0,5 (Dimmed) and 0 in all other ways.
Then for OFF Situations both Offsets are 0 ... For Dimmed Offset A=0 ; Offset B=1 ....... And for Bright Offset A =1 ; Offset B=0
THATS the clear Indicator i talked about above.
Good Luck !
2019-05-17 10:58
icon