November 3, 200916 yr How are 16-bit signed integers representing pseudo-degrees converted into "real" degrees? Gerry Howard
November 3, 200916 yr Commercial Member That would depend on the variable. Ed Wilson Mindstar AviationMy Playland - I69
November 4, 200916 yr Commercial Member 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 AviationMy Playland - I69
November 4, 200916 yr Moderator 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
November 4, 200916 yr Commercial Member 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 AviationMy Playland - I69
November 4, 200916 yr Author 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
November 5, 200916 yr Author 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
November 5, 200916 yr Commercial Member Ok... if it's true pseudo... it's the variable size divided by 360. Usually. :( Ed Wilson Mindstar AviationMy Playland - I69
Create an account or sign in to comment