Jump to content
The simFlight Network Forums

roarkr

Members
  • Posts

    52
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by roarkr

  1. I believe "Is MSFS using updated data but not applying this to the sceneries?" could be the cause of this problem.

    If that is the case then MakeRwys can't be used to get the correct airport info by reading the BGLs.

     

    Anyway, thanks for your reply.

     

    Data from Little NavMap also give different Heading values for airport runways than those found using MakeRwys. They are the same as found with SimConnect.

    Conclusion: MakeRwws data is not correct. and time to skip it.

    image.thumb.png.3808cd5b22bf80fda3094a57b601b150.png

     

  2. I do have issues when reading the correct heading of runways with MakeRwys 5.13.

     

    Example: KSEA runway 16L,16C and 16R

     

    Headings of runways when reading from Runways.csv( the other Runway formats have the same issue) 

    KSEA 161 47.46379 -122.308 433 161 11890 110.3
    KSEA 162 47.46383 -122.318 415 161 8493 110.75
    KSEA 163 47.46381 -122.311 430 161 9418 111.7
                   

    MagVar for KSEA is 16, so it is 177 compared to 180 via SimConnect.

    When I read the heading via MSFS's SimConnect FacilityRequest i get 180

    image.thumb.png.75c2cd20ff97ee2fbe03bb9a1cfe23f9.png
     

    I am not saying that MakeRwys gives faulty data, but why do I get different results.

     

    When I use the data from MakeRwys in my app, my airplane is not alighed correctly with the runway heading, but with a offset of 3 degrees.

    When I use the data from SimConnect in my app, the airplane is correcly align with the runway heading in MSFS.

     

    It is not only KSEA, I just used it as an example.

     

    This issue was not there before. Could it be something in the latest MakeRwys version?

  3. The free MSJOY from rksoftware can bind any PMDG Event

    MSFSJoy is the ultimate joystick button utility for the PMDG 737 for MSFS airplane in MSFS.

    Bind any PMDG 737 for MSFS airplane switch, knob or button to a joystick button. Now includes "Test Events" for more easy and correct bindings.

    If you want, you can bind the complete airplanes setup from Cold and Dark to Takeoff to only one joystick button.

    • Like 1
  4. I can bind the new Custom Events to both Buttons and Keypresses with FSUIPC.

    In my own WASM I can send HVars e.g.

    command = "(>H:A32NX_RMP_L_VHF2_BUTTON_PRESSED)";
    execute_calculator_code(command.c_str(), nullptr, nullptr, nullptr);

    and it will trigger the VHF2 Button 

     

    But, when I try to use the same code for one of the Custom Events in the list above,

    e.g.  A32NX.FCU_AP_1_PUSH

     

    command = "(>H:A32NX.FCU_AP_1_PUSH)";
    execute_calculator_code(command.c_str(), nullptr, nullptr, nullptr);

    it will not trigger the FCU button

     

    I must miss something. Are these A320NX flybywire Custom Events not H Vars?

  5. After several months away from MSFS and FSUIPC and just started up again.

    I have FSUIPC v7.2.8 installed with the WASM module active in MSFS's Community folder and fly the A32NX(flybywire v6.3)

    I can't get the binding of H:Vars(Events) to work.

     

    I have a fbw.evt file in the FSUIPC7 folder

     

    [Events]
    0 = A32NX.FCU_AP_1_PUSH
    1 = A32NX.FCU_AP_2_PUSH
    2 = A32NX.FCU_AP_DISCONNECT_PUSH
    3 = A32NX.FCU_ATHR_PUSH
    4 = A32NX.FCU_ATHR_DISCONNECT_PUSH
    5 = A32NX.FCU_SPD_INC
    6 = A32NX.FCU_SPD_DEC
    7 = A32NX.FCU_SPD_SET
    8 = A32NX.FCU_SPD_PUSH
    9 = A32NX.FCU_SPD_PULL
    10 = A32NX.FCU_SPD_MACH_TOGGLE_PUSH
    11 = A32NX.FCU_HDG_INC
    12 = A32NX.FCU_HDG_DEC
    13 = A32NX.FCU_HDG_SET
    14 = A32NX.FCU_HDG_PUSH
    15 = A32NX.FCU_HDG_PULL
    16 = A32NX.FCU_TRK_FPA_TOGGLE_PUSH
    17 = A32NX_FCU_ALT_INC
    18 = A32NX.FCU_ALT_DEC
    19 = A32NX.FCU_ALT_SET
    20 = A32NX.FCU_ALT_PUSH
    21 = A32NX.FCU_ALT_PULL
    22 = A32NX.FCU_ALT_INCREMENT_TOGGLE
    23 = A32NX.FCU_ALT_INCREMENT_SET
    24 = A32NX.FCU_VS_INC
    25 = A32NX.FCU_VS_DEC
    26 = A32NX.FCU_VS_SET
    27 = A32NX.FCU_VS_PUSH
    28 = A32NX.FCU_VS_PULL
    29 = A32NX.FCU_LOC_PUSH
    30 = A32NX.FCU_APPR_PUSH
    31 = A32NX.FCU_EXPED_PUSH

     

    I can't get any of these Events to trigger any FCU activity when I bind them to either Buttons or Keypresses

     

    See attached image.

     

    Anyone knows what I am doing wrong here?

     


     

     

    flybywire-aircraft-a320-neo

    Screenshot 2021-09-05 192838.png

  6. I am maybe dumb today, but logging events in FSUIPC with the A320 running gives me continues logging of the same events over and over. It is impossible to trace anything. Something looks weird.  Is there a filter option  to set?

    You said: "swapping the COM1 in the UI". What do you mean?

  7. When binding a COM1 Radio Swap to a key it works fine with the default airplanes in MSFS , but not when using the A320 and B787 airplanes.

    It is the same problem with the INC and DEC controls.

     

    It seems to me that these airplanes(A320 and B787) use some other logic than the standard SimConnect Events / FSUIPC Controls.

     

    Is there other Events / Controls to be used for these airplanes?

     

     

  8. Hi,

    I am using P3Dv4 with FSUIPC 5 and have a PMDG B737NGX home cockpit based on Opencockpits hardware modules and my OC4BAv4 home cockpit program.

    This is my controller that should all be connected all the time.

    1. Saitek x52

    2. Saitek Rudder

    3. Opencockpits B737 Yoke

    4. CFY Throttle

    When I use my home cockpit and fly the B737NGX, I use the Opencockpits Yoke, Saitek Rudder and CFY Throttle.

    When I just fly in P3Dv4 using my 4K monitor (not my home cockpit setup) I only want to use my Saitek X52 for both PMDG B737NGX and other airplanes.

    Now my question:

     

    How do I set up the controllers to have a working controller scenario that let my use them as described above?

     

     

     

  9. Looking in the "FSUIPC4 Status of IPC Offsets for FSX" list you state that the offset 088C for TQ Lever position is a
    "Ok-SimC works okay using SimVars".

    Does this means that it is a variable that is defined and can be used directly with SimConnect without FSUIPC?

    If so, can you tell med the name of the SimConnect variable you are using to get the value to the FSUIPC offset 088C?

    I can't find it in the SimConnect documentation, that's the reason for my question. 

  10. Hi,

     

    I have developed an interface app for Opencockpits hardware to be used with Aerosoft's new Airbuses.

     

    I have partly used Lua scripting and FSUIPC offsets and need an offset range like 66C0 - 66FF for this app

    so it doesn't interfere with other usage.

     

    I am using the free offset 66C0 - 66FF now, but some users do have some problems as they also run other apps that uses some of these free offsets.

     

     

    I read in the doc that you could provide developers with that if they contacted you.

     

    Can you provide that?

     

    Roar

  11. hi,

    just wanted to inform you that a beta version of my OCP4NGX app for interfacing OpenCockpits MCP has been sent to OpenCocpits for test and verification.

    You can read and write everything that is in the SDK. ( today only MCP is implemented)

    This is in agreement and permission of PMDG.

    More modules will be incorprated later together with the future 777 and 747 if those SDK become available.

    It is freeware.

    Release will be soon.

  12. Hi Pete,

    I'm almost ready with my new OpenCockpits IOCP Client for NGX based on the new NGX SDK, but need to make it a little more efficient.

    You mentioned in this thread some time ago that using a loop for the CallBack MyDispatchProc was not recommended, but instead:

    "

    The method I recommend is to use Simconnect_Open with your message-only (HWND_MESSAGE class) Window handle as the 3rd parameter and a user message number defined by you as the 4th parameter. Then you call "CallDispatch" when you receive that message. This is bay far the most efficient method."

    Could you specify this in more detail as I can't figure out the coding for that.

    rgs

    Roar

  13. Hi Pete,

    I have started to modify an IOCP Client C++ module I got from lekseecon.com in order to connect my OpenCockpits modules to the NGX plane.

    After some time struggling with this approach, I now see this will a huge development task and at the same time I'm more and more believing that a solution based on FSUIPC4 offsets and LUA scripting will be much

    easer to implement, but then I need the NGX SDK variables to be connected to FSUIPC4 offsets.

    In order to decide which way to go I wonder if you now have heard from PMDG regarding the EULA concern you had and if you still are planning to make the NGX variables available as FSUIPC4

    offsets.

    rgs,

    Roar

  14. Ok, I wrapped it up as a zipped vs2010 solution in https://docs.google....UM1lMNldpRkxSZw

    It's the wrapper dll and a very basic C# example that simply dumps all the variables in a grid and toggles the taxi light switch once in a while.

    Have fun!

    Hi

    I have downloaded your PMDGWrapper to see if I can use some of your coding in a IOCP Client C++ I am coding to interface my Opencockpits hardware modules.

    As I am not a professional C++ programmer I don't know what the wrapper really is and what it actually does. Could you explain a little for us "hobby" programmers?

    What I really need is a call from your wrapper dll ( if I understand it right) to a function in my C++ whenever there is a change between old and new values of the PMDG data. This call should have both the varname and the value.

    I have a hard time to find out what is the ins and what is the outs in this dll of if it can be used. Maybe I am totally misunderstanding it.

    Do you have any idea of how this could be done?

    rgs

  15. Actually I did understand WHAT you were doing, just not WHY. It just seems rather complicated. Or maybe it's just me?

    Yes, that's what I find so complicated. How is this going to work for a user who wants to populate all his hardware displays with indicators and values from the NGX data?

    If you wanted to do it that way why not simply use a mechanism like my "event" system. Let the Lua program which is doing the "requiring" call an event function in your C DLL which provides it with the name of the function to be called when a specified value changes. You'd need to build a list of those. Then, at the end of that Lua program, instead of exiting back to FSUIPC, it would need call an "execute" function in your DLL which then processes the dispatches, in a loop as now.

    This way you don't need to execute a separate Lua plug-in, it is nice and tidy all in one Lua and one DLL, both running in the one thread. The only trouble is that because the thread never exits back to FSUIPC, that same Lua can't use the FSUIPC event system. (But that applies to your current method too).

    The other way is the way I proposed before, which is having a separate thread in the DLL which is maintaining the data copy with functions which supply values on request. The problem with that is how to detect that the Lua plug-in has terminated so that the separate thread can be terminated tidily.

    I'm starting to wonder if it wouldn't be much tidier to forget the Lua way of doing it altogether, and just have an EXE program which gets the NGX data and posts them to assigned FSUIPC offsets, which can then be read by any Lua plug-ins, and other programs, even on a WideFS client. I would actually consider building this into FSUIPC (it is easy as it already has a working SimConnect interface), but I don't like some sections of PMDG's EULA. I'd need PMDG's blessing first. Maybe I should write to Mr. Randazzo.

    Regards

    Pete

    Hi Pete,

    I don't know what your plans are about doing something for the PMDG NGX in your FSUIPC4 now that the SDK is available.

    As Nico don't wanna do a "lekseecon" for the PMDG NGX I have started to make my own " NGXCon" IOCP client to be used for the OpencCockpits SIOC environement.

    But, as I am not a "prof" programmer this can take some time before I'm ready.

    So to my question:

    Are you going to do what you said:

    "" I'm starting to wonder if it wouldn't be much tidier to forget the Lua way of doing it altogether, and just have an EXE program which gets the NGX data and posts them to assigned FSUIPC offsets, which can then be read by any Lua plug-ins, and other programs, even on a WideFS client. I would actually consider building this into FSUIPC (it is easy as it already has a working SimConnect interface),""

    if so what and what is your timeframe? Then I could do the LUA scripting to get what I want and that is maybe the way to go instead of an dedicated IOCP client based on C++ ( which I need to learn better).

    rgs

  16. Thanks Roar. Do the rest of the OC devices work in the same way, listening to certain offsets?

    Hi,

    The way I have implemented this, yes. The OP sioc software is a event driven program. It does only execute code when a variable change value. Either a variable connected to a specific IOCARD input or a variable linked to a offset.

    rgs

  17. Ok, so if I got it right you mean the solution you mentioned of storing the data in predefined FSUIPC offsets right at the dll / C++, so that Lua pluggins or anyone can listen via events or read them or whatever.

    I guess I need to take a look at the FSUIPC_SDK docs.

    Anyway, I'll leave that to you guys then.

    Hi,

    Here is an example of how to use events to detect offsets changes, both on bit level and whole words. Keep in mind that I'm not a programmer, so it maybe can be done better.

    rgs

    Roar

    -- PMDG 737 NGX LUA code for Opencockpits MCP to be used in FSUIPC

    -- File: NGXMCP_202

    -- December 2011

    -- Roar Kristensen

    --***************************************************************************************

    -- ** System initial values set **

    --***************************************************************************************

    -- ** MCP initial values **

    hdg_mode = 1

    atarm = -1

    crsl = 500

    crsr = 500

    spd = -1

    hdg = -1

    alt = -1

    vsw = -1

    MCP_N1 = -1

    MCP_Speed = -1

    MCP_LvlChg = -1

    MCP_VNav = -1

    MCP_LNav = -1

    MCP_HdgSel = -1

    MCP_AltHold = -1

    MCP_CMDA = -1

    MCP_CMDB = -1

    MCP_CWSA = -1

    MCP_CWSB = -1

    MCP_VORLock = -1

    MCP_App = -1

    MCP_VS = -1

    ipc.writeUB("66E8", 0)

    ipc.writeUB("66E9", 0)

    ipc.writeUB("66EA", 0)

    ipc.writeUB("66EB", 0)

    ipc.writeUB("66EC", 0)

    ipc.writeUB("66ED", 0)

    if ipc.readUB("66E4") == 1 and ipc.readLvar('ngx_switch_378_a') == 100 then

    ipc.control(70010, 536870912)

    ipc.control(70010, 131072)

    else

    if ipc.readUB("66E4") == 0 and ipc.readLvar('ngx_switch_378_a') == 0 then

    ipc.control(70010, 536870912)

    ipc.control(70010, 131072)

    end

    end

    if ipc.readUB("66E5") == 1 and ipc.readLvar('ngx_switch_380_a') == 100 then

    ipc.control(70012, 536870912)

    ipc.control(70012, 131072)

    else

    if ipc.readUB("66E5") == 0 and ipc.readLvar('ngx_switch_380_a') == 0 then

    ipc.control(70012, 536870912)

    ipc.control(70012, 131072)

    end

    end

    if ipc.readUB("66E6") == 0 and ipc.readLvar('ngx_switch_406_a') == 100 then

    ipc.control(70038, 536870912)

    ipc.control(70038, 131072)

    else

    if ipc.readUB("66E6") == 1 and ipc.readLvar('ngx_switch_406_a') == 0 then

    ipc.control(70038, 536870912)

    ipc.control(70038, 131072)

    end

    end

    if ipc.readUB("66E7") == 1 and ipc.readLvar('ngx_switch_407_a') == 100 then

    ipc.control(70039, 536870912)

    ipc.control(70039, 131072)

    else

    if ipc.readUB("66E7") == 0 and ipc.readLvar('ngx_switch_407_a') == 0 then

    ipc.control(70039, 536870912)

    ipc.control(70039, 131072)

    end

    end

    if crsl ~= ipc.readLvar("L:ngx_CRSwindowL") then

    crsl = ipc.readLvar("L:ngx_CRSwindowL")

    ipc.writeUW("66C0", crsl)

    end

    if spd ~= ipc.readLvar("L:ngx_SPDwindow") then

    spd = ipc.readLvar("L:ngx_SPDwindow")

    ipc.writeUW("66C2", spd)

    end

    if hdg ~= ipc.readLvar("L:ngx_HDGwindow") then

    hdg = ipc.readLvar("L:ngx_HDGwindow")

    ipc.writeUW("66C4", hdg)

    end

    if alt ~= ipc.readLvar("L:ngx_ALTwindow") then

    alt = ipc.readLvar("L:ngx_ALTwindow")

    ipc.writeUW("66C6", ipc.readLvar("L:ngx_ALTwindow") / 100)

    end

    --if ipc.readLvar("L:ngx_MCP_VS") == 1 then

    if vsw ~= ipc.readLvar("L:ngx_VSwindow") then

    vsw = -20000

    ipc.writeSW("66D0", -20000)

    end

    if crsr ~= ipc.readLvar("L:ngx_CRSwindowR") then

    crsr = ipc.readLvar("L:ngx_CRSwindowR")

    ipc.writeUW("66CA", crsr)

    end

    --***************************************************************************************

    -- ** Procedures for reading MCP windows and sending to SIOC via FSUIPC offsets****

    --***************************************************************************************

    function CRSL_show ()

    crsl = ipc.readLvar("L:ngx_CRSwindowL")

    ipc.writeUW("66C0", crsl)

    end

    function SPD_show ()

    spd = ipc.readLvar("L:ngx_SPDwindow")

    if spd > 1 then

    ipc.writeUW("66C2", spd)

    else

    spd = spd *100

    ipc.writeUW("66C2", spd)

    end

    end

    function HDG_show ()

    hdg = ipc.readLvar("L:ngx_HDGwindow")

    ipc.writeUW("66C4", hdg)

    end

    function ALT_show ()

    alt = ipc.readLvar("L:ngx_ALTwindow")

    ipc.writeUW("66C6", alt / 100)

    end

    function VS_show ()

    vsw = ipc.readLvar("L:ngx_VSwindow")

    ipc.writeSW("66C8", vsw)

    end

    function CRSR_show ()

    crsr = ipc.readLvar("L:ngx_CRSwindowR")

    ipc.writeUW("66CA", crsr)

    end

    --***************************************************************************************

    -- ** Procedures for finding changes in MCP windows and MCP function LEDs****

    --***************************************************************************************

    function run_update (time)

    if crsl ~= ipc.readLvar("L:ngx_CRSwindowL") then

    CRSL_show ()

    end

    if crsr ~= ipc.readLvar("L:ngx_CRSwindowR") then

    CRSR_show ()

    end

    if spd ~= ipc.readLvar("L:ngx_SPDwindow") then

    SPD_show ()

    end

    if hdg ~= ipc.readLvar("L:ngx_HDGwindow") then

    HDG_show ()

    end

    if alt ~= ipc.readLvar("L:ngx_ALTwindow") then

    ALT_show ()

    end

    if vsw ~= ipc.readLvar("L:ngx_VSwindow") then

    VS_show ()

    end

    if ipc.readLvar("L:ngx_MCP_ATArm") ~= atarm then

    atarm = ipc.readLvar("L:ngx_MCP_ATArm")

    ipc.writeUB("66F0", atarm)

    end

    if ipc.readLvar("L:ngx_MCP_N1") ~= MCP_N1 then

    MCP_N1 = ipc.readLvar("L:ngx_MCP_N1")

    ipc.writeUB("66F1", MCP_N1)

    end

    if ipc.readLvar("L:ngx_MCP_SPEED") ~= MCP_Speed then

    MCP_Speed = ipc.readLvar("L:ngx_MCP_SPEED")

    ipc.writeUB("66F2", MCP_Speed)

    end

    if ipc.readLvar("L:ngx_MCP_VNav") ~= MCP_VNav then

    MCP_VNav = ipc.readLvar("L:ngx_MCP_VNav")

    ipc.writeUB("66F3", MCP_VNav)

    end

    if ipc.readLvar("L:ngx_MCP_LvlChg") ~= MCP_LvlChg then

    MCP_LvlChg = ipc.readLvar("L:ngx_MCP_LvlChg")

    ipc.writeUB("66F4", MCP_LvlChg)

    end

    if ipc.readLvar("L:ngx_MCP_HdgSel") ~= MCP_HdgSel then

    MCP_HdgSel = ipc.readLvar("L:ngx_MCP_HdgSel")

    ipc.writeUB("66F5", MCP_HdgSel)

    end

    if ipc.readLvar("L:ngx_MCP_LNav") ~= MCP_LNav then

    MCP_LNav = ipc.readLvar("L:ngx_MCP_LNav")

    ipc.writeUB("66F6", MCP_LNav)

    end

    if ipc.readLvar("L:ngx_MCP_VORLock") ~= MCP_VORLock then

    MCP_VORLock = ipc.readLvar("L:ngx_MCP_VORLock")

    ipc.writeUB("66F7", MCP_VORLock)

    end

    if ipc.readLvar("L:ngx_MCP_App") ~= MCP_App then

    MCP_App = ipc.readLvar("L:ngx_MCP_App")

    ipc.writeUB("66F8", MCP_App)

    end

    if ipc.readLvar("L:ngx_MCP_AltHold") ~= MCP_AltHold then

    MCP_AltHold = ipc.readLvar("L:ngx_MCP_AltHold")

    ipc.writeUB("66F9", MCP_AltHold)

    end

    if ipc.readLvar("L:ngx_MCP_VS") ~= MCP_VS then

    MCP_VS = ipc.readLvar("L:ngx_MCP_VS")

    ipc.writeUB("66FA", MCP_VS)

    end

    if MCP_CMDA ~= ipc.readLvar("L:ngx_MCP_CMDA") then

    MCP_CMDA = ipc.readLvar("L:ngx_MCP_CMDA")

    ipc.writeUB("66FB", MCP_CMDA)

    end

    if MCP_CWSA ~= ipc.readLvar("L:ngx_MCP_CWSA") then

    MCP_CWSA = ipc.readLvar("L:ngx_MCP_CWSA")

    ipc.writeUB("66FC", MCP_CWSA)

    end

    if MCP_CMDB ~= ipc.readLvar("L:ngx_MCP_CMDB") then

    MCP_CMDB = ipc.readLvar("L:ngx_MCP_CMDB")

    ipc.writeUB("66FD", MCP_CMDB)

    end

    if MCP_CWSB ~= ipc.readLvar("L:ngx_MCP_CWSB") then

    MCP_CWSB = ipc.readLvar("L:ngx_MCP_CWSB")

    ipc.writeUB("66FE", MCP_CWSB)

    end

    end

    --***************************************************************************************

    -- ** MCP switches *******

    --***************************************************************************************

    function MCP_FD1(off,val)

    if ipc.readUB("66EF") == 7 then

    if val == 1 and ipc.readLvar('ngx_switch_378_a') == 100 then

    ipc.control(70010, 536870912)

    ipc.control(70010, 131072)

    else

    if val == 0 and ipc.readLvar('ngx_switch_378_a') == 0 then

    ipc.control(70010, 536870912)

    ipc.control(70010, 131072)

    end

    end

    end

    end

    function MCP_ATARM(off,val)

    if ipc.readUB("66EF") == 7 then

    if val == 1 and ipc.readLvar('ngx_switch_380_a') == 100 then

    ipc.control(70012, 536870912)

    ipc.control(70012, 131072)

    else

    if val == 0 and ipc.readLvar('ngx_switch_380_a') == 0 then

    ipc.control(70012, 536870912)

    ipc.control(70012, 131072)

    end

    end

    end

    end

    function MCP_DISENGAGE(off,val)

    if ipc.readUB("66EF") == 7 then

    if val == 0 and ipc.readLvar('ngx_switch_406_a') == 100 then

    ipc.control(70038, 536870912)

    ipc.control(70038, 131072)

    else

    if val == 1 and ipc.readLvar('ngx_switch_406_a') == 0 then

    ipc.control(70038, 536870912)

    ipc.control(70038, 131072)

    end

    end

    end

    end

    function MCP_FD2(off,val)

    if ipc.readUB("66EF") == 7 then

    if val == 1 and ipc.readLvar('ngx_switch_407_a') == 100 then

    ipc.control(70039, 536870912)

    ipc.control(70039, 131072)

    else

    if val == 0 and ipc.readLvar('ngx_switch_407_a') == 0 then

    ipc.control(70039, 536870912)

    ipc.control(70039, 131072)

    end

    end

    end

    end

    function MCP1(off, val)

    if logic.And(val, 0x0010) ~= 0 then

    N1 ()

    elseif logic.And(val, 0x0020) ~= 0 then

    SPEED ()

    elseif logic.And(val, 0x0040) ~= 0 then

    CO ()

    elseif logic.And(val, 0x0080) ~= 0 then

    SPD_INTV ()

    elseif logic.And(val, 0x0100) ~= 0 then

    VNAV ()

    elseif logic.And(val, 0x0200) ~= 0 then

    LVLCHG ()

    elseif logic.And(val, 0x0400) ~= 0 then

    HDGSEL ()

    elseif logic.And(val, 0x0800) ~= 0 then

    HDG_BANK ()

    elseif logic.And(val, 0x1000) ~= 0 then

    LNAV ()

    elseif logic.And(val, 0x2000) ~= 0 then

    VORLOC ()

    elseif logic.And(val, 0x4000) ~= 0 then

    APP ()

    elseif logic.And(val, 0x8000) ~= 0 then

    ALT_INTV ()

    end

    end

    function MCP2(off, val)

    if logic.And(val, 0x0001) ~= 0 then

    ALTHLD ()

    elseif logic.And(val, 0x0002) ~= 0 then

    VS ()

    elseif logic.And(val, 0x0004) ~= 0 then

    CMDA ()

    elseif logic.And(val, 0x0008) ~= 0 then

    CWSA ()

    elseif logic.And(val, 0x0010) ~= 0 then

    CMDB ()

    elseif logic.And(val, 0x0020) ~= 0 then

    CWSB ()

    end

    end

    --***************************************************************************************

    -- ** MCP Dials ********

    --***************************************************************************************

    function CRSL_chg (off,val)

    if val == 255 then

    ipc.sleep(0)

    else if val > 0 then

    local i

    for i = 1, val do

    ipc.control(70008, 16384)

    ipc.sleep (5)

    end

    ipc.writeUB("66E8", 255)

    CRSL_show ()

    else if val < 0 then

    val = val* -1

    local i

    for i = 1, val do

    ipc.control(70008, 8192)

    ipc.sleep (5)

    end

    ipc.writeUB("66E8", 255)

    CRSL_show ()

    else if val == 0 then

    ipc.writeUB("66E8", 0)

    end

    end

    end

    end

    end

    function SPD_chg (off,val)

    if val == 255 then

    ipc.sleep(0)

    else if val > 0 then

    local i

    for i = 1, val do

    ipc.control(70016, 16384)

    ipc.sleep (5)

    end

    ipc.writeUB("66E9", 255)

    SPD_show ()

    else if val < 0 then

    val = val* -1

    local i

    for i = 1, val do

    ipc.control(70016, 8192)

    ipc.sleep (5)

    end

    ipc.writeUB("66E9", 255)

    SPD_show ()

    else if val == 0 then

    ipc.writeUB("66E9", 0)

    end

    end

    end

    end

    end

    function HDG_chg (off,val)

    if hdg_mode == 1 then

    if val == 255 then

    ipc.sleep(0)

    else if val > 0 then

    local i

    for i = 1, val do

    ipc.control(70022, 16384)

    ipc.sleep (5)

    end

    ipc.writeUB("66EA", 255)

    HDG_show ()

    else if val < 0 then

    val = val* -1

    local i

    for i = 1, val do

    ipc.control(70022, 8192)

    ipc.sleep (5)

    end

    ipc.writeUB("66EA", 255)

    HDG_show ()

    else if val == 0 then

    ipc.writeUB("66EA", 0)

    end

    end

    end

    end

    else

    BANK_chg (off,val)

    end

    end

    function BANK_chg (off,val)

    if val == 255 then

    ipc.sleep(0)

    else if val > 0 then

    local i

    for i = 1, val do

    ipc.control(70021, -2147483648)

    ipc.control(70021, 524288)

    ipc.sleep (5)

    end

    ipc.writeUB("66EA", 255)

    else if val < 0 then

    val = val* -1

    local i

    for i = 1, val do

    ipc.control(70021, 536870912)

    ipc.control(70021, 131072)

    ipc.sleep (5)

    end

    ipc.writeUB("66EA", 255)

    else if val == 0 then

    ipc.writeUB("66EA", 0)

    end

    end

    end

    end

    end

    function ALT_chg (off,val)

    if val == 255 then

    ipc.sleep(0)

    else if val > 0 then

    local i

    for i = 1, val do

    ipc.control(70032, 16384)

    ipc.sleep (5)

    end

    ipc.writeUB("66EB", 255)

    ALT_show ()

    else if val < 0 then

    val = val* -1

    local i

    for i = 1, val do

    ipc.control(70032, 8192)

    ipc.sleep (5)

    end

    ipc.writeUB("66EB", 255)

    ALT_show ()

    else if val == 0 then

    ipc.writeUB("66EB", 0)

    end

    end

    end

    end

    end

    function VS_chg (off,val)

    if val == 255 then

    ipc.sleep(0)

    else if val > 0 then

    local i

    for i = 1, val do

    ipc.control(70033, 8192)

    ipc.sleep (5)

    end

    ipc.writeUB("66EC", 255)

    VS_show ()

    else if val < 0 then

    val = val* -1

    local i

    for i = 1, val do

    ipc.control(70033, 16384)

    ipc.sleep (5)

    end

    ipc.writeUB("66EC", 255)

    VS_show ()

    else if val == 0 then

    ipc.writeUB("66EC", 0)

    end

    end

    end

    end

    end

    function CRSR_chg (off,val)

    if val == 255 then

    ipc.sleep(0)

    else if val > 0 then

    local i

    for i = 1, val do

    ipc.control(70041, 16384)

    ipc.sleep (5)

    end

    ipc.writeUB("66ED", 255)

    CRSR_show ()

    else if val < 0 then

    val = val* -1

    local i

    for i = 1, val do

    ipc.control(70041, 8192)

    ipc.sleep (5)

    end

    ipc.writeUB("66ED", 255)

    CRSR_show ()

    else if val == 0 then

    ipc.writeUB("66ED", 0)

    end

    end

    end

    end

    end

    --***************************************************************************************

    -- ** MCP buttons **************

    --***************************************************************************************

    function N1 ()

    ipc.control(70013, 536870912)

    ipc.control(70013, 131072)

    end

    function SPEED ()

    if ipc.readLvar("L:ngx_MCP_VNav") == 1 then -- go to SPD_INTV instead

    ipc.control(70019, 536870912)

    ipc.control(70019, 131072)

    else

    ipc.control(70014, 536870912)

    ipc.control(70014, 131072)

    end

    end

    function CO ()

    ipc.control(70015, 536870912)

    ipc.control(70015, 131072)

    end

    function SPD_INTV ()

    ipc.control(70019, 536870912)

    ipc.control(70019, 131072)

    end

    function ALT_INTV ()

    ipc.control(70517, 536870912)

    ipc.control(70517, 131072)

    end

    function HDG_BANK ()

    -- toggling HDG / BANK (1/2)

    -- HDG = 1, BANK = 2

    hdg_mode = 3 - hdg_mode

    end

    function VNAV ()

    ipc.control(70018, 536870912)

    ipc.control(70018, 131072)

    end

    function LVLCHG ()

    ipc.control(70023, 536870912)

    ipc.control(70023, 131072)

    end

    function HDGSEL ()

    ipc.control(70024, 536870912)

    ipc.control(70024, 131072)

    end

    function LNAV ()

    ipc.control(70029, 536870912)

    ipc.control(70029, 131072)

    end

    function VORLOC ()

    ipc.control(70028, 536870912)

    ipc.control(70028, 131072)

    end

    function APP ()

    ipc.control(70025, 536870912)

    ipc.control(70025, 131072)

    end

    function ALTHLD ()

    if ipc.readLvar("L:ngx_MCP_VNav") == 1 then -- go to ALT_INTV instead

    ipc.control(70517, 536870912)

    ipc.control(70517, 131072)

    else

    ipc.control(70026, 536870912)

    ipc.control(70026, 131072)

    end

    end

    function VS ()

    ipc.control(70027, 536870912)

    ipc.control(70027, 131072)

    end

    function CMDA ()

    ipc.control(70034, 536870912)

    ipc.control(70034, 131072)

    end

    function CMDB ()

    ipc.control(70035, 536870912)

    ipc.control(70035, 131072)

    end

    function CWSA ()

    ipc.control(70036, 536870912)

    ipc.control(70036, 131072)

    end

    function CWSB ()

    ipc.control(70037, 536870912)

    ipc.control(70037, 131072)

    end

    --***************************************************************************************

    -- ** Routines to detect MCP buttons and dials changes **

    --***************************************************************************************

    event.offset(0x66E4, "UB", "MCP_FD1")

    event.offset(0x66E5, "UB", "MCP_ATARM")

    event.offset(0x66E6, "UB", "MCP_DISENGAGE")

    event.offset(0x66E7, "UB", "MCP_FD2")

    event.offset(0x66E0, "UW", "MCP1")

    event.offset(0x66E2, "UW", "MCP2")

    event.intercept(0x66E8, "SB", "CRSL_chg")

    event.intercept(0x66E9, "SB", "SPD_chg")

    event.intercept(0x66EA, "SB", "HDG_chg")

    event.intercept(0x66EB, "SB", "ALT_chg")

    event.intercept(0x66EC, "SB", "VS_chg")

    event.intercept(0x66ED, "SB", "CRSR_chg")

    --***************************************************************************************

    -- ** Timer for MCP diplays and LED update

    --***************************************************************************************

    event.timer(100, "run_update")

  18. Hi,

    I have made some lua files that interfaces the PMDG NGX's MCP and EFIS. This was done before the SDK came out. The part interfacing the PMDG NGX via Lvars, ipc.control and ipc.read/write commands are controlled by sioc scripts ( I am using Opencockpits hardware). I am now thinking of writing a C++ program, but I need to study the interface simconnect and C++ a little bit more and also other parts.

    Why is there any need for FSUIPC4 now that the SDK is available? I had to use FSUIPC before the SDK was available. What I understand is that you need the C++ (dll) to interface PMDG through simconnect and in my case also interface/translate to sioc "language". But, in order to do this, I need to study a little bit more.

    I don't have any problem using FSUIPC, but to me using SIOC, C++(dll), SImconnect and FSUIPC incl LUA seems to complicated. There must be an easier way of doing this or?

    rgs

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