Sign in to follow this  
xtended

Landing lights switch

Recommended Posts

Does anybody know how to assign landing/taxi lights switch to joystick button or keyboard shortcut?

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

Not tested. but you should be able to assign Ctrl-L to a joystick button. You'll need FSUIPC registered version for this.

Share this post


Link to post
Share on other sites

Not tested. but you should be able to assign Ctrl-L to a joystick button. You'll need FSUIPC registered version for this.

The main problem is that switch has 3 positions: up (landing)/middle(off)/down(taxi). I'd like to switch this positions with two buttons, i.e ctrl-PgUp/ctrl-PgDn.

Share this post


Link to post
Share on other sites

Your question got me thinking about how to do this.  I don't have the Citation but I have the Carenado Phenom 100.  It has a three position landing / taxi light switch but slightly different (DN - OFF, CTR - Taxi Lt, UP - Ldg Lt).  So I wrote a short LUA file with two scripts:  one to move the switch up one position and one to move the switch down one position.  I set the LVar so that the VC switch moves correctly and manipulate the landing and taxi lights through the 0D0C offset.  The LUA file goes in the Modules folder with FSUIPC (need the paid version) and I assign the LUA file as a FS command in FSUIPC, to a two position rocker switch on my throttle quadrant with the parameter "1" for UP and "2" for DN.  It could be assigned to a keypress just as easily.  I'm not a P3D guy so I don't know if it will work there but here is my script.  If you need help finding the Citation LVar for the switch or modifying the script for the Citation, let me know.
Bruce
--------------------------------------------
-- Phenom Landing_Taxi Lights Scripts
--------------------------------------------

--------------------------------------------
-- Parameters by Number
--------------------------------------------
-- 1 Move Ldg_Taxi Lt SW UP one position
-- 2 Move Ldg_Taxi Lt SW DN one position

--------------------------------------------
---- Variables
--------------------------------------------
SW_Pos = "L:ASD_SWITCH_LANDING_TAXI_EMB500"

--------------------------------------------
---- Scripts
--------------------------------------------

-- Move Ldg_Taxi Lt SW UP one position
if ipcPARAM == 1 then
SWPos = ipc.readLvar(SW_Pos)
if SWPos == 0 then
ipc.writeLvar(SW_Pos, 1)
ipc.setbitsUW(0x0D0C, 8)
end
if SWPos == 1 then
ipc.writeLvar(SW_Pos, 2)
ipc.setbitsUW(0x0D0C, 4)
ipc.clearbitsUW(0x0D0C, 8)
end
end

-- Move Ldg_Taxi Lt SW DN one position
if ipcPARAM == 2 then
SWPos = ipc.readLvar(SW_Pos)
if SWPos == 2 then
ipc.writeLvar(SW_Pos, 1)
ipc.setbitsUW(0x0D0C, 8)
ipc.clearbitsUW(0x0D0C, 4)
end
if SWPos == 1 then
ipc.writeLvar(SW_Pos, 0)
ipc.clearbitsUW(0x0D0C, 8)
end
end

Share this post


Link to post
Share on other sites

Bruce, a lot of thanks for your respond. I owe Carenado E50P too so I've tested your script and it works completly as I wished. Now can you tell me how to make it work in CJ2?

Share this post


Link to post
Share on other sites

It seems I found the solution myself using my genius mind :)

This is lua script I got:

 

--------------------------------------------
-- Carenado CJ2+ Landing_Taxi Lights Scripts
--------------------------------------------
 
--------------------------------------------
-- Parameters by Number
--------------------------------------------
-- 1 Move Ldg_Taxi Lt SW UP one position
-- 2 Move Ldg_Taxi Lt SW DN one position
 
--------------------------------------------
---- Variables
--------------------------------------------
SW_Pos = "L:ASD_SWITCH_CJ2525A_LAND_TAXI_RECOG"
 
--------------------------------------------
---- Scripts
--------------------------------------------
 
-- Move Ldg_Taxi Lt SW UP one position
if ipcPARAM == 1 then
SWPos = ipc.readLvar(SW_Pos)
if SWPos == 0 then
ipc.writeLvar(SW_Pos, 1)
ipc.clearbitsUW(0x0D0C, 8)
end
if SWPos == 1 then
ipc.writeLvar(SW_Pos, 2)
ipc.setbitsUW(0x0D0C, 4)
end
end
 
-- Move Ldg_Taxi Lt SW DN one position
if ipcPARAM == 2 then
SWPos = ipc.readLvar(SW_Pos)
if SWPos == 2 then
ipc.writeLvar(SW_Pos, 1)
ipc.clearbitsUW(0x0D0C, 4)
end
if SWPos == 1 then
ipc.writeLvar(SW_Pos, 0)
ipc.setbitsUW(0x0D0C, 8)
end
end

Share this post


Link to post
Share on other sites

Great! Glad I could help.

For any others that use this, beware that you need FSUIPC 4949e (I think that was the fix version but not positive) or later (latest is best). Before the fix, using this script would clear all other light bits when setting or clearing the targeted bit.
Bruce

 

EDITED:  I forgot to mention an "improvement" on the E50P scripts is to use the clearbitsUW before the setbitsUW in the two instances where they are together in order to turn off a light before turning the other one on.  Otherwise you get a momentary flash that is both light masks being on at the same time.

Share this post


Link to post
Share on other sites

I mentioned now that my switches turn ALL lights off somehow. I cannot fix it yet. My genious mind :) stucks.

Share this post


Link to post
Share on other sites

Did you update FSUIPC to 4949h? If you have earlier than 4949c it will turn off all other lights.

Share this post


Link to post
Share on other sites

Yes! Update to 4.949k solved simultaneous lights toggling. And I rewrite lua code using togglebits command so the final version looks like this:

 

SW_Pos = "L:ASD_SWITCH_CJ2525A_LAND_TAXI_RECOG"
-- Move Ldg_Taxi Lt SW UP one position
if ipcPARAM == 1 then
SWPos = ipc.readLvar(SW_Pos)
if SWPos == -1 then
ipc.writeLvar(SW_Pos, 0)
ipc.togglebitsUW(0x0D0C, 8)
end
if SWPos == 0 then
ipc.writeLvar(SW_Pos, 1)
ipc.togglebitsUW(0x0D0C, 4)
end
end
-- Move Ldg_Taxi Lt SW DN one position
if ipcPARAM == 2 then
SWPos = ipc.readLvar(SW_Pos)
if SWPos == 1 then
ipc.writeLvar(SW_Pos, 0)
ipc.togglebitsUW(0x0D0C, 4)
end
if SWPos == 0 then
ipc.writeLvar(SW_Pos, -1)
ipc.togglebitsUW(0x0D0C, 8)
end
end
 
 
 
P.S. God damn it! I'm becoming programist via my simmer way!

Share this post


Link to post
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
Sign in to follow this