Jump to content

Recommended Posts

Posted

It works the same way if it is throttle 1 or generic throttle. Is there a way to get the TBM to recognize when i pull the throttle down and then into the reverse section on the tq6+? Like I said, the lua script using the mixture axis to get the plane into high idle works. I think I could write a lua script that mimics that behavior for the throttle side if I knew the datarefs for it.

Posted (edited)
On 1/25/2020 at 9:29 AM, flexcopmnpd said:

It works the same way if it is throttle 1 or generic throttle. Is there a way to get the TBM to recognize when i pull the throttle down and then into the reverse section on the tq6+? Like I said, the lua script using the mixture axis to get the plane into high idle works. I think I could write a lua script that mimics that behavior for the throttle side if I knew the datarefs for it.

Yes there is if you have SPAD.neXt which allows you to program a button/keyboard press in a designated range of your throttle axis. 

I have a PFC throttle set & have it set up to use one of the prop levers as the mixture axis & one of my throttle axis as throttle 1. I have it set so as I move into the reverse gate range of my throttle SPAD switches on the reverser. Moving the lever back out of the gate automatically moves the throttle to ground idle. Works quite well.

 

Edited by Rossco
  • 1 month later...
Posted

Hi! - have not even tried it yet to notice anything at all...but just asked because it seems like checking 30-60 times per second all flight long would be wasted cpu cycles regardless. Figured once per second should be fine but not so sure that Flywithlua even has such a timing.

Thanks for the info, and for putting this together...was a nice idea!

  • 3 weeks later...
  • 2 weeks later...
Posted

All you have to do is to replace the axis number in the mixture.lua script with the number for your prop 1 axis.

Try this:

  • Load the TBM in X Plane
  • Map your prop 1 axis under Joysticks
  • From the X Plane menu select Plugins - FlyWithLua - Write Debug file
  • Open the FlyWithLua_Debug.txt file in the root folder of your X Plane install
  • Search for "clear_all_axis_assignments()" in this file
  • The next couple of lines will contain all your axis assignments with their respective numbers
  • Take the value for prop 1 and replace "28" in the following line in the mixture.lua script
DataRef("mixture_axis", "sim/joystick/joy_mapped_axis_value", "readonly", 28) --Replace 28 with your prop 1 axis value

Reload all Lua script files.

Posted

Yes you can... the easiest way is to simply reuse the existing code in this script and just change it for the flaps.

