Jump to content
Sign in to follow this  
guenseli

reworked PMDG J41 LUA Script

Recommended Posts

I tried your shortened LUA file, but for some reason that didn't work at all, wich could of course be caused by a mistake I made myself. However, I always thought I had the latest FSUIPC (4.6), but since you posted the link to the updates thread, I realised that there's an even higher version available, so I updated to 4.661. I reverted back to your original (long) LUA file and now, using my M Panel to control the SPD bug, I couldn't get a freeze-up or CTD with the wonderful Jetstream 4100. Thanks for your efforts! It's very much appreciated!Big%20Grin.gif

Share this post


Link to post

Glad to hear!


Guenter Steiner
--------------------------------------------------------------------------------------

Betatester for: A2A, LORBY, FSR-Pillow Tester
--------------------------------------------------------------------------------------

Share this post


Link to post

Confirmed. Switching logging off in the FSUIPC settings and/or .ini file makes this script work without freezes.Günter, and what about the new version of this script you are working on? Any success?


Artem Crum, EASA PPL
•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
LINDA Lua Integrated Non-complex Device Assigning
•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••

Share this post


Link to post
Confirmed. Switching logging off in the FSUIPC settings and/or .ini file makes this script work without freezes.Günter, and what about the new version of this script you are working on? Any success?
Yes, I have had "success" with the event.param, meaning it was working in a little test file.But I think the more successful way is to split the LUA scripts into two parts: the "normal" and this one with the AP dial switches to get not too long scripts.So, answering your question: no, theres no new LUA script for the J41

Guenter Steiner
--------------------------------------------------------------------------------------

Betatester for: A2A, LORBY, FSR-Pillow Tester
--------------------------------------------------------------------------------------

Share this post


Link to post
Yes, I have had "success" with the event.param, meaning it was working in a little test file.But I think the more successful way is to split the LUA scripts into two parts: the "normal" and this one with the AP dial switches to get not too long scripts.So, answering your question: no, theres no new LUA script for the J41
Is there some great difficulties happen with new script model (event.param)?The idea not to reload whole script for each button press (rotary especial) looks quite reasonable. I'm doing some programming myself so it's a technical ineterest. Any unsolvable problems with it?

Artem Crum, EASA PPL
•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
LINDA Lua Integrated Non-complex Device Assigning
•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••

Share this post


Link to post

I had great difficulties at the beginning, but a nice forum member helped me a lot!event.param is good but isn't as practicable as my "normal" LUAs.As an example:normal LUA is

if param == 10 then ...

for a rotary switch (VRInsight MCP)and with event.param I need to write

if param == 10 or param == 11 then

because the LUA isn't reloading the script.Normally no problem at all, but for me that means that I have to re-do thousands of assignments with my current settings :Whistle:And a second AP scripts solves the problem also (it seems so), so I don't want to do that hard work.


Guenter Steiner
--------------------------------------------------------------------------------------

Betatester for: A2A, LORBY, FSR-Pillow Tester
--------------------------------------------------------------------------------------

Share this post


Link to post
I had great difficulties at the beginning, but a nice forum member helped me a lot!...
I see. I've just made some tests and have found that event.param algorythm works little better with displaying correct value to VRI MCP. There is little or no lag at displaying value. And as for 100 feet difference, I believe the solution is to set ipc.sleep(40) before code block which writes value back to MCP. Worked in my new script and should work in the old (your's) one.Ex.:
    	    	ipc.sleep(40) -- <<<< HERE IT IS			buffer = ipc.readLvar("L:AltSelAlt")/100		if buffer <= 0 then		buffer = 0		end			com.write(dev, string.format("ALT%03d", buffer), 8)

It seems that this little delay allows to read the correct current value from L:AltSelAlt and the previous one.And moving the COM-port connection procedure to plugin script where it runs only once at script load is a better way to do the thing (than doing the reconnect at each button press). For programmer's point of view. The other part of the script for working with buttons is better to leave as it is (you are right!).I could show the whole script if you're interested in.


Artem Crum, EASA PPL
•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
LINDA Lua Integrated Non-complex Device Assigning
•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••

Share this post


