flexcopmnpd Posted January 25, 2020 Report Posted January 25, 2020 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. Quote
Rossco Posted January 27, 2020 Report Posted January 27, 2020 (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 January 27, 2020 by Rossco Quote
Hangar Posted March 9, 2020 Report Posted March 9, 2020 @Ch.Cole Anyway of having the script check once per second instead of every frame? Quote
Ch.Cole Posted March 9, 2020 Report Posted March 9, 2020 @Hangar sure, just change the two do_every_frame(...) in lines 7 and 8 to do_often(..). It should work, although with a delay. Do you have the feeling that it slows down anything with do_every_frame? Quote
Hangar Posted March 9, 2020 Report Posted March 9, 2020 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! Quote
derekjames Posted March 31, 2020 Report Posted March 31, 2020 This sounds like a super useful lua script, but the link seems to be gone... does the author still have it available somewhere? Cheers Quote
Atlas Posted April 14, 2020 Report Posted April 14, 2020 Just downloaded now, link still works. Quote
Atlas Posted April 21, 2020 Report Posted April 21, 2020 (edited) How can I change the lua file so that it works on the prop 1 axis instead of the mixture axis? Thanks! Edited April 21, 2020 by Atlas Quote
jfjoubert Posted April 22, 2020 Report Posted April 22, 2020 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. Quote
Atlas Posted April 22, 2020 Report Posted April 22, 2020 Thanks, I will try that. Any chance of making this work for flaps too so that I can have a flap lever instead of using a toggle switch? Quote
jfjoubert Posted April 22, 2020 Report Posted April 22, 2020 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. Quote
Atlas Posted April 23, 2020 Report Posted April 23, 2020 (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 April 23, 2020 by Atlas Quote
jfjoubert Posted April 23, 2020 Report Posted April 23, 2020 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. Quote
Atlas Posted April 23, 2020 Report Posted April 23, 2020 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! Quote
jfjoubert Posted April 23, 2020 Report Posted April 23, 2020 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. Quote
Atlas Posted April 23, 2020 Report Posted April 23, 2020 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. Quote
jfjoubert Posted April 23, 2020 Report Posted April 23, 2020 No probs... I will take a look and see if I can get the flaps working for you. Sit tight... Quote
jfjoubert Posted April 23, 2020 Report Posted April 23, 2020 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 Quote
Atlas Posted April 23, 2020 Report Posted April 23, 2020 That is working beautifully now, thank you very much!! I can understand enough that I've tweaked the values to suit my preferences, but that is 0.01% of the work. Thank you @jfjoubert and @Ch.Cole for providing the other 99.99%! 1 Quote
N1EL Posted July 1, 2020 Report Posted July 1, 2020 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. Quote
Ch.Cole Posted July 7, 2020 Report Posted July 7, 2020 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? Quote
N1EL Posted July 7, 2020 Report Posted July 7, 2020 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 Quote
Ch.Cole Posted July 8, 2020 Report Posted July 8, 2020 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? Quote
Atlas Posted July 8, 2020 Report Posted July 8, 2020 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 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.