Jump to content
The simFlight Network Forums
varadero129

Can an axis change its function depending on a button state?

Recommended Posts

Thank you, Pete! With your kind help, I managed to make it work.

Good. And today I released an update fixing that bug you reported. ;-)

Pete

Share this post


Link to post
Share on other sites

Hi Pete,

I'm back again. Now I would like to change the behaviour of the lever. I want to use it as the landing gear lever in one of the three positions. Can you give me the number that I have to enter to the mode selector button configuration? So I would need the Landing gear number instead of the Flaps. I couldn't find that list that you have mentioned earlier, sorry.

Best regards,

Tamas

"

The controls are listed in a List installed in your FSUIPC Documents folder, in the Modules folder. You can use any control, but obviously only axis controls make much sense. Those are all either named "Axis ..." or end in "set". There are more controls, added by FSUIPC, and listed in the FSUIPC Advanced User's guide. BUT the ones you really want, for the purposes you chose, are currently only published in the "Changes" document included with the recent FSUIPC updates (see Download Links). They are numbered 64101 to 64144, and the ones you want are:

64136 steering tiller

64123 flaps

64122 spoilers/speed brakes

"

Share this post


Link to post
Share on other sites

I'm back again. Now I would like to change the behaviour of the lever. I want to use it as the landing gear lever in one of the three positions. Can you give me the number that I have to enter to the mode selector button configuration? So I would need the Landing gear number instead of the Flaps. I couldn't find that list that you have mentioned earlier, sorry.

There are only two gear lever positions implemented in FS -- Gear Up and Gear Down, and those are the names of the controls.

Look again in the FSUIPC Documents subfolder. The list of controls is there as a PDF. It is installed when you install FSUIPC, alongside all of the other documentation PDFs. You are not looking properly if you can't find it!

Pete

Share this post


Link to post
Share on other sites

Hi Pete,

I am unable to check it now, because my computer went out of order. But anyway, can you send me a link with the complete list of those control numbers that can be used with this LuaValue multiaxes solution? Like these three ones:

64136 steering tiller

64123 flaps

64122 spoilers/speed brakes

In the future I might want to alter the configuration, and I don't want to bother you each and every time :)

There are only two gear lever positions implemented in FS -- Gear Up and Gear Down, and those are the names of the controls.

Look again in the FSUIPC Documents subfolder. The list of controls is there as a PDF. It is installed when you install FSUIPC, alongside all of the other documentation PDFs. You are not looking properly if you can't find it!

Pete

Share this post


Link to post
Share on other sites

You will already have the complete list on your PC already if you have FSUIPC installed, look in the folder;

...Microsoft Games\Microsoft Flight Simulator X\Modules\FSUIPC Documents

for a file called List of FSX Controls.pdf

Share this post


Link to post
Share on other sites