Link to post
Hi! im looking for a trainer to learn me how to fly this J41!PLEASE REPLY
And you think in a Thread about LUA script you will get the answer??? :(@ Artem,yes I'm very interested in such a good programmed script!!!As you will obvisiously see, I'm no programmer, just fiddling around to get some things to work.I'm very interested in a well programmed LUA script for the J41! (and many others, too)btw: do you know about a way to get the MCP Displays also work in the MD11???many thanks!Günter

Guenter Steiner
--------------------------------------------------------------------------------------

Betatester for: A2A, LORBY, FSR-Pillow Tester
--------------------------------------------------------------------------------------

Share this post


Link to post

As for MD11 - why not to make it exactly like JS41? If you could get data from MD11 AP then you can write it back to MCP.I don't own the MD11, so can't help with it.And here it what I made based on your script. Nothing special, just reworked and optimized.

--###########################################################----## VRI MCP Rotaries/Display script  v0.9b  11 apr. 2011  ##----## by Artem Crum, artem.crum@gmail.com           		##-- --## Based on script originaly written by Guenter Steiner  ##----###########################################################---- WHAT FOR-- This script is for controlling PMDG JS41 autopilot rotaries with VRInsight MCP Combo unit-- !!! ONLY rotaries rotation is encoded, not the rotary presses or other buttons !!!-- Script updates MCP display info accordingly to what is set inside the simulator-- HOW TO USE-- bla-bla-bla about setting up the staff... -- to be written by someone whou knows english better than I do ---- 1) BTW Script should be started automaticaly form *ipcReady.lua* file in modules folder--	You should ads there smth like that: ipc.runlua("pmdg-js41-rotaries.lua")---- 2) In FSUIPC's Buttons/Switches section the "LuaValue pmdg-js41-rotaries" control should be used-- -- 3) !!! Both press and release settings should be set in FSUIPC for each MCP button !!!-- LuaValue parameters-- Press/Release settings in FSUIPC-------------------------------------- 1/2 - ALT plus-- 3/4 - ALT plus fast-- 5/6 - ALT minus-- 7/8 - ALT minus fast--------------------------------------- 11/12 - HDG plus-- 13/14 - HDG plus fast-- 15/16 - HDG minus-- 17/18 - HDG minus fast--------------------------------------- 21/22 - CRS plus-- 23/24 - CRS plus fast-- 25/26 - CRS minus-- 27/28 - CRS minus fast--------------------------------------- 31/32 - IAS plus-- 33/34 - IAS plus fast-- 35/36 - IAS minus-- 37/38 - IAS minus fast--------------------------------------- 41/42 - VS plus-- 43/44 - VS minus--------------------------------------- Tuning fast rotation speedsfast_alt = 10 -- << increment value when rotary in fast mode fast_hdg = 5fast_crs = 5fast_ias = 3-- VRI settingsif VRImodel == nil then  VRIdevice = "COM3"   VRIdriver = "COM9"endspeed = 115200 handshake = 0  minsize = 8maxsize = 8 	-- ####################################################### ---- ## No more settings below this boundry !!!   		## --	-- ####################################################### ---- Trying to make a persistent connection to VRI MCPdev = com.open(VRIdevice, speed, handshake)if dev == 0 then	ipc.log("Could not open VRIdevice port!")	ipc.display("Could not open VRIdevice port!")	ipc.sleep(5000)end-- Working with MCP Rotariesfunction JS41dials(param)	-- AP ALT Rotary	if param > 0 and param < 10 then			-- ALT plus		if param == 1 or param == 2 then			Var = ipc.readLvar("IrcAltSelKnob")			if Var > 100 then Var = 1 end			ipc.writeLvar("IrcAltSelKnob", Var+1)			ipc.control(66587,3921)			ipc.control(66587,8031)		-- ALT plus fast		elseif param == 3 or param == 4 then			Var = ipc.readLvar("IrcAltSelKnob")			if Var > 100 then Var = 1 end			ipc.writeLvar("IrcAltSelKnob", Var+5)			for n=1, fast_alt, 1 do ipc.control(66587,3921) end			ipc.control(66587,8031)		-- ALT minus		elseif param == 5 or param == 6 then			Var = ipc.readLvar("IrcAltSelKnob")			if Var < 1 then Var = 100 end			ipc.writeLvar("IrcAltSelKnob", Var-1)			ipc.control(66587,3920)			ipc.control(66587,8031)		-- ALT minus fast		elseif param == 7 or param == 8 then			Var = ipc.readLvar("IrcAltSelKnob")			if Var < 1 then Var = 100 end			ipc.writeLvar("IrcAltSelKnob", Var-5)			for n=1, fast_alt, 1 do ipc.control(66587,3920) end			ipc.control(66587,8031)		end			-- Updating MCP display		-- Only altitude		ipc.sleep(50) -- << waiting for FSX data update				buffer = ipc.readLvar("L:AltSelAlt")/100		if buffer < 0 then buffer = 0 end				com.write(dev, string.format("ALT%03d", buffer), 8)					return -- << finishing function execution	end		-- ############################################################## --			-- AP HDG Rotary	if param > 10 and param < 20 then			-- HDG plus		if param == 11 or param == 12 then			ipc.control(66587,26902)			ipc.control(66587,8031)		-- HDG plus fast		elseif param == 13 or param == 14 then			for n=1, fast_hdg, 1 do ipc.control(66587,26902) end			ipc.control(66587,8031)		-- HDG minus		elseif param == 15 or param == 16 then			ipc.control(66587,26901)			ipc.control(66587,8031)		-- HDG minus fast		elseif param == 17 or param == 18 then			for n=1, fast_hdg, 1 do ipc.control(66587,26901)end			ipc.control(66587,8031)					end					-- Updating MCP display		-- Only heading		ipc.sleep(100) -- << waiting for FSX data update					buffer = ipc.readLvar("L:HDGBug")		com.write(dev, string.format("HDG%03d", buffer), 8)					return -- << finishing function execution	end	-- ############################################################## --	-- AP CRS Rotary	if param > 20 and param < 30 then			-- CRS plus		if param == 21 or param == 22 then			ipc.control(66587,26702)			ipc.control(66587,8031)		-- CRS plus fast		elseif param == 23 or param == 24 then			for n=1, fast_crs, 1 do ipc.control(66587,26702) end			ipc.control(66587,8031)		-- CRS minus		elseif param == 25 or param == 26 then			ipc.control(66587,26701)			ipc.control(66587,8031)		-- CRS minus fast		elseif param == 27 or param == 28 then			for n=1, fast_crs, 1 do ipc.control(66587,26701) end			ipc.control(66587,8031)					end				-- No need to send data to MCP here, just exiting		return -- << finishing function execution	end	-- ############################################################## --		-- AP IAS Rotary	if param > 30 and param < 40 then			-- IAS plus 		if param == 31 or param == 32 then					ipc.control(66587,26802)			ipc.control(66587,8031)		-- IAS plus fast		elseif param == 33 or param == 34 then			for n=1, fast_ias, 1 do ipc.control(66587,26802) end			ipc.control(66587,8031)							-- IAS minus		elseif param == 35 or param == 36 then					ipc.control(66587,26801)			ipc.control(66587,8031)		-- IAS minus fast		elseif param == 37 or param == 38 then			for n=1, fast_ias, 1 do ipc.control(66587,26801) end			ipc.control(66587,8031)				end				-- No need to send data to MCP here, just exiting		return -- << finishing function execution	end	-- ############################################################## --			-- AP VS Rotary	if param > 40 and param < 50 then			-- VS inc		if param == 41 or param == 42 then								buffer = ipc.readLvar("L:VSIASTarget")			Var = ipc.readLvar("L:AP_PitchWheel")			ipc.writeLvar("AP_PitchWheel", Var+10)			ipc.writeLvar("L:VSIASTarget", buffer+100)						ipc.control(65894)			ipc.control(66587,8031)						ipc.sleep(40)			buffer = ipc.readLvar("L:VSIASTarget")			com.write(dev, string.format("DSP_%04d", buffer), 8)		-- VS dec		elseif param == 43 or param == 44 then								buffer = ipc.readLvar("L:VSIASTarget")			Var = ipc.readLvar("L:AP_PitchWheel")			ipc.writeLvar("AP_PitchWheel", Var-10)			ipc.writeLvar("L:VSIASTarget", buffer-100)			ipc.control(65895)			ipc.control(66587,8031)			ipc.sleep(40)			buffer = ipc.readLvar("L:VSIASTarget")			com.write(dev, string.format("DSP_%04d", buffer), 8)				end				return -- << finishing function execution	end	-- ############################################################## --				endevent.param("JS41dials")


Artem Crum, EASA PPL
•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
LINDA Lua Integrated Non-complex Device Assigning
•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••

Share this post


Link to post

Thanks Artem,much apprechiated!

If you could get data from MD11 AP
thats exact the problem... I haven't found a way till today to get these datas pulled out of the MD...But as you do not own it, you couldn't help me there... doesn't matter: next project is in line: 737 NGX :biggrin:I doubt that I fly the MD11 anymore after the NGX release...

Guenter Steiner
--------------------------------------------------------------------------------------

Betatester for: A2A, LORBY, FSR-Pillow Tester
--------------------------------------------------------------------------------------

Share this post


Link to post

Have updated the script to control JS41 EFIS Beraring (BRG1/BRG2) rotaries and JS41 EFIS Decision Height (DH) rotary.When adjasting the DH current value is shown on MCP display (set and use MCP EFIS MINS rotary press to get back to normal AP ALT display).Suggestions are welcome! Also looking for someone to write instructions how to set things up.Cannot attach file, so here it is again:

-- ########################################################### ---- ## VRI MCP Rotaries/Display script  v0.9b  11 apr. 2011  ## ---- ## by Artem Crum, artem.crum@gmail.com           		## -- -- ## Based on script originaly written by Guenter Steiner  ## ---- ########################################################### ---- WHAT FOR-- This script is for controlling PMDG JS41 autopilot rotaries with VRInsight MCP Combo unit-- Script updates MCP display info accordingly to what is set inside the simulator-- !!! ONLY rotaries rotation is programmed here, not the rotary presses or other buttons !!!-- HOW TO USE-- bla-bla-bla about setting up the staff... -- to be written by someone whou knows english better than I do ---- 1) BTW Script should be started automaticaly form *ipcReady.lua* file in modules folder--	You should ads there smth like that: ipc.runlua("pmdg-js41-rotaries.lua")---- 2) In FSUIPCs Buttons/Switches section the "LuaValue pmdg-js41-rotaries" control should be used-- -- 3) !!! Both press and release settings should be set in FSUIPC for each MCP button !!!-- LuaValue parameters-- Press/Release settings in FSUIPC-------------------------------------- 1/2 - ALT plus-- 3/4 - ALT plus fast-- 5/6 - ALT minus-- 7/8 - ALT minus fast--------------------------------------- 11/12 - HDG plus-- 13/14 - HDG plus fast-- 15/16 - HDG minus-- 17/18 - HDG minus fast--------------------------------------- 21/22 - CRS plus-- 23/24 - CRS plus fast-- 25/26 - CRS minus-- 27/28 - CRS minus fast--------------------------------------- 31/32 - IAS plus-- 33/34 - IAS plus fast-- 35/36 - IAS minus-- 37/38 - IAS minus fast--------------------------------------- 41/42 - VS plus-- 43/44 - VS minus--------------------------------------- 51/52 - EFIS BRG1 plus / ADI Brightnes plus-- 53/54 - EFIS BRG1 minus / ADI Brightnes minus-- 55/56 - EFIS BRG2 plus / HSI Brightnes plus-- 57/58 - EFIS BRG2 minus / HSI Brightnes minus-- 59/60 - Toggle BRG / Brightness mode (BRG - default mode)--------------------------------------- 61/62 - EFIS DH plus        	<< While rotating MCP ALT display will show the DH currently set-- 63/64 - EFIS DH plus fast      	To get back to AP ALT display use 69/70 params and assign them-- 65/66 - EFIS DH minus          	to MCP DH (MINS) rotary press.   -- 67/68 - EFIS DH minus fast-- 69/70 - Update MCP ALT dispay--------------------------------------- Tuning fast rotation speedsfast_alt = 10 -- << increment value when rotary in fast mode fast_hdg = 5fast_crs = 5fast_ias = 3fast_dh = 5   -- << Decision height-- VRI settingsif VRImodel == nil then  VRIdevice = "COM3"   VRIdriver = "COM9"endspeed = 115200 handshake = 0  minsize = 8maxsize = 8 	-- ####################################################### ---- ## !!! No more settings below this boundry !!!   	## --	-- ####################################################### ---- Setting initial varibles valuesefis_brg1 = 0efis_brg2 = 0efis_dh_alt = 5dim = 0-- Trying to make a persistent connection to VRI MCPdev = com.open(VRIdevice, speed, handshake)if dev == 0 then	ipc.log("Could not open VRIdevice port!")	ipc.display("Could not open VRIdevice port!")	ipc.sleep(5000)end-- Working with MCP Rotariesfunction JS41dials(param)	-- AP ALT Rotary	if param > 0 and param < 10 then			-- ALT plus		if param == 1 or param == 2 then			Var = ipc.readLvar("IrcAltSelKnob")			if Var > 100 then Var = 1 end			ipc.writeLvar("IrcAltSelKnob", Var+1)			ipc.control(66587,3921)			ipc.control(66587,8031)		-- ALT plus fast		elseif param == 3 or param == 4 then			Var = ipc.readLvar("IrcAltSelKnob")			if Var > 100 then Var = 1 end			ipc.writeLvar("IrcAltSelKnob", Var+5)			for n=1, fast_alt, 1 do ipc.control(66587,3921) end			ipc.control(66587,8031)		-- ALT minus		elseif param == 5 or param == 6 then			Var = ipc.readLvar("IrcAltSelKnob")			if Var < 1 then Var = 100 end			ipc.writeLvar("IrcAltSelKnob", Var-1)			ipc.control(66587,3920)			ipc.control(66587,8031)		-- ALT minus fast		elseif param == 7 or param == 8 then			Var = ipc.readLvar("IrcAltSelKnob")			if Var < 1 then Var = 100 end			ipc.writeLvar("IrcAltSelKnob", Var-5)			for n=1, fast_alt, 1 do ipc.control(66587,3920) end			ipc.control(66587,8031)		end			-- Updating MCP display		-- Only altitude		ipc.sleep(50) -- << waiting for FSX data update				buffer = ipc.readLvar("L:AltSelAlt")/100		if buffer < 0 then buffer = 0 end				com.write(dev, string.format("ALT%03d", buffer), 8)					return -- << finishing function execution	end		-- ############################################################## --			-- AP HDG Rotary	if param > 10 and param < 20 then			-- HDG plus		if param == 11 or param == 12 then			ipc.control(66587,26902)			ipc.control(66587,8031)		-- HDG plus fast		elseif param == 13 or param == 14 then			for n=1, fast_hdg, 1 do ipc.control(66587,26902) end			ipc.control(66587,8031)		-- HDG minus		elseif param == 15 or param == 16 then			ipc.control(66587,26901)			ipc.control(66587,8031)		-- HDG minus fast		elseif param == 17 or param == 18 then			for n=1, fast_hdg, 1 do ipc.control(66587,26901)end			ipc.control(66587,8031)					end					-- Updating MCP display		-- Only heading		ipc.sleep(150) -- << waiting for FSX data update					buffer = ipc.readLvar("L:HDGBug")		com.write(dev, string.format("HDG%03d", buffer), 8)					return -- << finishing function execution	end	-- ############################################################## --	-- AP CRS Rotary	if param > 20 and param < 30 then			-- CRS plus		if param == 21 or param == 22 then			ipc.control(66587,26702)			ipc.control(66587,8031)		-- CRS plus fast		elseif param == 23 or param == 24 then			for n=1, fast_crs, 1 do ipc.control(66587,26702) end			ipc.control(66587,8031)		-- CRS minus		elseif param == 25 or param == 26 then			ipc.control(66587,26701)			ipc.control(66587,8031)		-- CRS minus fast		elseif param == 27 or param == 28 then			for n=1, fast_crs, 1 do ipc.control(66587,26701) end			ipc.control(66587,8031)					end				-- No need to send data to MCP here, just exiting		return -- << finishing function execution	end	-- ############################################################## --		-- AP IAS Rotary	if param > 30 and param < 40 then			-- IAS plus 		if param == 31 or param == 32 then					ipc.control(66587,26802)			ipc.control(66587,8031)		-- IAS plus fast		elseif param == 33 or param == 34 then			for n=1, fast_ias, 1 do ipc.control(66587,26802) end			ipc.control(66587,8031)							-- IAS minus		elseif param == 35 or param == 36 then					ipc.control(66587,26801)			ipc.control(66587,8031)		-- IAS minus fast		elseif param == 37 or param == 38 then			for n=1, fast_ias, 1 do ipc.control(66587,26801) end			ipc.control(66587,8031)				end				-- No need to send data to MCP here, just exiting		return -- << finishing function execution	end	-- ############################################################## --			-- AP VS Rotary	if param > 40 and param < 50 then			-- VS inc		if param == 41 or param == 42 then								buffer = ipc.readLvar("L:VSIASTarget")			Var = ipc.readLvar("L:AP_PitchWheel")			ipc.writeLvar("AP_PitchWheel", Var+10)			ipc.writeLvar("L:VSIASTarget", buffer+100)						ipc.control(65894)			ipc.control(66587,8031)						ipc.sleep(40)			buffer = ipc.readLvar("L:VSIASTarget")			com.write(dev, string.format("DSP_%04d", buffer), 8)		-- VS dec		elseif param == 43 or param == 44 then								buffer = ipc.readLvar("L:VSIASTarget")			Var = ipc.readLvar("L:AP_PitchWheel")			ipc.writeLvar("AP_PitchWheel", Var-10)			ipc.writeLvar("L:VSIASTarget", buffer-100)			ipc.control(65895)			ipc.control(66587,8031)			ipc.sleep(40)			buffer = ipc.readLvar("L:VSIASTarget")			com.write(dev, string.format("DSP_%04d", buffer), 8)				end				return -- << finishing function execution	end	-- ############################################################## --	-- EFIS BRG Rotaries	if param > 50 and param <= 60 then			-- BRG1 plus		if param == 51 or param == 52 then			-- Normal (BRG) mode			if dim == 0 then							efis_brg1 = efis_brg1 - 1				if efis_brg1 < 0 then efis_brg1 = 0 end 								ipc.writeLvar("L:LeftBearingCircleKnob", efis_brg1)				ipc.control(66587,220)				ipc.control(66587,8031)			-- Brightness mode				else				buffer = ipc.readLvar("LeftAdiDimKnob")				if buffer < 96 then buffer = buffer + 5 end				ipc.control(66587,2210)				ipc.sleep(5)				ipc.control(66587,8031)				ipc.writeLvar("LeftAdiDimKnob",buffer)							end				-- BRG1 minus		elseif param == 53 or param == 54 then			-- Normal (BRG) mode			if dim == 0 then							efis_brg1 = efis_brg1 + 1				if efis_brg1 > 3 then efis_brg1 = 3 end							ipc.writeLvar("L:LeftBearingCircleKnob", efis_brg1)				ipc.control(66587,220)				ipc.control(66587,8031)			-- Brightness mode				else				buffer = ipc.readLvar("LeftAdiDimKnob")				if buffer > 5 then buffer = buffer - 5 end				ipc.control(66587,2210)				ipc.sleep(5)				ipc.control(66587,8031)				ipc.writeLvar("LeftAdiDimKnob",buffer)							end						end						-- BRG2 plus		if param == 55 or param == 56 then			-- Normal (BRG) mode			if dim == 0 then							efis_brg2 = efis_brg2 - 1				if efis_brg2 < 0 then efis_brg2 = 0 end 								ipc.writeLvar("L:LeftBearingDiamondKnob", efis_brg2)				ipc.control(66587,223)				ipc.control(66587,8031)					-- Brightness mode				else				buffer = ipc.readLvar("LeftHsiDimKnob")				if buffer > 5 then buffer = buffer - 5 end				ipc.control(66587,21907)				ipc.sleep(5)				ipc.control(66587,8031)				ipc.writeLvar("LeftHsiDimKnob",buffer)							end					-- BRG2 minus		elseif param == 57 or param == 58 then			-- Normal (BRG) mode			if dim == 0 then							efis_brg2 = efis_brg2 + 1				if efis_brg2 > 3 then efis_brg2 = 3 end							ipc.writeLvar("L:LeftBearingDiamondKnob", efis_brg2)				ipc.control(66587,223)				ipc.control(66587,8031)			-- Brightness mode				else				buffer = ipc.readLvar("LeftHsiDimKnob")				if buffer < 96 then buffer = buffer + 5 end				ipc.sleep(5)				ipc.control(66587,8031)				ipc.writeLvar("LeftHsiDimKnob",buffer)  				end					end				-- Toggle to DIM rotary mod and back		if param == 59 then				dim = 1				ipc.display("Display brightness mode ON",1)		elseif param == 60 then				dim = 0				ipc.display("Display brightness mode OFF",1)		end		return -- << finishing function execution	end	-- ############################################################## --		-- EFIS DH Rotary	if param > 60 and param <= 70 then				-- DH plus		if param == 61 or param == 62 then			ipc.control(66587,22111)						if efis_dh_alt < 200 then 				efis_dh_alt = efis_dh_alt + 5			else				efis_dh_alt = efis_dh_alt + 10			end						if efis_dh_alt > 990 then efis_dh_alt = 990 end					-- DH plus fast		elseif param == 63 or param == 64 then			for n=1, fast_dh, 1 do 				ipc.control(66587,22111) 				if efis_dh_alt < 200 then 					efis_dh_alt = efis_dh_alt + 5				else					efis_dh_alt = efis_dh_alt + 10				end			end			if efis_dh_alt > 990 then efis_dh_alt = 990 end								-- DH minus		elseif param == 65 or param == 66 then			ipc.control(66587,22110)			if efis_dh_alt <= 200 then 				efis_dh_alt = efis_dh_alt - 5			else				efis_dh_alt = efis_dh_alt - 10			end						if efis_dh_alt < 5 then efis_dh_alt = 5 end					-- DH minus fast		elseif param == 67 or param == 68 then			for n=1, fast_dh, 1 do 				ipc.control(66587,22110) 				if efis_dh_alt <= 200 then 					efis_dh_alt = efis_dh_alt - 5				else					efis_dh_alt = efis_dh_alt - 10				end			end						if efis_dh_alt < 5 then efis_dh_alt = 5 end					end		-- Updating MCP display to show DH		com.write(dev, string.format("ALT%03d", efis_dh_alt), 8)			-- Revert to AP ALT display		if param == 69 or param == 70 then			buffer = ipc.readLvar("L:AltSelAlt")/100			if buffer < 0 then buffer = 0 end					com.write(dev, string.format("ALT%03d", buffer), 8)					end	end	endevent.param("JS41dials")


Artem Crum, EASA PPL
•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
LINDA Lua Integrated Non-complex Device Assigning
•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••

Share this post


Link to post
thats exact the problem... I haven't found a way till today to get these datas pulled out of the MD...But as you do not own it, you couldn't help me there... doesn't matter: next project is in line: 737 NGX :biggrin:I doubt that I fly the MD11 anymore after the NGX release...
Have bought MCP Combo exact for comming soon NGX.. and now just training to work with all this FSX/FSUIPC/LUA staff :-)I think there will be no problem to make MCP work with NGX and not too much time to do it.

