DLL project - Some trouble on data message list

  • Hi,

    I'm making a little external DLL.

    I remark on data "Flaps", some aircraft like Boeing 747 shows always same value 0.523560 after changing flaps position.

    For Airbus A320, it works. It displays different position from 0.0 to 1.0.

    For data "Gear", it works no problem, it shows position from 0.0 to 1.0.

    Here is my code :

    Any idea about this problem?

    Regards,

    Chris.

    Edited once, last by Chrisoft (February 10, 2019 at 3:46 PM).

  • Hi,

    In fact, I found soluce.

    For data "Flaps", there are 3 different Flags.

    So I add condition to obtain an exact result from data.

    Here is :

    Code
               ...
                else if ((sh == MessageAircraftFlaps.GetID()) && (message.GetFlags().GetFlags() == 65540)) {
                    _fs_flaps = message.GetDouble();
                }
                ...
  • 0.523560 in radiant equals 30 degrees, so it works at intended.

    If you check the message qualifier, if it contains the flag "normalized" then the flaps values are going to be from 0 to 1.

    The "discrete" flag would be used for the A320 where the flaps go: 0, 1, 2, 3, 4 (or FULL as they call it).

    If the qualifier is empty then flaps are usually an angle and since all angles are in radiant the value won't reach 1.0 unless you happen to have a flap that deflects exactly 57.295779956916 degrees.

    I think we also send a qualifier "maximum" when the flaps are just an angle. Then you could save the Aircraft.Flaps message with the qualifier "maximum" and the Aircraft.Flaps message without it and then divide (check non-zero) to get a fraction of the total deflection.

  • Hi,

    In fact, I found soluce.

    For data "Flaps", there are 3 different Flags.

    So I add condition to obtain an exact result from data.

    Here is :

    Code
               ...
                else if ((sh == MessageAircraftFlaps.GetID()) && (message.GetFlags().GetFlags() == 65540)) {
                    _fs_flaps = message.GetDouble();
                }
                ...

    Great!

    But instead of message.GetFlags().GetFlags() == some integer that could be different each update

    you should probably use e.g. message.GetFlags().IsSet( tm_msg_flag::Setting );

    The IsSet function also returns true if multiple message flags are set including the desired one. If you just compare it directly then your code will only execute if and only if that one flag is set.

  • I found other data don't give us results.

    Here is some concerned data :

    - "Aircraft.Category.Jet", TYPE_DOUBLE, gives always 0.0 (with different aircraft)

    - "Aircraft.Category.Glider" , TYPE_DOUBLE, gives always 0.0 (with different aircraft)

    - "Aircraft.OnGround", TYPE_DOUBLE, gives always 1.0 or 0.0 (aircraft onground or not)

    - "Aircraft.OnRunway", TYPE_DOUBLE, gives always 0.0 (on message list debug, it displays "void" I don't know exactly what data type is)

    - "Aircraft.Crashed", TYPE_DOUBLE, gives always 0.0 (trying crash but come back quickly)

    I don't know you have also same problem. I tried this code :

    Regards,

    Chris.

    Edited once, last by Chrisoft (February 11, 2019 at 3:12 AM).

  • In fact, the best way for case "OnGround" :

    Code
                _fs_onground = 0;
                ...
                ...
                ...
                else if (sh == MessageAircraftOnGround.GetID()) {
                    _fs_onground = 1;
                }

    It works finally. I searched more complication with flags. lol

    Regards,

    Chris.

    Edited 3 times, last by Chrisoft (February 11, 2019 at 4:00 PM).