Jump to content
Sign in to follow this  
Rabso

Understading the optional parameter of ipc.control

Recommended Posts

Hi all,

 

I am new to LINDA and LUA. and I have been reading all about LUA and take some tutorial (in general I have little background about programming as it's my hobby).

However, I am stuck at one point seems can't get it! It's about the parameter of ipc.control

 

let's talk about PMDG 777, I have this example (from LINDA 777 Module):

function PMDG_Spoilers_arm ()
    if ipc.readLvar("switch_498_a") < 100 then
    ipc.control(74614, 536870912)
    end
    DspShow ("Splr", "arm")
end

From above, the control number is 74614 and by omitting 69632 you will get 4982 which is referring to EVT_CONTROL_STAND_SPEED_BRAKE_LEVER_ARM

 

The question is; what is the meaning of 536870912? I tried a lot to figure out it but no result!

 

in PMDG_777X_SDK.h you will see some Controls with its position, but usually they are 0, 1, 2 .... (max I saw is 150)

 

in LINDA 777 module I found sometimes 128, 265 or the above one.

could some one explain more for me

 

thanks

 


Jehad Hamdan

Share this post


Link to post
Share on other sites

Hi all,

 

I am new to LINDA and LUA. and I have been reading all about LUA and take some tutorial (in general I have little background about programming as it's my hobby).

However, I am stuck at one point seems can't get it! It's about the parameter of ipc.control

 

let's talk about PMDG 777, I have this example (from LINDA 777 Module):

function PMDG_Spoilers_arm ()
    if ipc.readLvar("switch_498_a") < 100 then
    ipc.control(74614, 536870912)
    end
    DspShow ("Splr", "arm")
end

From above, the control number is 74614 and by omitting 69632 you will get 4982 which is referring to EVT_CONTROL_STAND_SPEED_BRAKE_LEVER_ARM

 

The question is; what is the meaning of 536870912? I tried a lot to figure out it but no result!

 

in PMDG_777X_SDK.h you will see some Controls with its position, but usually they are 0, 1, 2 .... (max I saw is 150)

 

in LINDA 777 module I found sometimes 128, 265 or the above one.

could some one explain more for me

 

thanks

 

Welcome to LINDA.

 

To help answer your questions I suggest you take a look at the various FSUIPC Documents in the FSX/modules folder.  The key ones for you are FSUIPC4 Offsets Status, FSUIPC Lua Library and List of FSX and P3D controls. These contain a wealth of information for programmers.

 

The ipc.control command sends a value/command to a FSX/P3D control address with a parameter. These commands set a specific FSX parameter (e.g.. COM1 freq) to a specific value. While many of the value are in decimal some are in hexadecimal and you will find a calculator app that converts base 10 to base 16 useful.  The LINDA Tracer FSX Controls panel is useful in helping find what these commands mean. For example, FSX control 65715 sets the Transponder .

 

The 777 sample you quote uses control 74614 which is outside the FSX defined values and most probably relates to a 777 specific control that is published in the PMDG 777 SDK (which I don't have). The 536890912 in decimal equates to x20000000 in hexadecimal or 0010 0000 0000 0000 0000 0000 0000 0000 in binary. I read this as the bit that arms the spoiler in the 777 model.

 

I hope this helps answer your question. If you study the documents and the 777 module, it will help you understand the work Guenseli puts into each aircraft module. 


Andrew Gransden

Scotland, UK

LINDA Support/Developer - VATSIM and BAVirtual - Airbus Flyer

i7 1TB SSD GTX980 - FSX/P3D - Aerosoft Airbus A318/A319/A320/A321 - FS2Crew

Share this post


Link to post
Share on other sites

Thanks Scotflieger for your reply,

 

well I have already read all the above documents but still did not get why 536890912 has been used to control instead of direct position value as per following giving information:

unsigned char	FCTL_Speedbrake_Lever;				// Position 0...100  0: DOWN,  25: ARMED, 26...100: DEPLOYED

So I went through the whole PMDG 777 SDK again and found the reason (your reply gave me the hint); the decimal 536890912 is equates to x20000000 in hexadecimal which is a pre-defined mouse flag for mouse left click simulation (it's nice idea to control rotary knobs or to trigger a two position switch without checking its previous position).

 

But still something I can't understand:

As per above code, FCTL_Speedbrake_Lever has many positions, 25 is for Armed position. Yes Guenseli used the x20000000 (mouse click simulation) to arm the lever but why when use the value 25 will not do it?

 

I used LINDA Tracer to get what is going on, I armed the Speedbrake lever by mouse and found that the switch_498_a (speedbrake lever) = 100 and full up is = 400.

 

So I did this code:

function SPEEDBRAKE_ARM ()
    if ipc.readLvar("switch_498_a") < 100 then
         ipc.control(PMDGBaseVariable +498, 100)
    end
end

but did not work :sad:

 

I let the LINDA tracer feed the value (once 255 and other 100) and it works with the following result:

WRITE0[8504]  7321,  60 bytes: 53 4C 3A 73 77 69 74 63 68 5F 34 39 38 5F 61 3D  SL:switch_498_a=
32 35 35 00 00 00 00 00 00 00 00 00 00 00 00 00  255.............
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
00 00 00 00 00 00 00 00 00 00 00 00              ............
WRITE0[8504]  735F,   1 bytes: 01                                               .
WRITElua 7321,  60 bytes: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
00 00 00 00 00 00 00 00 00 00 00 00              ............
WRITElua 735F,   1 bytes: 00                                               .
LUA.0:  [L] LVar: switch_498_a = 255
WRITE0[8504]  7321,  60 bytes: 53 4C 3A 73 77 69 74 63 68 5F 34 39 38 5F 61 3D  SL:switch_498_a=
31 30 30 00 00 00 00 00 00 00 00 00 00 00 00 00  100.............
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
00 00 00 00 00 00 00 00 00 00 00 00              ............
WRITE0[8504]  735F,   1 bytes: 01                                               .
WRITElua 7321,  60 bytes: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
00 00 00 00 00 00 00 00 00 00 00 00              ............
WRITElua 735F,   1 bytes: 00                                               .
LUA.0:  [L] LVar: switch_498_a = 100

I know it's some where in above bytes but don't know to put it in my code.

 

sorry for this big question


Jehad Hamdan

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  

  • 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...