ark1320 Posted January 13, 2023 Report Posted January 13, 2023 In case it helps anyone, here's what I came up with for the HJet throttles. I currently just use one axis lever to control both engines , but the below can easily be expanded to use two axis levers for those so motivated (each script below gets divided up into two scripts, one for each engine/throttle lever, and two offsets are used, 0xA000 and 0xA002). This single lever solution makes use of three tiny Lua scripts. With the main script the Saitek controller throttle axis value is stored in offset 0xA000. If the value changes by at least a magnitude of 128 the function HJet_Throttle() is called to convert the raw axis value to a number between 0 and 1, and this number is written to the two HJet Lvars that control the two HJet throttles. This script is loaded automatically when FSUIPC starts through the FSUIPC7.ini Profile Specific file entry that looks like this: [Auto.HJet] 1=Lua HJet_Throttle Here is the main script that gets loaded automatically: -- HJet_Throttle.lua function HJet_throttle() throttle = (ipc.axis("T","X") + 16384)/32587 -- need throttle range of 0 to 1 for TQ throttle axis range of -16384 to +16203 ipc.writeLvar("L:THROTTLE1_SET", throttle) ipc.writeLvar("L:THROTTLE2_SET", throttle) end --******************************************** --********* Main Program ******************** --******************************************** ipc.writeLvar("L:THROTTLE1_SET", 0) -- initialize throttles to idle position. ipc.writeLvar("L:THROTTLE2_SET", 0) ipc.writeLvar("L:HA420_ThrottlePos_R", 50) ipc.writeLvar("L:HA420_ThrottlePos_L", 50) event.offsetmask(0xA000, 0xFF80, "SW", "HJet_throttle") -- mask requires a change of at least 128 to trigger the function call. -- Under FSUIPC7 Axis Assignments, the HJet throttle axis value has been -- assigned to Offset 0xA000 as Offset Word Set Main script axis assignment. The two tiny scripts below move the HJet throttles between cutoff and idle. There is switch at the bottom of my Saitek throttle axis. When the switch is closed by moving the lever down into the switch, HjetThrotCuttoff.lua is called, and when the lever is moved up out of the switch position HjetThrotIdle.lua is called. --HjetThrotCuttoff.lua ipc.writeLvar("L:THROTTLE1_SET", -1) ipc.writeLvar("L:THROTTLE2_SET", -1) ipc.writeLvar("L:HA420_ThrottlePos_R", 0) ipc.writeLvar("L:HA420_ThrottlePos_L", 0) --HjetThrotIdle.lua ipc.writeLvar("L:THROTTLE1_SET", 0) ipc.writeLvar("L:THROTTLE2_SET", 0) ipc.writeLvar("L:HA420_ThrottlePos_R", 50) ipc.writeLvar("L:HA420_ThrottlePos_L", 50) Setup of the cutoff - idle switch. Frankly, whether or not all the above is a "good" solution for the HJet throttles I don't know. But I have been using this for a while now and it seems to work fine. And of course, this solution is set up to be HJet Profile Specific. Al HJetThrotCutoff.lua 187 B · 1 download HJet_Throttle.lua 985 B · 1 download HjetThrotIdle.lua 184 B · 1 download 1
ark1320 Posted Monday at 02:12 AM Author Report Posted Monday at 02:12 AM For completeness, here is how I expanded the information in my post above for the HJet throttles to use two physical throttle levers on my Saitek Throttle Quadrant. With the throttle1 main script the Saitek controller throttle axis value is stored in offset 0xA000. If the value changes by at least a magnitude of 128 the function HJet_Throttle1() is called to convert the raw axis value to a number between 0 and 1, and this number is written to the HJet Lvar that controls HJet throttle1. Same idea for throttle2 which uses offset 0xA002. These scripts are loaded automatically when FSUIPC7 starts through the FSUIPC7.ini Profile Specific file entry as shown below: [Auto.HJet] 1=Lua HJet_Throttle1 2=Lua HJet_Throttle2 Here are the two main throttle Lua scripts that get loaded automatically: -- HJet_Throttle1.lua function HJet_throttle1() throttle = (ipc.axis("T","X") + 16384)/32587 -- need throttle range of 0 to 1 for TQ throttle axis range of -16384 to +16203, which is idle to full power. ipc.writeLvar("L:THROTTLE1_SET", throttle) -- ipc.axis("T","X") is the FSUIPC "X" axis value of TQ "T" (approximately between -16384 and + 16384 ) end --*********************************************************************** --*** Main Part of Throttle1 Program That Calls the Above Function *** --************************************************************************ ipc.writeLvar("L:THROTTLE1_SET", 0) -- initialize throttle1 to idle position. ipc.writeLvar("L:HA420_ThrottlePos_L", 50) event.offsetmask(0xA000, 0xFF80, "SW", "HJet_throttle1") -- mask requires a change of at least 128 in offset 0xA000 to trigger the function call. -- Under FSUJIPC7 Axis Assignments, this HJet throttle1 axis value has been assigned to Offset 0xA000 as Offset Word Set as shown below Main script throttle1 FSUIPC7 axis assignment. -- HJet_Throttle2.lua function HJet_throttle2() throttle = (ipc.axis("T","Y") + 16384)/32587 -- need throttle range of 0 to 1 for TQ throttle axis range of -16384 to +16203, which is idle to full power. ipc.writeLvar("L:THROTTLE2_SET", throttle) -- ipc.axis("T","Y") is the FSUIPC "Y" axis value of TQ "T" (approximately between -16384 and + 16384 ) end --*********************************************************************** --*** Main Part of Throttle 2 Program That Calls the Above Function *** --************************************************************************ ipc.writeLvar("L:THROTTLE2_SET", 0) -- initialize throttle2 to idle position. ipc.writeLvar("L:HA420_ThrottlePos_R", 50) event.offsetmask(0xA000, 0xFF80, "SW", "HJet_throttle2") -- mask requires a change of at least 128 in offset 0xA000 to trigger the function call. -- Under FSUJIPC7 Axis Assignments, this HJet throttle2 axis value has been assigned to Offset 0xA002 as Offset Word Set as shown below. Main script throttle2 FSUIPC7 axis assignment. The four tiny scripts below move the HJet throttles between cutoff and idle. There is a switch at the bottom of my Saitek throttle axes. When the switch is closed by moving a throttle lever down into the switch, the associated HjetThrotCuttoff script is called, and when the lever is moved up out of the switch position the associated HjetThrotIdle.lua is called. Here are the two scripts for throttle1 --HjetThrotCutoff1.lua ipc.writeLvar("L:THROTTLE1_SET", -1) -- cutoff value is -1, idle to full power is 0 to 100 ipc.writeLvar("L:HA420_ThrottlePos_L", 0) -- cuttoff position, 50 is idle, 100 is full power position --HjetThrotIdle1.lua ipc.writeLvar("L:THROTTLE1_SET", 0) -- idle value, -1 is cuttoff, 1 is full power ipc.writeLvar("L:HA420_ThrottlePos_L", 50) -- idle position of throttle lever, 0 is cuttoff, 50 is idle, 100 is full power position Here are the two scripts for throttle 2 --HjetThrotCutoff2.lua ipc.writeLvar("L:THROTTLE2_SET", -1) -- cutoff value is -1, idle to full power is 0 to 100 ipc.writeLvar("L:HA420_ThrottlePos_R", 0) -- cuttoff position, 50 is idle, 100 is full power position --HjetThrotIdle2.lua ipc.writeLvar("L:THROTTLE2_SET", 0) -- idle value, -1 is cuttoff, 1 is full power ipc.writeLvar("L:HA420_ThrottlePos_R", 50) -- idle position of throttle lever, 0 is cuttoff, 50 is idle, 100 is full power position HjetThrotIdle1.lua HJet_Throttle1.lua HJet_Throttle2.lua HjetThrotCutoff1.lua HjetThrotCutoff2.lua HjetThrotIdle2.lua
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now