Jump to content
The simFlight Network Forums

Light switch setup HELP


Recommended Posts

Hi,

I am trying to setup my light switches as toggle switches connected to LPT Switch, interfaced in PPJoy and programmed directly in FSUIPC. I have read in other posts on this forum that Offset 0D0C can be used with Setbit and Clrbit to select individual lights, allowing synchronisation with Initial FS startup settings.

Programming directly with FSUIPC however appears to use Controls such as 6**** to select an offset. In the lists I cannot see one of these 6**** codes which correspond to Offset 0D0C.

Can someone please give an example of how this can be done.

Thank You

:?: :?: :?: :?: :?: :?: :?:

Link to comment
Share on other sites

  • 2 weeks later...

Programming directly with FSUIPC however appears to use Controls such as 6**** to select an offset. In the lists I cannot see one of these 6**** codes which correspond to Offset 0D0C.

If you are programming directly to the FSUIPC interface, which not simply change the bits in 0D0C directly -- i.e. read 0D0C, change a bit, write it back?

If you really need to use a control, then you should refer to the list of added FSUIPC control numbers which is provided in the Advanced User's guide. Only the FS controls are numbers 65536 and above.

Regards

Pete

Link to comment
Share on other sites

Can Offset 0D0C be written to directly using FSUIPC.ini ?

Can you give an example?

Why do you want to edit the INI file when you can use the Options in FS?

Go to the Keys or Buttons tab in FSUIPC options, assign whatever it is you want to the FSUIPC control "Offset Word ToggleBits" (for a toggle action -- else use "... SetBits" to switch on and "... ClrBits" to switch off). Enter x0D0C for the Offset, and the value for the bit you want to change as the parameter -- 1 for bit 0, 2 for bit 1etc (2 to the power n for bit n). That's it.

Pete

  • Upvote 1
Link to comment
Share on other sites

  • 2 months later...

I Have been using setbit/clrbit to try and get lights working with spdt rocker switches. Below is the code from FSUIPC4.ini that I have been trying with these. The Bcn, Nav, strobe and landing lights work fine until the taxi light switch is

switched which causes the others to turn off. I dont understand why? Any help would be appreciated. THANK YOU

15=P1,10,Cx06000D0C,x0002 (Beacon)

16=P1,11,Cx06000D0C,x0001 (Nav)

17=P1,12,C66052,0 (Strobe)

18=P1,13,Cx06000D0C,x0008 (Taxi)

19=P1,14,Cx06000D0C,x0004 (Landing)

Link to comment
Share on other sites

I Have been using setbit/clrbit to try and get lights working with spdt rocker switches. Below is the code from FSUIPC4.ini that I have been trying with these. The Bcn, Nav, strobe and landing lights work fine until the taxi light switch is switched which causes the others to turn off. I dont understand why? Any help would be appreciated.

You only show the INI lines for switching on -- show me the whole set please. Which aircraft are you testing it with? Maybe it is a function of the panel you are using? Certainly FSUIPC4 internally interprets each bit separately.

Incidentally, why are you using bits in 0D0C for most then an FS control for Strobe? There are FS controls for Landing lights on/off as well, but you've used the 0D0C bit for that. x0010 is the parameter for Strobe.

Do you know you can use FSUIPC logging to help find out what is happening? On the logging tab, enable the Event log, which will show any resulting FS controls, and for the lights try using the right-hand side of that tab: Offset 0D0C, type U16, check "Normal log" below.

If you run FSX in Windowed mode you can see the logging in real time by checking the Console Log option.

Regards

Pete

Link to comment
Share on other sites

HI Pete,

sorry i didnt see the swiching off lines further down.

I am using the Stock FSX 737-800.

Am I using the correct parameters?

Could you please list all the parameters for all lights using this offset? THANK YOU

15=P1,10,Cx06000D0C,x0002 (Beacon)

16=P1,11,Cx06000D0C,x0001 (Nav)

17=P1,12,C66052,0 (Strobe)

18=P1,13,Cx06000D0C,x0008 (Taxi)

19=P1,14,Cx06000D0C,x0004 (Landing

34=U1,10,Cx0A000D0C,x0002

35=U1,11,Cx0A000D0C,x0001

36=U1,12,C66053,0

37=U1,13,Cx0A000D0C,x0008

38=U1,14,Cx0A000D0C,x0004

Link to comment
Share on other sites

I am using the Stock FSX 737-800. Am I using the correct parameters?

Yes, that's fine -- except for the inconsistency of using FS controls for strobe.

I think you must have that Taxi light button assigned elsewhere as well, possibly in FSX itself? Probably to the all-lights toggle control. Assigning button and axes in FSUIPC doesn't stop FS assignments from also operating. I can't stop that.

Could you please list all the parameters for all lights using this offset?

Are you not referring to the documentation? If not where did you get those you are using?

Here's the relevant part of the Offsets table:

0D0C  2	Lights, a switch for each one (bits from lo to hi):
	0	Navigation
	1	Beacon
	2	Landing
	3	Taxi
	4	Strobes
	5	Instruments
	6	Recognition
	7	Wing
	8	Logo
	9	Cabin

In hexadecimal notation bits are in groups of 4, with single bits shown as 1 2 4 and 8 respectively, from low bit number to high. So, strobe being bit 4 is x0010 (the first bit in the second group of 4).

Easier, use decimal when entering the parameter in the FSUIPC Button Assignments dialogue (FSUIPC will convert to hex). For decimal bit equivalents it is simply 2 to the power of the bit number. So:

bit 4 = 2 x 2 x 2 x 2 = 16.

Regards

Pete

Link to comment
Share on other sites

  • 7 years later...

Hi everyone.
This topic is old, but after an extended search, I can't find a perfect solution to control the light switches individualy. So, after a few code testing, I got it!
First you need to get ALL the switches status, split the retrieved data into vars, change whatever you need, and finaly write them back.

Example:

        -- Read Light switch status
        navi, bcon, land, txii, strb, inst, recg, wing, logo, cabn = ipc.readStruct(0x0D0C, "10UB")
        -- Change Light switch On/Off
        navi = 1
        logo = 1
        -- Write Light switch status
        ipc.writeStruct(0x0D0C, "10UB", navi, bcon, land, txii, strb, inst, recg, wing, logo, cabn)

I hope this can help you.

Link to comment
Share on other sites

4 hours ago, Pimas said:

First you need to get ALL the switches status, split the retrieved data into vars, change whatever you need, and finaly write them back.

Actually, I'm really not sure how you propose doing this (i.e. from another program, via assignments, or what), but whichever way I think it is a lot easier than you propose.

All the switch states are indicated and controlled by the values in offset 0D0C. There are values for the10 different lights. Each has its own controlling "bit", bits 0-9. For assignments to switches you can simply asign to "offset word togglebits", "offset word setbits" or "offset word clrbits" (depending on whether you want to toggle, switch on, or switch off the light) with the offset set to xD0C and the parameter set to 1, 2, 4, 8, 16 ... 512, according to which you want to change.

For bit numbers to decimal values, and more about computer numbers, see the FAQ thread about bits and numbers.

Similar considerations apply to Lua pluguns, and of course FSUIPC applications.

Pete

 

Link to comment
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
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.