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
TWIVEZY
Posts: 16
Supporter
Hi all,

I've managed to find the tutorial that shows how you can test the potmeter output from 0 to 1024 using the action MF variable. Could someone explain to me how I could use the potmeter to get an axis deflection showing in vJoy monitor?

Thanks for any advice!
2021-12-14 18:02
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6010
Supporter
To clearify....
You use a Real Poti..... And you want to make a INPUT into the Sim .

Whatever the Poti is connected to the Mega ( MF Poti setup) OR the Poti is Part of a HID Joystick Device ( Real Joysticks, LeoBodnar boards or so) .....
Both can be used in MF as Input source.

So why you like to "execute" this Value via a Vjoy Signal..... It is still a Real Poti and can be used directly !


May i missunderstand! Please give me a little example how the setup looks like and how you like to build it !
Good Luck !
2021-12-15 17:52
Avatar
TWIVEZY
Posts: 16
Supporter
Thank you for your reply.

I am using a lua script to execute some very specific custom button and switch actions. The script is able to deal with HID devices, but does not work with the Mega. My work around is to use MF to create vJoy actions to allow me use the Mega with the script.

Since MF now supports potis, I would like to do the same with a few custom axes. At the moment the script can only handle potis that are connected to
HID devices.

In the vJoy monitor the axis that I have assigned in MF does show up, but only shows a continuous half scale deflection. I can however see the MF test variable values between 0 and 1024 when I turn the poti. So the poti is working fine with MF, but I really would like to be able to use it as a vJoy axis.
2021-12-15 20:48
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6010
Supporter
OK.
I Understand.

Badly i never tested this, cause the Vjoy Feature comes years ago to support "Buttons"..... that time MF not work with Potis ( Poti comes some months ago).
So the feature in the Vjoy PlugIn to controll Axis was just a "side trash" that have no usage..... So we never care about it.

BUT..... I think it can work !

I remember to test the Axis Controll with ( that time) only posibility by Button Inputs..... Means i write with a Button for testing "1" or "800" to the Vjoy Axis Input..... And it change the axis correctly to that spot!

Means.... i think it work also today with Poti !

Please try out.....

Build a INPUT Config. Use as Device a Poti that is connected to your Mega! ..... Use as "Typ " the VJOY System and define a axis.
In the Value Field you use the "@" symbol ( That represent the current Poti Value in a range of 0-1024 )

So...
1. Confirm the Poti work in this idea.
2. If it work but range is not correctly..... Then we need to know the exact "Vjoy" Range and than we need to recalc ( by formula) the 0-1024 into the Vjoy Range.
e.g. if Vjoy need 0-16383 we simply say @*16 in the value line....
If Vjoy need Negative and positive like -16383 to +16383 ..... then we say @*32-16383.

I hope you understand !
Please report experience !
Good Luck !
2021-12-15 21:39
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6010
Supporter
Additional Note :

Think about usage, please.

If i understand right you use Mobiflight to transfer Button and Poti Commands ( Via Vjoy) to FSUIPC to run/handle your LUA Script.
THIS is a unneeded Bypass..... and Bypasses are always a mess and bad thing in case they cost time and resources.


So without know the whole project i can not give yoBu a advice..... BUT.... think if this is logical.
If you build a "HID Joystick" e.g. by a LeoBodnar or a verry cheap "Arduino Joystick Sketch" ...... then your Poti and Buttons would be work directly as a HID device you can use in FSUIPC ( within your script) directly......
Then Mobiflight and Vjoy just as a "transmitter" would be no longer needed !

For sure.... If we talk just about one single Input ( and all others are done within MF directly) then a additional Mega is not logical..... But if these are multiple elements.... Think about a own HID!
Good Luck !
2021-12-15 21:44
Avatar
TWIVEZY
Posts: 16
Supporter
iconpizman82:

OK.
I Understand.

