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
TRABANINO
Posts: 15
Hi
I'm building a Heading Gauge with two moving parts. One is a Dial that shows 360 degres and the other one is a bug turning aroung the dial. When I set the bug pass the 180 degrees the dial turns back but does't cross the 180 degrees. I checked and unchecked Compass Mode but the problem persist.
I should be able to set the bug at any position and the dial would turn the airplane at that direction when connected to Automatic Pilot. It works well from o to 180 degrees, then it reverse.
I'm using an Arduino Mega 2560 an two steppers 28BYJ-48 and MobiFlight v. 9.0.0, Offsets 0x0580 for the dial and 0x07CC for the bug.
I will appreciate any help,
Thanks Raul
2021-09-27 02:18
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6010
Supporter
Hi

Check the FSUIPC Value Collumn in your Mobiflight Window. ( the raw value from that Offset you read)

For lots of Offsets in FSUIPC there is a "Signed - Unsigned Problem" . ( Old thematic.... FSUIPC work a little strange here. Thats why we use Simconnect in FS2020 instead)

I´m pretty sure your Offset not show 0-359 ..... It show 0-179 and then MINUS -180 to MINUS -1

To explane this behavour......
In Informatics a Value can be UNSIGNED ( e.g. 1 Byte unsigned INT means it is from 0-255 )
OR
It is SIGNED (e.g. 1 Byte again signed goes from -128 to +127
But it not go straigth..... It goes from 0-127 and then from Minus 128 back to -1
So in a Heading ( that is read Signed by fault) 0-179 Work fine .... 180 now is "-180" 181 is shown as -179 ... 182 is shown as -178 ... up to 359 is shown as -1.

TO SOLVE
Use the Compare Tab to recalculate this wrong results......
We can simply say IF Value is negative (less then 0) simply ADD 360 to it. ...... So for example 181° are shown as -179 as explaned above..... -179+360=181 again !
Use Compare.... Say in upper Line If Value is less "<" 0 ..... In the THEN Field you say $+360 .... In the ELSE field you say simply $
Good Luck !
2021-09-27 10:44
Avatar
TRABANINO
Posts: 15
Thanks for the information. I will try it and feed you back with my results.
2021-09-27 13:59
Avatar
TRABANINO
Posts: 15
Yes, it worked. The compare do make sense. I still have to try if my zero reference point was not lost.
Thank you for your help.
Could you tell me if there is a way to send pictures when you post a question?
2021-09-28 00:36
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6010
Supporter
Hi again !

In this "old school forum board" there is no direct posibility to "send" pictures.
You just can show a picture by a LINK to a Web adress.....
Means you need to provide the picture on oln Webspace OR you upload it to a Puplic File Hoster.

By the way..... For more detailed requests ( that need pictures) you can join our DISCORD Group https://discord.gg/99vHbK7
There Sebastian, Stephan, myself and many other users (english or german) are available for direct help via PM Support..... OR you can also ask Questions THERE ( including a easy click and share Picture/Screenshot Upload.
Additional we can talk together via Headset and share our Screen to show a Situation "live" on the Computer.

Join us there !!!
Good Luck !
2021-09-28 04:12
Avatar
TRABANINO
Posts: 15
Thanks for your update.
I have been testing my Heading Gauge and I found the following: Applying the compare method works well for 180 degrees but when I make a full turn of 360 degrees the problem persist.

Note. My gauge contain a gear that reduces the speed. A full turn of the stepper 360 degrees = 90 degrees of the needle.

Thanks, Raul
2021-09-30 14:07
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6010
Supporter
The Stepper System in the basic settings is build for Linear Gauges of a Max 360° Range.
(E.g. the Flaps Gauge or the Temp Gauges )

If you need a Gauge that can turn "above 360" then the "Compass Mode" is needed.

To explane....
If you define a Gauge e.g. for a compass and you say SIM 359 then the Gauge show a value of 0-359° also in same resoluton on the Motor.
WITHOUT Compass mode each degree got a own Position..... So e.g. "0" is on 12 o clock Position.
If your Value swap from "359" Degree to "0" then for sure it not turn one step clockwise...... it will turn 358 Degrees counterclockwise..... Cause you just define ONE Range !

By using the "Compass Mode" ( hook enabled) the system understand that the value can make a overrun on both ends.
Then it turn from 359 simply to 0 directly.

Same with a Altimeter..... The needle show "1000" feets with one turn.... So it must turn forward if the value start a new thousend part instead of turn back to Zero counterclockwise !

*****

Solution: Enable Compass Mode !
Good Luck !
2021-09-30 19:56
Avatar
TRABANINO
Posts: 15
The results I sent you before is with Compass Mode activated.

I copy here my setting when I did the test using my Flight Simulator.

Steps per revolution
Sim/Stepper : 90/2048
Test Value: 360
Compas Mode : checked

With these settings the problem persist.
2021-09-30 23:43
Avatar
TRABANINO
Posts: 15
I forgot to tell you that my gauge turns backwards because the one gear reduction. To fix the problem I had to reverse my transform formula multiplying by -1 (minus one)
This is the Transform for Ofsset 0x0580: ($*(360/65536)/65536)*-1
2021-09-30 23:53
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6010
Supporter
Yes

the "Direction" can be a Problem...... As you said with a One layer Gear in use the direction is inverted. Also some users mount the Motor in wrong direction and got the same Problem.
Here solution is as you said $*-1 This invert the Value into negative..... So Stepper turn also inverted!

About Values.
The Setting 90/2048 is strange....... A Compass have 360 .... Means your "90" represent just a Quarter Turn (90°)

I not see your System but pretty sure you use a 4:1 Gear ( or you have a special Motor)
Whatever this works..... Thats not logical and "clean"
Please try instead 360 / 8192 .
Technical same Result... But we normaly define here simply..... How much Steps are need to turn 360° ( in your case 8192.... not 2048) And what Value range is need to turn the Motor by 360° ( in your case 0-360)
So this is more understandable finally !
Good Luck !
2021-10-01 15:51
icon