Jump to content
The simFlight Network Forums

Compound Axis?


Kevin Brigden

Recommended Posts

Hi Pete and the gang, hoping you all might be able to help me out here. I've read through the tutorial material and done a forum search but I've not quite found the answer I'm looking for. 

 

What I'd like to do

 

I have a single throttle quadrant for the Saitek Pro Flight. I understand the concept of compound button mapping and I would like to apply this to twin engine controls. Specifically: I wish to be able to control both engines throttles, props and mixtures when in mode 1, the left engine controls in mode 2 and the right engine controls in mode 3. I thought this might be a case of simply applying the relevant logic statements as per compound buttons but that doesn't appear to be the case. 

 

i.e. 

 

[Axes.Baron 58 - Twin Piston]
...


2=C(+0,8)0Z,256,F,65765,0,0,0
3=C(+0,8)0U,256,F,66291,0,0,0
4=C(+0.8)0V,256,F,66292,0,0,0

In this instance, button 8 represents the mode 1 detent of the control wheel on the back of the right hand grip. My plan was to then generate similar lines of code for "engine 1 prop, engine 1 mixture" etc. Unfortunately, this first stage in my testing rendered the axes inoperable suggesting I cocked up the syntax or that it simply isn't supported. 

 

Any suggestions?

 
 
 
 
Link to comment
Share on other sites

Pete is away until August 17th but in the mean time you might want to take a look at the following topic.. Note LUA programming required.

 

http://forum.simflight.com/topic/70239-can-an-axis-change-its-function-depending-on-a-button-state/

 

Yeah I did eventually find that last night funnily enough :) Unfortunately I can't seem to get that technique to work (although there's a high likelihood that's because I'm thick). 

Link to comment
Share on other sites

Kevin,

 

 It is much more complicated than just a button assignment and axis assignment. You will need a LUA file tailored to your needs. I have a LUA file that will have to highly modified and will give it a shot. There is one drawback to using this method. The axis of the controller does not know where the actual FS control is therefore when you switch modes and move the controller axis the FS control matches the controller axis. In any case will help out in creating a LUA for you, it may take a few hours/days since it's been awhile

Link to comment
Share on other sites

Kevin,

 

 It is much more complicated than just a button assignment and axis assignment. You will need a LUA file tailored to your needs. I have a LUA file that will have to highly modified and will give it a shot. There is one drawback to using this method. The axis of the controller does not know where the actual FS control is therefore when you switch modes and move the controller axis the FS control matches the controller axis. In any case will help out in creating a LUA for you, it may take a few hours/days since it's been awhile

 

Roman my apologies, I should have said that I had fully followed Pete's instructions (including the LUA file) however thus far I have not been able to make it work. As such, I think I was missing something obvious. I'll try your tips now and see how I get on. Please bear in mind, I am a mechanical engineer, not a software engineer so my programming skills are... not the best!

Link to comment
Share on other sites

Roman,

 

That worked perfectly! Excellent work much appreciated! Can I ask a couple of questions of you please?

 

1. At the moment, this switching works by using a single switch to cycle through the modes. Is it possible for me to modify the scripting to enable use of an individual switch for each mode? i.e. switch 8 for mode 1, switch 9 for mode 2 and switch 10 for mode 3? My understanding is that I will need to use a different offset command to the one used in this profile data. I understand that at the moment the command is instructing the offset to increase by a single byte until it reaches a count of 0, 1, 2 and then it loops back to 0. So am I correct in thinking that I need to use a byte "select" or "set" command?

 

2. You have saved me from spending a needless £40 on a second throttle quadrant from Saitek. Please see your private messages. 

 

I also believe that on Pete's return this thread should be a made a sticky or placed in the FAQ because I seriously doubt I am the only person who wished to do this. 

Link to comment
Share on other sites

Kevin,

 

 I already have a better codes set in mind. 1. After switching modes, the axis of the controller will not engage until within a small range of the current axis already set in FS for each throttle, mix & prop. 2. Easier calibration - instead of having in the both "mode" the controls set to "all" engines set the control input to engine 1 and 2 separately. Drawback at this point - only good for 2 engines.

 

 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

 

Will not have much time today to try new coding but hopefully tomorrow.

 

Glad it is working for you.

  • Upvote 1
Link to comment
Share on other sites

Kevin,

 

 I already have a better codes set in mind. 1. After switching modes, the axis of the controller will not engage until within a small range of the current axis already set in FS for each throttle, mix & prop. 2. Easier calibration - instead of having in the both "mode" the controls set to "all" engines set the control input to engine 1 and 2 separately. Drawback at this point - only good for 2 engines.

 

 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

 

Will not have much time today to try new coding but hopefully tomorrow.

 

