Jump to content

Archived

This topic is now archived and is closed to further replies.

mgh

Pseudo Degrees

Recommended Posts

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


Gerry Howard

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


Gerry Howard

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

Interests: Gauge Programming - 3d Modeling for Milviz

Many Thanks to All That Donated To Our Server Drive!

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.


Gerry Howard

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.


Gerry Howard

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