Badly i never tested this, cause the Vjoy Feature comes years ago to support "Buttons"..... that time MF not work with Potis ( Poti comes some months ago).
So the feature in the Vjoy PlugIn to controll Axis was just a "side trash" that have no usage..... So we never care about it.

BUT..... I think it can work !

I remember to test the Axis Controll with ( that time) only posibility by Button Inputs..... Means i write with a Button for testing "1" or "800" to the Vjoy Axis Input..... And it change the axis correctly to that spot!

Means.... i think it work also today with Poti !

Please try out.....

Build a INPUT Config. Use as Device a Poti that is connected to your Mega! ..... Use as "Typ " the VJOY System and define a axis.
In the Value Field you use the "@" symbol ( That represent the current Poti Value in a range of 0-1024 )

So...
1. Confirm the Poti work in this idea.
2. If it work but range is not correctly..... Then we need to know the exact "Vjoy" Range and than we need to recalc ( by formula) the 0-1024 into the Vjoy Range.
e.g. if Vjoy need 0-16383 we simply say @*16 in the value line....
If Vjoy need Negative and positive like -16383 to +16383 ..... then we say @*32-16383.

I hope you understand !
Please report experience !



Hi pizman82,

Thank you very much for your replies.

I have tried the above, with the variations @, @*16 and @*32-16382

However unfortunately in the vJoy monitor the axis only shows a frozen half scale deflection. When I assign a MF variable the output does nicely change between 0 and 1024 when I rotate the poti.
2021-12-17 09:57
Avatar
TWIVEZY
Posts: 16
Supporter
iconpizman82:

Additional Note :

Think about usage, please.

If i understand right you use Mobiflight to transfer Button and Poti Commands ( Via Vjoy) to FSUIPC to run/handle your LUA Script.
THIS is a unneeded Bypass..... and Bypasses are always a mess and bad thing in case they cost time and resources.


So without know the whole project i can not give yoBu a advice..... BUT.... think if this is logical.
If you build a "HID Joystick" e.g. by a LeoBodnar or a verry cheap "Arduino Joystick Sketch" ...... then your Poti and Buttons would be work directly as a HID device you can use in FSUIPC ( within your script) directly......
Then Mobiflight and Vjoy just as a "transmitter" would be no longer needed !

For sure.... If we talk just about one single Input ( and all others are done within MF directly) then a additional Mega is not logical..... But if these are multiple elements.... Think about a own HID!



Thank you for this additional advice.

I totally agree that unnecessary transmitter steps should be avoided when possible. Unfortunately my lua script is handled by a custom program that solves certain restrictions that FSUIPC has. A very smart person is helping me with this interface and the exact details are actually beyond me. But his program does require my analog input to be connected to a HID device that is detected by WIndows as such.

Maybe I should indeed investigate if I can build a HID with a "Arduino Joystick Sketch". I have however no experience at all with this, all my 12 Megas are flashed with MF firmware. If I would succeed in creating a HID that is detected as such by Windows I could use it with his custom script. How many potis could I install in that case on a single Mega? I know there are 16 analog pins on the Mega. At the moment I have 6 LeoBodnar 836As installed in my (320) project...just for handling the potis. But I actually would need many more as a single ACP (one of three) already requires 15 potis.
2021-12-17 10:22
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6010
Supporter
OK.
May the "@" Logic not work with the Vjoy Stuff..... I thought it should. If i find time i will double check it !


About HID

Your script should not be effected..... For the script there is no difference whatevenr you use a real HID or a Vjoy Source.... Both are seen for Windows ( And FSUIPC) as real Joysticks.
Bodnars work.... But are expensive.
Lots of users build there Joysticks with small Arduinos and the free Librarys like "UnoJoy" and so on. ( Just google)

