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
Ilirio
Posts: 38
Hi,

I was trying to implement a rotary encoder to control the Elevator Trim for the JU-52. I used FSUIC Event-Ids ELEV-TRIM-UP and ELEV-TRIM-DN and it worked. However I also wanted to show the current value in an LCD. For that purpose I used the preset Controls-Elevator Trim, which returned a float value as follow:

-1º = 0.0000
0º = 0.0130
+1º = 0.0260

And so on...

I applied some transformations to show the value in degrees ($*10000)/130-1 but I couldn't obtain a float number in my display (I used "ELEV-TRIM $$$"). Am I doing anything wrong? Is it possible to display what I want?


Bonus question: In the JU-52 the same wheel is used for trim and flaps, by using a lever which alternates those functions. Can I reproduce such a system in Mobiflight? (i.e. change the behaviour of a rotary encoder depending on the position of a switch)

I wouldn't mind using LUAs
2021-10-12 12:13
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6010
Supporter
Hi

I have no experience with the "Ju52" .... But i can awnser BASIC.

1. Trim Value.
Check the Preset itself.... Mostly they have a UNIT Flag.... Make some testings here.
E.g. show Percent, Number, degrees or so....
https://docs.flightsimulator.com/html/index.htm#t=Programming_Tools%2FSimVars%2FSimulation_Variable_Units.htm

Normaly in FS2020 we no longer need to make own recalculations in the most cases.
E.g. in the past the Altitude was in Meters*65535 ..... So we need a calc to bring them in clear feets.
Today in FS2020 we can simply change the UNIT of the Variable from e.g. "m" to "ft" and all is working !
So check if Trim Value just got a bad UNIT.


2. FLOAT on Displays....
Mobiflight "truncate" every Float behind the Transform Line ( Whatever in use or not).
So a Value of 1,99999 is technical "1" .....
If you "need" the Value behind the decimal ON YOUR DISPLAY ..... You use a simple trick,
You "multiply" it.
e.g. a Value of 1,23 must be multiply by 100 ( $*100 in transform line) to get 123 instead.
The "Decimal" itself is finaly just optical.
On 7Seg you show in that example 123 and you kust enable the decimal point right of the first diggit.
On your LCD you say "ELEV-TRIM $,$$" .... So it technical show 123 BUT the "," is hardcoded text now!



3. YES ... Via Precondition.
You need a Indicator, what "Mode" is currently active. May there exist a Variable in the Sim in case the system is also there. If not you need a MF Variable and build this by hand.
Logic:
You build one Config, that read the Indicator .... And you build 2 Configs for the Encoder. One for Trim, one for Flaps.
Without precondition the Encoder would now controll both things same time.
With Precon you can say e.g. ..... Config for Encoder Trim only work if Indicator Config currently show "trim" e.g. 1.

Same work for Displays. You can say "Aslong Indicator = 1 show e.g. Trim Value ..... If Indicator = 2 show instead Flaps Position on the same Display".
With PReconditions and Placeholder you can do nearly everything !
Good Luck !
2021-11-03 08:49
icon