Flightdeck Solutions Forum Index Flightdeck Solutions
The place to meet and talk with fellow builders
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Offsets and more offsets

 
Post new topic   Reply to topic    Flightdeck Solutions Forum Index -> FDS - Interface Products
View previous topic :: View next topic  
Author Message
VH465



Joined: 13 Sep 2014
Posts: 4
Location: YMML, AUS

PostPosted: Sun Sep 21, 2014 10:11 pm    Post subject: Offsets and more offsets Reply with quote

So I have moved away from flying a desk. Built my own sim (single seat aka Jetmax style).

I have a SYS card 64/128 for my own cutdown overhead and have wired it all up. It's near complete and I connected a few LED's last night and got them working in test mode, just waiting on some more annunciator holders/engraved plates to arrive.

The facts

My SYScard is connected to a 2nd networked PC, Wideclient running, InterfaceIT running, (also runs FsInn), connects fine to fsx. Main PC has a registered FSUIPC and Wideserver, connects fine to the client. I do not have SimA or ProSim or Project Magenta running. Thanks SteveC for the info, legend - sent me the Glare.exe to interface, all works fine there.

The dilemna
I have a couple of questions which may or may not be dumb ones, I don't care and happy to be dumb but losing a battle with keeping my hair in, just a defining answer would do.

1 - I have all my switches working, sort of. I mean they turn on and off OK, except after reading tons of web stuff on offsets ended up using 3110/3114 and the Values from the PMDG SDK for the switches. Problem here is FSUIPC ,I think doesn't remember where each switch is (up/down/cent) so after clicking a few, if I try to click one off it clicks the last switch I set back to off, or I have to click it off/on off. Probably because it is using the same offset 3110 and thinks it is up not down. The offsets in the tekworx xml files do not work for me at all. The test xml file SteveC sent me works, but only has a few files, so I copied a standard on/off SPST for the other switches and changed the values from the pmdg sdk to suit, then experimented with the SPDT and rotary ones and got them working. Now it becomes fun turning the switches on instead of using the VC.

2 - Luckily one of the test xml files was for an annunciator, I managed to get 1 working. As a test I used the APU ON LED to light a led and it worked when the APU came on, awesome, and it went off when it was supposed to. Problem here is I cannot find where the value for this comes from. Back to the web and around in circles only to end up back here searching.....

So, do I need to use SIM-A or ProSIM or iFly to interface using the PMDG SDK xml files. Is this what I am missing, or is it just my lack of brain matter.

Anyway that is way too big for my first post. Love the stuff you guys do at FDS, the syscard is simple to setup, just as soon as I understand offsets!

Any help appreciated.

Regards

Peter
_________________
Kind Regards

Peter Harding
Nothing is permanent
Back to top
View user's profile Send private message
DaddyBooks



Joined: 21 Jun 2011
Posts: 12

PostPosted: Thu Sep 25, 2014 10:25 am    Post subject: Reply with quote

Apologies to the community in advance for the long post. I have spent dozens of hours working through all of this and Peter's question prompted me to save another 737NGX driver the same learning curve.

Peter...

The PMDG 737NGX is a tricky beast to interface. I now have a full JetMax overhead, MIP and TQ all interfaced but it took a lot of trial and error to first learn how the interfacing operates. It would have been impossible without having the value add of interfaceIT and FSUIPC.

Once I sorted the methods out, it was straightforward to configure the input and output actions but, occasionally, I still see a curve ball. My hair has grown back now so I'll try to help where I can.

It's important to note that, for my simulator, I run interfaceIT on the FSX computer. I would not expect issues with doing this on a WideClient connected version of interfaceIT. I use WideClient for several other activities including interfacing of my VATSIM client and virtual airline ACARS. Unfortunately, I have no ability to test that configuration so I can't rule out whether a remote interfaceIT configuration may be a contributor to the behavior you are experiencing.

I should also note that I am not using the offsets provided by JetMax/FDS. Those are offsets that are initialized by the GLARE software and I believe correspond to the offsets in the provided XML file. I decided instead to go directly to the calls defined in the NGX SDK so I could be sure how all of the underlying functions are configured.

I'm sure you have determined much of this already but I'm writing it all down in hopes of helping another of our fellow pilots who may be attempting a similar challenge.

Feel free to send me a PM if you want me to export a few switch or LED functions to get you started.

INTERFACING APPROACH FOR SWITCHES:

There are two interfacing methods needed to drive a switch action on the PMDG 737NGX. This assumes that the SDK is properly configured as defined in the SP1c release of the 737NGX and a fully licensed version of FSUIPC is properly configured. All interfaceIT input actions are using the "Update FSUIPC" function.
    Direct Parameter: Sets a switch to one of several positions defined as parameters in the SDK. One example is the Taxi Light where a value of 1 positions the switch ON and a value of 0 positions the switch OFF.
    Mouse Action: Simulates a mouse input by one of several defined mouse actions. For example, a parameter of hexadecimal 0x20000000 (decimal 536870912) is a single LEFT mouse button press and a parameter of hexadecimal 0x00020000 (decimal 131072) releases the LEFT mouse button . A switch where this is required is the APU switch.

Use of FSUIPC Offsets:

As you have already discovered, offsets 3114 and 3110 are the key to interfacing.

Offset 3114 is the Parameter to be included with the function.

This is populated FIRST depending upon the type of interfacing approach required for the function. This must be populated prior to Offset 3110 and appear in the interfaceIT list of input actions first so that a subsequent call to Offset 3110 executes with the correct parameter. The parameters for multiple position switches (such as rotary switches) are typically defined as comments (begin with //) in the 737NGX header file [PMDG_NGX_SDK.h] for the corresponding event. Most single position switches can be assumed to have a parameter value of 1 for ON and 0 for OFF. Some trial and error was required to discover values in cases where the header file does not define the needed parameter (see Fuel Crossfeed below).

Offset 3110 is the function to be called. The value used for offset 3110 is function number is derived by adding the THIRD_PARTY_EVENT_ID defined in the 737NGX header file [PMDG_NGX_SDK.h] to the base NGX offset of 69632. So, for example, the Taxi Light function has a THIRD_PARTY_EVENT_ID of 117 and therefore the parameter for Offset 3110 is 69749 (69632 + 117).

IMPORTANT: Here are possible sources of the problems you describe:
    * The data type used for Offsets 3114 and 3110 must be a 32 bit value. I use LongInt/S32. In the past, I inadvertently used a BYTE value which only populated the first (highest) 8 bits of the value with very unreliable results.
    * When using mouse functions, it is important to complete the action by releasing the mouse buttons. The NGX appears to do this automatically most times but, for certain functions, unpredictable outcomes occur when subsequent calls are made.

A FEW EXAMPLES:

Taxi Light: A two-position switch that sets the light ON and OFF. Two Input Actions are required for Switch ON and Two Input Actions for Switch OFF

1. Input Action --> Update FSUIPC --> SWITCH On/Down
    Offset: 3114
    Type: LongInt/S32
    Operation: Set value
    Value: 1

    Value 1 is the parameter for LIGHT ON

2. Input Action --> Update FSUIPC --> SWITCH On/Down
    Offset: 3110
    Type: LongInt/S32
    Operation: Set value
    Value: 69749

    Value 69749 is the calculated event value for Taxi Light as explained above.

3. Input Action --> Update FSUIPC --> SWITCH Off/Up
    Offset: 3114
    Type: LongInt/S32
    Operation: Set value
    Value: 0

    Value 0 is the parameter for LIGHT OFF

4. Input Action --> Update FSUIPC --> SWITCH Off/Up
    Offset: 3110
    Type: LongInt/S32
    Operation: Set value
    Value: 69749

    Value 69749 is the calculated event value for Taxi Light as explained above.

APU Start: A complex switch using both forms of interfacing. This is interesting because the START position of the switch is momentary. The switch is first set to ON (items 1 and 2) and is then populated to START by sending a LEFT MOUSE PRESS (items 3 through 5). When released, a LEFT MOUSE RELEASE is sent (items 6 and following).

Note items 3 and 6 in the list. This clears the parameter prior to populating a mouse action.

    TECHNICAL EXPLANATION: Because interfaceIT does not appear to accept a negative parameter, I use a "set bit" mechanism to populate mouse actions. This is required for RIGHT MOUSE press which is a negative value. The way to do this is to set the correct BIT at the appropriate BYTE within the LONGINT by specifying the offset of the specific BYTE needed.

    For non programmers. a LEFT MOUSE press may be set using a LongInt decimal value of 536870912 instead and LEFT MOUSE release using a LongInt decimal value of 131072. However I always use the "set bit" mechanism for consistency purposes.

1. Input Action --> Update FSUIPC --> SWITCH On/Down
    Offset: 3114
    Type: LongInt/S32
    Operation: Set value
    Value: 1

    Value 1 is the parameter for APU ON

2. Input Action --> Update FSUIPC --> SWITCH On/Down
    Offset: 3110
    Type: LongInt/S32
    Operation: Set value
    Value: 69750

    Value 69750 is the calculated from a third party event type of 118.

3. Input Action --> Update FSUIPC --> SWITCH On/Down
    Offset: 3114
    Type: LongInt/S32
    Operation: Set value
    Value: 0

    Clears the parameter prior to populating a Mouse action

4. Input Action --> Update FSUIPC --> SWITCH On/Down
    Offset: 3117
    Type: Byte/U8
    Operation: Set bit
    Value: 5

    A bit of 5 populates an overall value of 0x20000000 for Offset 3114.

5. Input Action --> Update FSUIPC --> SWITCH On/Down
    Offset: 3110
    Type: LongInt/S32
    Operation: Set value
    Value: 69750

    Sends a left mouse click to the APU switch from the position of ON which moves the SWITCH to the START position.

6. Input Action --> Update FSUIPC --> SWITCH Off/Up
    Offset: 3114
    Type: LongInt/S32
    Operation: Set value
    Value: 0

    Clears the parameter prior to populating a Mouse action

7. Input Action --> Update FSUIPC --> SWITCH Off/Up
    Offset: 3117
    Type: Byte/U8
    Operation: Set bit
    Value: 1

    A bit of 1 populates an overall value of 0x00020000 for Offset 3114.

8. Input Action --> Update FSUIPC --> SWITCH Off/Up
    Offset: 3110
    Type: LongInt/S32
    Operation: Set value
    Value: 69750

    Sends a left mouse RELEASE to the APU switch from the position of START which releases the switch and returns the switch to the ON position.

Display Source: A three (3) position rotary. The CENTER position is actually switch OFF so returning the switch to the CENTER position requires a corresponding call to FSUIPC to set the corresponding position of the rotary. The command sequence for Display Source ALL ON 1 (LEFT position) is:

1. Input Action --> Update FSUIPC --> SWITCH On/Down
    Offset: 3114
    Type: LongInt/S32
    Operation: Set value
    Value: 0

    Value 0 is the parameter for ALL ON 1 as documented in the NAVDIS_SourceSelector in the header file
    // 0: ALL ON 1 1: AUTO 2: ALL ON 2

2. Input Action --> Update FSUIPC --> SWITCH On/Down
    Offset: 3110
    Type: LongInt/S32
    Operation: Set value
    Value: 69690

    Value 69690 is the calculated from a third party event type of 58.

3. Input Action --> Update FSUIPC --> SWITCH Off/Up
    Offset: 3114
    Type: LongInt/S32
    Operation: Set value
    Value: 1

    Value 1 is the parameter for AUTO

4. Input Action --> Update FSUIPC --> SWITCH Off/Down
    Offset: 3110
    Type: LongInt/S32
    Operation: Set value
    Value: 69690

    Value 69690 is the calculated from a third party event type of 58.

Fuel Cross Feed ON: Fuel Cross Feed is a two (2) position rotary. The CENTER position is actually a separate SWITCH so when moving the switch LEFT or RIGHT, interfaceIT detects the first switch and the return to CENTER requires configuring a second switch. The command sequence for FUEL CROSSFEED ON is:

1. Input Action --> Update FSUIPC --> SWITCH On/Down
    Offset: 3114
    Type: LongInt/S32
    Operation: Set value
    Value: 0

    Value 0 is the parameter for FUEL CROSSFEED OPEN which was discovered through testing.

2. Input Action --> Update FSUIPC --> SWITCH On/Down
    Offset: 3110
    Type: LongInt/S32
    Operation: Set value
    Value: 69681

    Value 69681 is calculated from a third party event type of 49.

ANNUNCIATOR VALUES:

Peter Dawson, author of FSUIPC, has done all of us a service by pre-defining offsets for annunciators for the 737NGX. Those are located in the Offset Mapping for PMDG737NGX file released with the most recent updates to FSUIPC. These are read as Byte/U8 values in the LED section of InterfaceIT at the offsets.

So, for example, I would configure APU LOW OIL PRESSURE as follows:
    Output Action --> From FSUIPC
    Offset: 6491
    Data Type: Byte/U8
    Action: Value-On
    Value On: 1
Let me know how it goes...

...DaddyBooks
    Back to top
    View user's profile Send private message
    VH465



    Joined: 13 Sep 2014
    Posts: 4
    Location: YMML, AUS

    PostPosted: Sat Sep 27, 2014 11:52 pm    Post subject: Reply with quote

    Hi DaddyBooks,

    thanks for you great post. It is good to know I was on the right track, part of the issue was I didn't know if I was following the right "protocol" for configuring switches or going my own way which I didn't want to do. Did I really need 4 actions for a single switch, thanks for putting my hair back in place on that one. I did remove the Glare.exe as I believe it was interfering, maybe/maybe not, but I don't need it as I am going direct to FSUIPC.

    For others reading this and maybe needing some closure Laughing I found the issue with my switches - in diagnosing this I picked the example you gave me for the Taxi light and checked all the variables etc.. And there it was - I had somehow set the OFFSET for 3110/OFF position as a byte instead of a Long/Int. Duh!

    To cut a long story short because I had copied my switch actions to each and just modified the VALUES as I went I obviously never checked this setting, all of the same 3114 offsets were set to byte. I set a couple more to long/int to be sure and they worked as expected. Cartwheels may have happened if I could do them.

    I then went about renaming all of my switch actions so they are consistent, where they need to be. For example the TAXI LIGHT.

    I named it suitably OH_TAXI_LIGHT_SW
    I have 4 actions
    1 - SET SW On / Down 3114
    2 - SET SW On / Down 3110
    3 -SET SW Up / Off 3114
    4 -SET SW Up / Off 3110
    Each was set with the values as I had and you verified for me so I won't paste that here. The DPDT switches also work correctly.

    I have my annunciators working also, found Pete Dowsons info, thanks again.

    Just a small issue now with my ROTARY switches e.g. for the IRS. I cannot get them to click to Pos 3 (ATT) without it first flicking to 0, effectively turning them off and resetting the IRS. (The OFF position for pos3 is set to pos2 so they should not even go to 0), I'll work on that.

    Thanks again for your tremendous help. Now I just need to buy another input board.
    _________________
    Kind Regards

    Peter Harding
    Nothing is permanent
    Back to top
    View user's profile Send private message
    Jetcos



    Joined: 30 Sep 2005
    Posts: 1038
    Location: Newmarket,Ontario

    PostPosted: Sun Oct 05, 2014 6:43 pm    Post subject: Reply with quote

    Thank you Robert, for your detailed response.
    _________________
    Steve Cos
    Tech Support
    Flightdeck Solutions (FDS)
    Back to top
    View user's profile Send private message Send e-mail Visit poster's website
    VH465



    Joined: 13 Sep 2014
    Posts: 4
    Location: YMML, AUS

    PostPosted: Tue Feb 10, 2015 8:51 pm    Post subject: More on Rotary switches Reply with quote

    So I have dragged this post out again especially to give more information for the rotary switches.

    I use only 2 rotary sets at present, ENG start L/R and IRS L/R. These are unique and don't follow the same convention as far as inputs go.

    The ENG start sw has POS1 is GND, POS2 OFF, POS3 CONT, POS4 FLIGHT.
    The IRS is different - POS1 is OFF, POS2 ALIGN, POS3 NAV, POS4 ATT

    To accurately use the 4 positions you need 4 Inputs (plus the common of course) not 3 inputs. I had left the OFF POS with no input cable as it is just the OFF position, why would it need one? For a normal toggle switch SPST you don't need it, but for rotary switches (AUTO BRAKE is included in this) you need an input for each pin including the OFF position to do it properly.

    So back to my ENG SWS. As a rotary if you don't use 0 as a proper INPUT and just set it as an "off" position for POS3 when you switch from 3 to 4 it "bounces" to 0 in between. Note this is also due in part to the switch not being Make before Break which could be another possibly more expensive solution. For the ENG start switches you could say this is really not a major problem just annoying, but for the IRS it is a killer.

    At startup I set the Switches to ALIGN (POS2) and set the aircraft GPS Position in the CDU/FMC. (I could be doing this wrong but it highlights the problem). Sometime later I will move these to NAV and here lies the bounce problem. Moving from POS2 to POS3 the switch "bounces" back to POS0 on the way to POS3. In the VC you can actually see this happen which was how I picked this up. Consequently of course it resets the IRS to OFF and I have to start the entire IRS/POS process again. So for a while I gave up and stuck with the VC until I got sick of it and decided to try and fix it.

    My temporary solution was to remove the input cable from POS4 on both sets of SWS (I don't use this) and put it onto POS 0 on the IRS and POS1 on the ENG's i.e. the OFF position. Then it is just a matter of programming it in InterfaceIT as 0 with the correct offsets. Now it works a treat, just means I can't use POS4 for now.

    Once I get my next SYScard I will redo this but sadly I have run out of inputs for now. 64 was not enough for my overhead.

    Hope this helps
    _________________
    Kind Regards

    Peter Harding
    Nothing is permanent
    Back to top
    View user's profile Send private message
    Display posts from previous:   
    Post new topic   Reply to topic    Flightdeck Solutions Forum Index -> FDS - Interface Products All times are GMT - 5 Hours
    Page 1 of 1

     
    Jump to:  
    You cannot post new topics in this forum
    You cannot reply to topics in this forum
    You cannot edit your posts in this forum
    You cannot delete your posts in this forum
    You cannot vote in polls in this forum


    Powered by phpBB © 2001, 2005 phpBB Group