If i remember right the Limitation is 4 or 6 Axis ( Like a regulary Joystick, too) .... It´s no mater how many Analog Pins you got.... Windows makes a limitation for a HID as i know.
BUT
Its no big deal in case you can use 16 or 32 Joysticks on a Computer ..... And with "network" you can use 8-16 Computers. So hundrets of Sticks if needed.

Last Note:
Is the ACP functional ?
What AddOn do you use ?
Until now i never find a AddOn that support Analog Volume.... May the Buttons are simulated and can be pressed ( On/OFF) like in PMDG..... But the "turning" is just a dummy and no volume change happen. So before you invest time and monney..... Check if this is really useable and finally if you need it.... may for COM1 Yes.... But do you ever will change the Nav1 Sound Volume ? If not simply use a dummy and save a Joystick Axis !
Good Luck !
2021-12-19 16:55
Avatar
TWIVEZY
Posts: 16
Supporter
Hi Pizman82,

Thanks again for your reply. Indeed I am already using 32 joysticks (including 14 vJoys) on my PC. I want to stay away from networking as it comes with its own difficulties and the P3D A320 add on that I use does not recommend networking. Up to know I am managing with my single PC.

A friend of mine has made it possible to make the ACP fully (!) functional. I have already invested in 6 Bodnar 836A cards, just for the 8 axes each. I have planned their useage for the most relevant controls. But my goal is to replicate the A320 with the minimum amount of shortcuts so if I could use the potis on my (cheap) 12 Mega's with vJoy, I could interface the "low priority" volume controls as well.
2021-12-19 22:10
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6010
Supporter
I´m not sure....
There is a limitation of Joysticks within FSUIPC as i know..... XX Joysticks on one Computer! (Windows technical allow 64 or 128 pretty sure.)
As said above.... We can overdrive this limitation by using WideFS (So FSUIPC in a Network) and multiple Computers.
For example.... If FSUIPC allow 32 Sticks per Computer and a Max of 128 overall you need 4 Computers with WideFS.

For your script this is not a factor.... Via WideFS all Joysticks from all "clients" are usable on the Main Computer where you drive the script itself.
)Not tested.... But thats what i read in the web)

So.... Maybe the Mobiflight Idea is NOT the key.... Cause also if you have the Potis on a Mega and send it via VJoy.... The Vjoy represent a Joystick HID..... So it is a device within the limitation of FSUIPC same way like a real one.

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

At last a strange Idea.....

If you get finally in trouble.... May you can "combine" some Axis together. By a nice logic in your script and Mobiflight.

Lets say you have some Volume Selectors that NEVER can be active same time ( or that never are used same time by yourself in Normal procedure )
For example the NAV1 and NAV2 Morse Sound.

Lets say Both switches exist ( Each a own Poti) .... If its like in a Boeing then they are iluminated if active ( selected by a Press)

My idea: We could now read Both Potis with MF and use the Status of the Systems ( NAV1 active or NAV2 active) as a Condition and say.....
IF Nav1 then send THAT Poti Value to AxisX ..... ELSE-IF Nav2 is active than send instead the Value of the Nav2Poti to the SAME Axis.

All you need finally is the counterpart of that logic within your script.... So you say there.... IF Nav1 is Active then use AxisX for that system If NOT then use this axis for the NAV2.
In case there is no value change of the currently disabled System, the Value should remain in last position.....

For sure.... there is no "update" if you turn a Poti that is currently not active.... But its no mater in case you not hear anything aslong it is not active anymore.
If you "reactivate" it then the Poti will send the new Status and the system is sync again !


*********
I know... Strange idea. But maybe the key if you really get in trouble with Max Joystick Devices.
Good Luck !
2021-12-20 07:52
Avatar
TWIVEZY
Posts: 16
Supporter
Thank you for the idea of the shared poti. It would however require a drastic redesign of my ACPs. I might use it for future upgrades. For now I will just stick with the 836As only for axes. Whenever the vJoy axes come available through MobiFlight, I will use those as well.
2021-12-20 18:11
icon