Artem Crum, EASA PPL
•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
LINDA Lua Integrated Non-complex Device Assigning
•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••

Share this post


Link to post

One more update... MCP EFIS rotaries secondary mode to adjust Adi/Hsi brightness. Use 59/60 params to toggle mode of rotaries (Lua display will indicate current mode).Look into post above for updated version.


Artem Crum, EASA PPL
•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
LINDA Lua Integrated Non-complex Device Assigning
•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••

Share this post


Link to post
thats exact the problem... I haven't found a way till today to get these datas pulled out of the MD...
Look into my script. There is a code block to control decision height (DH) rotary. This is the same case where I cannot grab actual data from FSX but I'm using a variable inside the script to store the value and to show it on MCP display. I need to keep this variable in sync with JS41 indication by replicating the logic of it's changing inside simulator. It takes several more lines of code but then it works quite good and never goes out of sync.DH is a simple example. We know that at the simulation start it is set to zero. Then, when we begin to rotate the knob it increments by 5 feet while the value is less than 200 feet and then it increments by 10 feet. And we know the upper limit of DH which is 990 feet. Not a big problem to replicate this logic as you can see. Same approach should work in other similar situations.

Artem Crum, EASA PPL
•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
LINDA Lua Integrated Non-complex Device Assigning
•••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••

Share this post


Link to post

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
Sign in to follow this  
  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...