Of course I checked it, but there is no e.g. steering tiller in that. Pete mentioned something like a change (or what's new) document which I was unable to find, and there should be these controls that I am looking for.

You will already have the complete list on your PC already if you have FSUIPC installed, look in the folder;

...Microsoft Games\Microsoft Flight Simulator X\Modules\FSUIPC Documents

for a file called List of FSX Controls.pdf

Share this post


Link to post
Share on other sites

Of course I checked it, but there is no e.g. steering tiller in that. Pete mentioned something like a change (or what's new) document which I was unable to find, and there should be these controls that I am looking for.

The FSX steering tiller is certainly listed in the FSX controls list. It is "Steering set". You only had to search for "steering". But f you want to use FSUIPC-added controls, including those which go direct to FSUIPC's calibration tabs, those are listed in the FSUIPC4 Advanced Users Guide, Just search for Additional "FS" Controls, or see the Contents list at the front.

Pete

Share this post


Link to post
Share on other sites

Hi,

This topic has really piqued my interest and as such did some experimentation to see if I could get this LUA multi-axis to work on a joystick without a toggle state such as provided on the Saitek. Success! What I tried to accomplish since my joystick does not have mixture or prop controls is to toggle a state where the throttle axis would go from throttle --> mixture-->props and return.

References -

original post for instructions - http://forum.simflig...te/#entry435414

clever switching - pg 25, FSUIPC for Advanced Users.pdf

direct to FSUIPC calibration - pg 35, FSUIPC for Advanced Users.pdf

The first thing I did was modify the LUA file since the offset for "clever switching" used that same offset, I just used the next available one.


function applyaxis(val)

cntrl = ipc.readUD(0x66c4)
ipc.control(cntrl,val)
end

event.param("applyaxis")

[/CODE]

The button coding had to be hand made. ( not through FSUIPC UI ) Here are just the relevant section enties w/ notes.

[CODE]
[Buttons]
86=P0,10,Cx510066C0,x00020001 ;Clever Switching toggle on button #10 down
87=B66C0=0 U0,10,Cx030066C4,x0000FA68 ;On button #10 up, Clever Switching=0, use direct to cal. axis throttle (64104=0xFA68)
88=B66C0=1 U0,10,Cx030066C4,x0000FA6A ;On button #10 up, Clever Switching=1, use direct to cal. axis mixture (64106=0xFA6A)
89=B66C0=2 U0,10,Cx030066C4,x0000FA69 ;On button #10 up, Clever Switching=2, use direct to cal. axis propellor (64105=0xFA69)

[LuaFiles]
3=multiaxis

[Auto]
1=Lua multiaxis

[Axes]
2=0Z,256,F,L3:V,0,0,0 ;Throttle axis

[JoystickCalibration]
Throttle=-16384,16383/8
Mixture=-16384,16383
PropPitch=-16384,16383

[Monitor] ;This section is just to show me what mode Im in, broadcasted to the title bar.
Display=4
Monitor0=0,66C0,0,0
[/CODE]

@Pete - I cannot thank you enough for some of the absolutely ingenious things that can be done with FSUIPC! This little LUA file just made my $60 T-Flight Hotas stick into one worth $150!! LOL!

Thanks again,

Regards,

Roman

Edit - was just thinking about this and wondered - Is there a way to have 2 or more conditions on a button press? IE (pseudo logic)

87=B66C0=0 [i][b]and engine is recip or turboprop[/b][/i] U0,10,Cx030066C4,x0000FA68

This way I could setup another set of axis' for a jet only (spoilers and ??)

Share this post


Link to post
Share on other sites

Thank you, Pete! Now I'm unable to try it due to lack of computer :) but as soon as I get or build a new one, I will refer to this topic again.

The FSX steering tiller is certainly listed in the FSX controls list. It is "Steering set". You only had to search for "steering". But f you want to use FSUIPC-added controls, including those which go direct to FSUIPC's calibration tabs, those are listed in the FSUIPC4 Advanced Users Guide, Just search for Additional "FS" Controls, or see the Contents list at the front.

Pete

Share this post


Link to post
Share on other sites

Hi 

 

Earlier in this thread you said:

 

"Note that this technique is extensible for any number of different uses for the same axis and, by using different offsets (66C4 is the next -- the range 66C0 to 66FF is free for users, giving 16 possible DWORDs to use) and renamed versions of "multiaxis.lua", can be applied to any and all axes."

 

I'm having trouble doing this for multiple axis, as I am not sure how to use multiple offsets for the button states.  Can you please explain how I could have 3 axes change function (simultaneously) based on 3 buttons, so a total of nine axes?

 

 

Share this post


Link to post
Share on other sites

You should be able to do it without a problem. 1st use the first byte (0x66C0) of the user offsets to select the 3 modes you want. (0-2)

 

Just a quick test and this should work for 3 buttons. Through the "Buttons + Switches" interface you could use Offset Byte Set with the offset being x66C0 in all 3 modes. Button 8 value = x00, Button 9 value = x01 & Button 10 value = x02.

 

Or hand editing the .ini under [buttons]

 

XX=P0,8,Cx010066C0,x00

XX=P0,9,Cx010066C0,x01

XX=P0,10,Cx010066C0,x02

 

 

Then in the Lua code you would use 3 of the next available DWORDs in the user offsets area for each of the raw axis'. (0x66C1, 0x66C5 & 0x66CA) The following is an example for a recip setup in pseudo code. (not at my FS rig)  

If 0x66C0 = 0 then
  send 0x66C1 to the #1 engine throttle axis offset 
  send 0x66C5 to the #2 engine throttle axis offset
  send 0x66CA to the #3 engine throttle axis offset 
End If

If 0x66C0 = 1 then
  send 0x66C1 to the #1 engine mixture axis offset
  send 0x66C5 to the #2 engine mixture axis offset
  send 0x66CA to the #3 engine mixture axis offset 
End If

If 0x66C0 = 2 then
  send 0x66C1 to the #1 prop pitch axis offset
  send 0x66C5 to the #2 prop pitch axis offset
  send 0x66CA to the #3 prop pitch axis offset 
End If

I wrote something similar for a gentlemen using only 2 axis'. (Beech Baron)  It "may" have been written into one single Lua (???) but in any case the code is there, it may help. This thread.

 

BTW, Pete will not be back around until  November 25th. 

Share this post


Link to post
Share on other sites

Actually, I may not need to. I thought of a very simple way to do this sort of thing, very flexibly. First, make sure your FSUIPC installation is up to date -- latest versions are supplied in the Download Links subforum.

Then save the following as, say, "multiaxis.lua" in your FS Modules folder:

 

function applyaxis(val)
   cntrl = ipc.readUD(0x66c0)
   ipc.control(cntrl,val)
end

event.param("applyaxis")
and edit the FSUIPC INI file, adding this section:

[Auto]

1=Lua multiaxis

(if you already have an [Auto] section, add the line with the next available number).

Now run FS. Go to FSUIPC axis assignments and assign the axis you want to switch as an "FS control", choosing this one from the drop-down list:

Luavalue multiaxis

Then go to the Buttons assignments and assign the buttons you want to use for selecting the axis use, on the right-hand side, as follows:

Offset dword set, with Offsetx66c0 and the Parameter set to the value of the FS or FSUIPC control you want the axis to send.

The controls are listed in a List installed in your FSUIPC Documents folder, in the Modules folder. You can use any control, but obviously only axis controls make much sense. Those are all either named "Axis ..." or end in "set". There are more controls, added by FSUIPC, and listed in the FSUIPC Advanced User's guide. BUT the ones you really want, for the purposes you chose, are currently only published in the "Changes" document included with the recent FSUIPC updates (see Download Links). They are numbered 64101 to 64144, and the ones you want are:

64136 steering tiller

64123 flaps

64122 spoilers/speed brakes

Once you've done all this, exit to FS, select a mode using the buttons/switches you assigned above, then go into FSUIPC joystick calibrations and calibrate the axis for that selection. You'll need to exit to change the mode to calibrate each separately -- FSUIPC doesn't obey the button presses when in the options (for pretty obvious reasons).

Note that this technique is extensible for any number of different uses for the same axis and, by using different offsets (66C4 is the next -- the range 66C0 to 66FF is free for users, giving 16 possible DWORDs to use) and renamed versions of "multiaxis.lua", can be applied to any and all axes.

I've tested all this with FSUIPC 4.754 and FSX. Have fun!

Regards

Pete

 

 

Hi all,

 

I am trying to use the lua above as proposed by Pete, however with a slightly different objective : I am using a Microsoft Sidewinder FF2 joystick, and I would like to achieve the following :

- "Normal" mode : "S" axis is used for throttle, as per default assignement

- "Secondary mode" : using joystick button #2, I want to change the axis assignement so that the throttle axis becomes the prop pitch axis

 

I am using the default Baron with a specific profile to test.

 

I have installed the above lua and followed pete's process above, except I have assigned "Offset dword set", with Offset x66c0 to Button #2, and the Parameter set to "65765" which is listed as Prop pitch axis

 

However, I don't understand the calibration part, and basically nothing happens after I have pressed button #2 once : when I move the axis it still commands throttle...

 

I am sure I am missing something as I am new to lua usage. Maybe something very basic, like the way button #2 is programmed : should it be assigned to "offset dword set x066c0" only when pressed or should I do something else, like "control to repeat while held" or another control when released ?

 

I have FSUIPC registered v4.934

 

Any help appreciated !

 

Best regards

Share this post


Link to post
Share on other sites

Ooops, I must apologize to everyone for being a moron, I finally detected that I had not removed the default FSX joystick axis assignments, so of course it conflicted with the FSUIPC set-up !!

 

It works perfectly now, again sorry for the useless post !!

 

Best regards...

Share this post


Link to post
Share on other sites

Hi,

i found this old thread because i'm also trying to set the explained multiaxis.lua to my Hotas Warthog's x-axis so i can switch between aileron and rudder function.

First of all, i'm running P3Dv3, latest registered FSUIPC version, a default plane in this case.

I already generated the multiaxis.lua in the modules folder as well as added the [AUTO] section to the fsuipc.ini and so on.

Axis and buttons in P3D controls are deleted and controls disabled.

I only use fsuipc calibration and button assignements.

LINDA is installed and running but not used at the moment. Just for your information. Don't know if it might cause problems?

So i think i did setup everything correctly as described in this thread,

I have assigned the "LuaValue Multiaxis" to my x axis and "sent to FS as normal axis" checked.

In the "button and switches" tab i have assigned button 14 and 16 each with "offset dword set" and "x66C0" and one button with parameter 64101 (but it shows x0000FA65 which i think is correct) and the other button with 64103 (it shows then x0000FA67 in the parameter field).

 

Problem is after enabling a function (button) in P3D i can not calibrate aileron or rudder in fsuipc. The x axis seems not to be recognised anymore.

 

Anyone with a possible solution to solve this issue?

 

Thanks,

Simson

 

Edited by Simson
added further information

Share this post


Link to post
Share on other sites

Pete or Tamas,

I have attached my FSUIPC.ini file and the method described appears to be the solution to my predicament but I am not sure how to add the lines you mentioned below. Is it added as is ___ in other word what is "b". My apologies this question come as elementary, I am a complete newbee at this:

On ‎12‎/‎21‎/‎2011 at 5:40 AM, Pete Dowson said:

Actually, I may not need to. I thought of a very simple way to do this sort of thing, very flexibly. First, make sure your FSUIPC installation is up to date -- latest versions are supplied in the Download Links subforum.

Then save the following as, say, "multiaxis.lua" in your FS Modules folder:

 


function applyaxis(val)
   cntrl = ipc.readUD(0x66c0)
   ipc.control(cntrl,val)
end

event.param("applyaxis")
[/CODE]

 

and edit the FSUIPC INI file, adding this section:

[Auto]

1=Lua multiaxis

(if you already have an [Auto] section, add the line with the next available number).

Now run FS. Go to FSUIPC axis assignments and assign the axis you want to switch as an "FS control", choosing this one from the drop-down list:

Luavalue multiaxis

Then go to the Buttons assignments and assign the buttons you want to use for selecting the axis use, on the right-hand side, as follows:

Offset dword set, with Offsetx66c0 and the Parameter set to the value of the FS or FSUIPC control you want the axis to send.

The controls are listed in a List installed in your FSUIPC Documents folder, in the Modules folder. You can use any control, but obviously only axis controls make much sense. Those are all either named "Axis ..." or end in "set". There are more controls, added by FSUIPC, and listed in the FSUIPC Advanced User's guide. BUT the ones you really want, for the purposes you chose, are currently only published in the "Changes" document included with the recent FSUIPC updates (see Download Links). They are numbered 64101 to 64144, and the ones you want are:

64136 steering tiller

64123 flaps

64122 spoilers/speed brakes

Once you've done all this, exit to FS, select a mode using the buttons/switches you assigned above, then go into FSUIPC joystick calibrations and calibrate the axis for that selection. You'll need to exit to change the mode to calibrate each separately -- FSUIPC doesn't obey the button presses when in the options (for pretty obvious reasons).

Note that this technique is extensible for any number of different uses for the same axis and, by using different offsets (66C4 is the next -- the range 66C0 to 66FF is free for users, giving 16 possible DWORDs to use) and renamed versions of "multiaxis.lua", can be applied to any and all axes.

I've tested all this with FSUIPC 4.754 and FSX. Have fun!

Regards

Pete

 

FSUIPC4.ini

Share this post


Link to post
Share on other sites
24 minutes ago, fuzevt said:

Pete or Tamas,

I have attached my FSUIPC.ini file and the method described appears to be the solution to my predicament but I am not sure how to add the lines you mentioned below. Is it added as is ___ in other word what is "b". My apologies this question come as elementary, I am a complete newbee at this:

 

FSUIPC4.ini

Hi fuzevt,

I stopped doing flight sim a few years ago, instead I fly IRL. I don't remember how I achieved this but Pete's description helped a lot. I try ro find my old FSX parameter files maybe I can help you but can you clarify your question? I don't really understand what you need.

Share this post


Link to post
Share on other sites

Is it possible to assign 2 throttle functions on 1 throttle axis. I have HOTAS Cougar Joystick and Throttle and I am attempting to control throttle on a twin engine aircraft. Is it possible to do that with this method? Thanks...

Share this post


Link to post
Share on other sites

Yes.. Make 3 modes with one (cycle modes), or multiple buttons / keys (hot select mode) - Both Engines, Left Engine & Right Engine.. I have similar on my single axis stick.

Share this post


Link to post
Share on other sites

I haven't found my config files, so just follow Pete's instructions and it will work. I had a Saitek pro flight yoke system with throttle quadrant, and I used the 2 left lever for engine 1 and engine 2 and the 3rd lever was used with this method, sometimes, depending on another button's state it was flaps, sometimes it was spoiler arm, and maybe gear lever, I'm not sure.

Share this post


Link to post
Share on other sites
20 hours ago, fuzevt said:

Then go to the Buttons assignments and assign the buttons you want to use for selecting the axis use, on the right-hand side, as follows:

Offset dword set, with Offsetx66c0 and the Parameter set to the value of the FS or FSUIPC control you want the axis to send.

I have FSUIPC ver 4.974, after I go to the "Buttons + Switches" tab and enter the "Offset dword set, with Offsetx66c0 and the Parameter" and I exit to FS and go back to FSUIPC I noticed the Parameter value has changed to "x0000FA7B". Is this right?

Share this post


Link to post
Share on other sites
1 minute ago, fuzevt said:

I have FSUIPC ver 4.974, after I go to the "Buttons + Switches" tab and enter the "Offset dword set, with Offsetx66c0 and the Parameter" and I exit to FS and go back to FSUIPC I noticed the Parameter value has changed to "x0000FA7B". Is this right?

Not sure, did you save each and every page?

Share this post


Link to post
Share on other sites
8 hours ago, fuzevt said:

I noticed the Parameter value has changed to "x0000FA7B". Is this right?

x0000FA7B = 64123. Is that the parameter you want?  Parameters for offsets are expressed in hexadecimal because the main content and use of offsets is more relevant in that radix.  x66C0 = 26304, but, again, offsets are more known (and documented) in hexadecimal.

Pete

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.