Jump to content
Sign in to follow this  
mgh

Pseudo Degrees

Recommended Posts

How are 16-bit signed integers representing pseudo-degrees converted into "real" degrees?

Share this post


Link to post
Share on other sites

That would depend on the variable.


Ed Wilson

Mindstar Aviation
My Playland - I69

Share this post


Link to post
Share on other sites

I'm interested in magnetic variation in magdec.bgl

Share this post


Link to post
Share on other sites

Since that's not an FS variable, you'll have to beg someone in the scenery department.FYI, if you're reading directly from BGL's... be very, very, very careful. Microsoft shut someone down a while back for doing just that. I can't give details... just a friendly FYI.


Ed Wilson

Mindstar Aviation
My Playland - I69

Share this post


Link to post
Share on other sites
How are 16-bit signed integers representing pseudo-degrees converted into "real" degrees?
Gerry, didn't we have this discussion back in 2006?http://forums1.avsim.net/index.php?showtop...=pseudo-degreesIf the variable is for the adf, then:
lookup_var(&mvadfndl); adfndl = mvadfndl.var_value.n; adfdir = (360 + adfndl + heading); if (adfdir > 359) { adfdir = adfdir - 360; } if (adfdir < 0) { adfdir = adfdir + 360; }

For your proposed purpose, perhaps Ed's suggestion of simply stripping all bits past the 256-bit mark... the 0x1ff will accomplish that...

adf_hdg = (ADF_NEEDLEvar.var_value.n && 0x1ff) // adf_hdg = 419 adf_hdg = (adf_hdg * 360) / 512; // adf_hdg = 294.6


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Share this post


Link to post
Share on other sites

I think the people in the scenery forum would have a better idea of how the value's physically coded... hence my suggestion.


Ed Wilson

Mindstar Aviation
My Playland - I69

Share this post


Link to post
Share on other sites

My memory's going - I'd forgotten about the previous post!However the suggestions in it doesn't give sensible answers in my case. Thanks for the help anyway - I'll try the scenery forum.Rereading the original post shouldn'tadf_hdg = (ADF_NEEDLEvar.var_value.n && 0x1ff) // adf_hdg = 419 read adf_hdg = (ADF_NEEDLEvar.var_value.n & 0x1ff) // adf_hdg = 419 The first uses the logical-and which returns only true (1) or false (0). The second is the bitwise-and which masks out bits.

Share this post


Link to post
Share on other sites

I may have answered my own question. According to the FS2000 scenery SDK pseudo degrees represent the range 0 -360 with different degrees of precision in 8 bit (byte) 16 bit (word) 32 bit (double word) and 48 bit unsigned integers.

Share this post


Link to post
Share on other sites

Ok... if it's true pseudo... it's the variable size divided by 360. Usually. :(


Ed Wilson

Mindstar Aviation
My Playland - I69

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