Glad it is working for you.

 

Strangely, that particular code works with the throttle but now the mixture and prop no longer respond in any setting. 

Link to comment
Share on other sites

My mistake, I needed to remove the existing calibrations before recalibrating. It now works! I suppose the only thing I need to figure out now is how to prevent the activation of an axis suddenly changing the position of an axis after a mode switch. I.e. after setting the right throttle to 80% from idle, I don't the left throttle to flick up to 80% as soon as I move it. However, I think this is an unavoidable consequence of having the physical lever left in the 80% position and in any case I am prepared to live with that. 

Link to comment
Share on other sites

Kevin,

 

 I have a version 1.1 for you. I scrapped the idea in post #10 about easier calibration. I feel that may a bit too much and some logic anomalies may occur. Otherwise I added a "latch" which takes care of problem #1 in the same post above. The controller will not connect to FS until the controller gets in a settable range based on what the what the value for FS is at the time of mode change. In "both engines" & "left engine" it will not latch until the controller matches what the FS "left engine" is at. Range for right control for FS "right engine" only. This will make the axis "unavoidable consequence" at least more livable.

 

 In ALL 3 lua files there is a new setting, "range =". This is a value +/- of the current FS value at the time the mode was changed. It will not "latch" until the controller gets in this range. If you are having problems latching, raise this number. I tested all the way to 500 but at that high of a number the controller will "jerk" the FS control slightly at the time of latching. The faster you move the controller, the higher the number should be in order to latch.

 

 In just the throttle lua there is even one more setting. My FS install did not like the "lua" type display window and would occasionally crash FS on an aircraft change. It works fine in the "greenline" display, results may vary. The setting "greenline =" will change between "lua" and a "greenline" type display. In order to see the "greenline" display make sure that the setting in FSUIPC/About "Hide all single line messages" is unchecked.  (greenline now default)

 

 To install, just copy these files over to FSX\Modules and overwrite while FS is closed. You should not have to do anything else.

 

 With these new files you should add to your preflight SOP or at any aircraft change - When in "all engines" mode make sure all 3 controllers (throttle,prop,mix) are latched by being able to move freely with your throttle quadrant. (Standard issue anyway for real aircraft)   

 

Helpful hint - If you need to adjust any of the user settings use FSUIPC/Key Presses and assign 2 keyboard keys to the following.  Lua MAxis Throttle & LuaKIllAll. This way you can make changes without exiting/restarting FS every time.  Once all setup nicely you can delete these commands.

 

You can get the files here.

 

Hope this works, and...... Much better. I needed to get this type coding done for my controller's lua anyway.  :D

 

EDIT - These should work as long as your throttle quadrant has raw outputs of -16383 to 16384. (Fingers Crossed) If it doesn't and the outputs are different we would have to figure out what the raw outputs are.

 

Roman  

Link to comment
Share on other sites

Kevin,

 

 I have a version 1.1 for you. I scrapped the idea in post #10 about easier calibration. I feel that may a bit too much and some logic anomalies may occur. Otherwise I added a "latch" which takes care of problem #1 in the same post above. The controller will not connect to FS until the controller gets in a settable range based on what the what the value for FS is at the time of mode change. In "both engines" & "left engine" it will not latch until the controller matches what the FS "left engine" is at. Range for right control for FS "right engine" only. This will make the axis "unavoidable consequence" at least more livable.

 

 In ALL 3 lua files there is a new setting, "range =". This is a value +/- of the current FS value at the time the mode was changed. It will not "latch" until the controller gets in this range. If you are having problems latching, raise this number. I tested all the way to 500 but at that high of a number the controller will "jerk" the FS control slightly at the time of latching. The faster you move the controller, the higher the number should be in order to latch.

 

 In just the throttle lua there is even one more setting. My FS install did not like the "lua" type display window and would occasionally crash FS on an aircraft change. It works fine in the "greenline" display, results may vary. The setting "greenline =" will change between "lua" and a "greenline" type display. In order to see the "greenline" display make sure that the setting in FSUIPC/About "Hide all single line messages" is unchecked.  (greenline now default)

 

 To install, just copy these files over to FSX\Modules and overwrite while FS is closed. You should not have to do anything else.

 

 With these new files you should add to your preflight SOP or at any aircraft change - When in "all engines" mode make sure all 3 controllers (throttle,prop,mix) are latched by being able to move freely with your throttle quadrant. (Standard issue anyway for real aircraft)   

 

Helpful hint - If you need to adjust any of the user settings use FSUIPC/Key Presses and assign 2 keyboard keys to the following.  Lua MAxis Throttle & LuaKIllAll. This way you can make changes without exiting/restarting FS every time.  Once all setup nicely you can delete these commands.

 

