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?



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

    1. ...
    2. else if ((sh == MessageAircraftFlaps.GetID()) && (message.GetFlags().GetFlags() == 65540)) {
    3. _fs_flaps = message.GetDouble();
    4. }
    5. ...
  • 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.

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



  • Take the on ground for examples if we send 1.0 that means true, the aircraft is indeed on ground. If it is 0 then it is in the air.

    Internally we use mostly double values, makes it much easier if it's just one data type. You can always convert back to bool: double > 0.5

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

    1. _fs_onground = 0;
    2. ...
    3. ...
    4. ...
    5. else if (sh == MessageAircraftOnGround.GetID()) {
    6. _fs_onground = 1;
    7. }

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