So you will need to add the following: 

  • A dataref for the flap handle (You can use the X Plane default "sim/flightmodel/controls/flaprqst" and make it writable as well.
  • A dataref for your flap axis from the joystick... you will have to look up your axis number again.
  • In the getvalue() function just add the code to check the flap axis dataref for the 3 ranges (up, takeoff, landing) and then set the flap handle dataref to 0 (UP), 0.5 (TO) or 1 (LDG).

No need to use commands in the sethandle() function.

That's it.

Posted (edited)

I can't find the axis assignment for my prop lever.  I made a debug txt file as instructed but could not find anything after the clear all axis assignments line, so I deleted the file and tried to make a new one but the new ones won't even have a clear axis entry.

 

EDIT: restarted the sim and followed the instructions and I got this line:

clear_all_button_assignments = function: 0x23fb9538

 

Nothing else about axis that  I could see.

Edited by Atlas
Posted

Hi,

My method above might not be the best (or correct) one... I tried using a completely different axis and I used the "write axis assignments to log" FlyWithLua macro. This particular axis showed up in the log.txt as number 4, but using this value in the script didn't work. It's the displacement axis in the list below.

clear_all_axis_assignments()
set_axis_assignment( 4, "displacement", "normal" )
set_axis_assignment( 25, "right toe brake", "normal" )
set_axis_assignment( 26, "left toe brake", "normal" )
set_axis_assignment( 27, "yaw", "normal" )
set_axis_assignment( 50, "nosewheel tiller", "normal" )
set_axis_assignment( 75, "roll", "normal" )
set_axis_assignment( 76, "pitch", "normal" )
set_axis_assignment( 77, "nosewheel tiller", "normal" )
set_axis_assignment( 78, "throttle", "normal" )

So what I ended up doing was to open DataRefTool and and in the filter window at the bottom type "sim/joystick/joy_mapped_axis_value".
Make your DataRefTool window wider so you can see most of the axis values.
Now move the particular joystick axis that you've mapped and look in the list to see which value is changing.
Count the position and subtract 1... The array starts at 0.
This should be the actual number of the axis that you can use in the script.

In my case the actual number was 15. Go figure...

Try this and see if it works for you.

Posted

Hi!  That method worked, I've now found the axis number for my prop and mixture levers and I've successfully mapped my prop lever to work.  However, I cannot figure out how to make the same work for flaps and ended up having my .lua file quarantined by FlyWithLua!

Posted
1 hour ago, Atlas said:

Hi!  That method worked, I've now found the axis number for my prop and mixture levers and I've successfully mapped my prop lever to work.  However, I cannot figure out how to make the same work for flaps and ended up having my .lua file quarantined by FlyWithLua!

In the FlyWithLua menu just select the "return all quarantined script files" to get your file back. Also undo the changes you made for the flaps to get it back to a working state with your throttle and reload the script in FlyWithLua menu. This should at least give you a working throttle again.

You can send me you axis numbers for your prop and flaps and I will see if I can adapt the script to work for flaps.

 

Posted
1 hour ago, Atlas said:

Flaps is 29.  Prop is working now, that's fine, it's just that I can't exactly follow your instructions for the flaps and I'm no good with scripting.

Please try the attached script... I have used your axis number for the flaps, but you should just change the mixture axis to your number again.

This code will move the flap lever to the following positions based on your axis:

  • > 90% = UP
  • Between 45% and 55% = TO
  • < 10% = LDG

You can change the values in the script to suit your needs. If your axis is working the wrong way around just reverse the axis in the Joystick settings in X Plane.

Mixture.lua

  • 2 months later...
Posted
On 4/23/2020 at 9:28 AM, jfjoubert said:

Hi,

My method above might not be the best (or correct) one... I tried using a completely different axis and I used the "write axis assignments to log" FlyWithLua macro. This particular axis showed up in the log.txt as number 4, but using this value in the script didn't work. It's the displacement axis in the list below.


clear_all_axis_assignments()
set_axis_assignment( 4, "displacement", "normal" )
set_axis_assignment( 25, "right toe brake", "normal" )
set_axis_assignment( 26, "left toe brake", "normal" )
set_axis_assignment( 27, "yaw", "normal" )
set_axis_assignment( 50, "nosewheel tiller", "normal" )
set_axis_assignment( 75, "roll", "normal" )
set_axis_assignment( 76, "pitch", "normal" )
set_axis_assignment( 77, "nosewheel tiller", "normal" )
set_axis_assignment( 78, "throttle", "normal" )

So what I ended up doing was to open DataRefTool and and in the filter window at the bottom type "sim/joystick/joy_mapped_axis_value".
Make your DataRefTool window wider so you can see most of the axis values.
Now move the particular joystick axis that you've mapped and look in the list to see which value is changing.
Count the position and subtract 1... The array starts at 0.
This should be the actual number of the axis that you can use in the script.

In my case the actual number was 15. Go figure...

Try this and see if it works for you.

Hi,   I am having real trouble solving this, 

I have got the Mixture setting sorted,    and its only controlling Off to Low  to High (which I want)

if mixture_axis > 0.99 then SetTo = 2 end
if mixture_axis < 0.60 then SetTo = 1 end
if mixture_axis < 0.01 then SetTo = 0 end

Now I am having trouble creating a new Lua ( I really havent a clue) for my Prop axis,  I want this to be used to move from High Idle (2) to Flight Idle (3).

I assume something like 

if mixture_axis > 0.95 then SetTo = 3 end
if mixture_axis < 0.05 then SetTo = 2 end

Will work,  However I have no idea how to make a lua work, Ive tried coping the Mixture one and then Changing the above, I have tried finding the Prop axis id using the methods described I just can get it to work.    28 is my Mixture 1 value.    I cant find my Prop 1 value.

 

Any help would be great.

Posted

Hi, I don't quite understand what you are trying to do. What do you want to use the Prop axis for? Do you want to use the mixture axis and the prop axis as well as the throttle axis all to control one virtual lever?

Posted

I was going to try having one axis to control the Off - Low idle - High Idle.

Then another axis to move the stick from High Idle to Flight Idle. 

Thank You.

Neil 

Posted

So Mixture for cut off - lo idle - hi idle

Prop to move to flight idle

Throttle for rev-taxi-flight?

Would be possible, I think.

What should happen if prop says flight idle but mixture says low idle?

What should happen if prop says idle but the throttle is not in idle?

 

 

 

Posted

Hi N1EL,

With the awesome help from @jfjoubert, we were able to come up with this code for lua.  I use this on a CH Throttle Quadrant and have 1 lever for flight idle to max throttle, 1 lever for flight idle to reverse, 1 lever for hi/low idle to cutoff, and 1 lever for flaps.  It's a bit complicated to set up so just fire away.  You will need to set your throttle lever to Collective, idle-to-reverse as Wing Sweep, hi/low idle as Prop 1, and flap lever to Mixture 2.  Depending on your setup, you may need to tick the reverse axis box.  Mine is ticked for Mixture 2, Wing Sweep, and Collective.

The way it works is that you need to bring your throttle back to flight idle before the idle-to-reverse lever would work, but regardless of the idle-to-reverse lever, the throttle would work if you move it.  I think you need to be on flight idle on the throttle too before the hi/low idle lever would work but I don't recall if I tested this.  Obviously once the hi/low idle lever is set, I don't touch it again until shutdown.

Hope that helps!

 

Mixture Separate Axis.lua

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...