You can get the files here.

 

Hope this works, and...... Much better. I needed to get this type coding done for my controller's lua anyway.  :D

 

EDIT - These should work as long as your throttle quadrant has raw outputs of -16383 to 16384. (Fingers Crossed) If it doesn't and the outputs are different we would have to figure out what the raw outputs are.

 

Roman  

 

That's awesome, thanks Roman! I'm going to be out of town for a few days doing a rally down to the south of France but I will report back next week when I've tried this latest version.

 

Many thanks

Link to comment
Share on other sites

  • 4 years later...
On ‎8‎/‎8‎/‎2014 at 5:38 PM, spokes2112 said:

Kevin,

 

 It is all set and tested although the readme has something left to be desired. 

 

You can get it here.

I have HOTAS Cougar by Thrustmaster, which has a single throttle axis and I'd like to use its "Dogfight" button to assign diferent modes so I can use a single throttle to control left and right throttle on a 2 engine jet. Will this file work with that without any mods?

Link to comment
Share on other sites

18 hours ago, fuzevt said:

I have HOTAS Cougar by Thrustmaster, which has a single throttle axis and I'd like to use its "Dogfight" button to assign diferent modes so I can use a single throttle to control left and right throttle on a 2 engine jet. Will this file work with that without any mods?

No.. Not really. In the original request the user had 3 axis' available for throttle, mixture & props. In that download (V1 &V1.1) the throttle lua controlled the mixture and prop lua's too. That part of the code needed to be removed and the instructions updated.

A new kit just for throttles (2 engine only) is here

  • Like 1
Link to comment
Share on other sites

4 hours ago, spokes2112 said:

No.. Not really. In the original request the user had 3 axis' available for throttle, mixture & props. In that download (V1 &V1.1) the throttle lua controlled the mixture and prop lua's too. That part of the code needed to be removed and the instructions updated.

A new kit just for throttles (2 engine only) is here

Spokes2112,

I AM A BELIEVER...IT WORKED PERFECT FIRST TRY!!!!!Now i'm getting ready to get out to the "great blue yonder". MANY MANY Million thanks....

  • Thanks 1
Link to comment
Share on other sites

  • 2 weeks later...
On ‎9‎/‎26‎/‎2018 at 4:09 PM, spokes2112 said:

No.. Not really. In the original request the user had 3 axis' available for throttle, mixture & props. In that download (V1 &V1.1) the throttle lua controlled the mixture and prop lua's too. That part of the code needed to be removed and the instructions updated.

A new kit just for throttles (2 engine only) is here

Spokes 2112,

How do you adjust the engine notifications to the center. I have a 3 monitor setup at 5800 X 1080 and often I miss which engine control is active because its off to the very left. Is there a method to adjust to the center monitor? Thanks

Link to comment
Share on other sites

Howdy,

I added one  line of code to get you close..
Line #43 - ipc.setowndisplay("Throttle Commanded", 48, 2, 4, 0)
Left edge located at 48% of total sim width (2784px from 0) , Top edge is 2% down (in case you have UI menu showing - 22px from 0), a window width of 4% (232px).. The last value, % of sim height, I have found in testing that it will automatically grow in height to accomodate text if set to zero.
The above values should set the info window dead center in your sim.
Adjust values if necessary (Note - Unsure, but believe only integers are allowed) then change to different aircraft, then back to original aircraft to test.
For more info on this command, see Modules\FSUIPC Documents\FSUIPC Lua Library.pdf, page 8 or so.
Just redownload the package again to get the new lua.

Hope it works for you.
Roman

Edited by spokes2112
Recalculated values (lua & post) for your resolution - after a morning coffee ;)
Link to comment
Share on other sites

On ‎10‎/‎6‎/‎2018 at 6:07 PM, spokes2112 said:

Howdy,

I added one  line of code to get you close..
Line #43 - ipc.setowndisplay("Throttle Commanded", 48, 2, 4, 0)
Left edge located at 48% of total sim width (2784px from 0) , Top edge is 2% down (in case you have UI menu showing - 22px from 0), a window width of 4% (232px).. The last value, % of sim height, I have found in testing that it will automatically grow in height to accomodate text if set to zero.
The above values should set the info window dead center in your sim.
Adjust values if necessary (Note - Unsure, but believe only integers are allowed) then change to different aircraft, then back to original aircraft to test.
For more info on this command, see Modules\FSUIPC Documents\FSUIPC Lua Library.pdf, page 8 or so.
Just redownload the package again to get the new lua.

Hope it works for you.
Roman

Again on the money...Having lots of fun and LUA education....again many Thanks!!!

  • Thanks 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • 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.