Skip to content
View in the app

A better way to browse. Learn more.

The AVSIM Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Finding the zero mark on a rotating card

Featured Replies

Given a rotating SPRITE, I have been forced to deduce the zero point on the card experimentally. Originally, I had hoped that there zero point is the 3 o'clock position like needles, however this turned out to not be true.I'm betting there is a more direct method given the card's module var value and scale of rotation.For example, if I have a card using the KOHLSMAN_CARD_HG var which reports 29.92 as a starting value, and am using a scale of 60, how would I calculate the angle where to put that mark on the card?I suspected that I would take fmod(kohlsman * 60), but this doesn't seem to be correct either.

Patrick,Why are you using SPRITE for a Kohlsman setting??The Kohlsman value is really a NEEDLE, ie it rotates...surely there is no need to translate it either vertically or horizontally.Can't you use a NEEDLE then place a STATIC image above it with a transparent mask for the Kohlsman to show through?RegardsJim

Patrick If you do go for a SPRITE. Put your 29.92 in the 3 o'clock position.You will need to check on your BITMAP what angle there is between 29.92 and 29.93.. Lets say its 5 degrees. In your callback function you need to check the Kohlsman value. Lets say it 29.96..that means you have to rotate your card -20 degrees (2092-2096)*5 = -20So your callback function will return the value -20 and the card will rotate 20 degrees anti-clockwiseRegardsJim

I don't rotate the card, I let the sim do that. The point is to find the zero position the sim is using.However, I figured it out... my original thought was correct.You take 29.92, multiply by your scaling factor, and then mod by 360. ( 29.92 * 60 ) mod 360 = 355.2Now, subtract 360 once more: 355.2 - 360 = -4.8 degsAnd so the zero point is 4.8 CCW from the 3 o'clock position given this scaling and var.

  • Moderator

Being a simple fool, I've always used a "needle element" to represent the rotating card... thus...return KOHLSMAN_SETTING_HGvar.var_value.n ; in my needle's callback is sufficient for my needs, when used with the non-linearity table:NONLINEARITY ALT_KohlsmanCard[] = {{{246,46}, 29.4, 0},{{280,69}, 29.5, 0},{{307,160}, 29.6, 0},{{324,146}, 29.7, 0},{{332,175}, 29.8, 0},{{329,216}, 29.9, 0},{{315,154}, 30.0, 0},{{293,188}, 30.1, 0},{{262,314}, 30.2, 0},{{226,332}, 30.3, 0},{{185,339}, 30.4, 0},{{145,335}, 30.5, 0},};

Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

>Being a simple fool...Bill, thats 2 lies in only 4 words...and you a man of the cloth..tut tut!JimPS: assuming that your Kohlsman readings are evenly spaced you could simplify your non-linearity table to first and last valueNONLINEARITY ALT_KohlsmanCard[] = {{{246,46}, 29.4, 0},{{145,335}, 30.5, 0},};

Haha. There I go again using a jack hammer. =)That is too funny. Great idea to use the needle macro since it doesn't move in x or y, makes more sense. For my tiny brain, it should have been called MAKE_ROTATE =)

>Great idea to use the needle macro since>it doesn't move in x or y, makes more sense. Yeah! not a bad idea from someone who (apparently) has never got an altimeter to work!!

  • Moderator

>>Being a simple fool...>>Bill, thats 2 lies in only 4 words...and you a man of the>cloth..tut tut!>>Jim>>PS: assuming that your Kohlsman readings are evenly spaced>you could simplify your non-linearity table to first and last>value>>NONLINEARITY ALT_KohlsmanCard[] = {>{{246,46}, 29.4, 0},>{{145,335}, 30.5, 0},>};Really? Since I am indeed a "fool," and am likewise "simple," that leaves only "Being" and "a" as the questionable words......since I'm (apparently) not dead, I'm fairly confident in my state of "Being(ness)." I suppose it might be argued that since "me, myself and I" are an imperfect trinity, the "a" might be incorrect might be construed as ontologically a lie, although gramatically it is entire proper! :)Yes, the non-linearity table could be simplified...

Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator
  • Moderator

>Haha. There I go again using a jack hammer. =)>>That is too funny. Great idea to use the needle macro since>it doesn't move in x or y, makes more sense. For my tiny>brain, it should have been called MAKE_ROTATE =)Feel free to edit your fsgauges.h to whatever makes you happiest! ;)

Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Actually, there is a reason that I used a SPRITE too... I am using a mask to allow me to do some other things. =)

  • Moderator

>Actually, there is a reason that I used a SPRITE too... I am>using a mask to allow me to do some other things. =)>Actually, for reasons unrelated to any visual effect, there is an excellent reason for using a SPRITE with its mask:...in the VC, elements such as a compass dial tend to "deform" when the corners of the square bitmap are rotated outside the bounds of the background image.

Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Bill,Thanks for this tip. I had just finished the VOR2 using the NEEDLE vs. the SPRITE as an exercise, and to reduce the number of bitmaps.I did so after also noticing that MS's gauge must use NEEDLE due to the lack of a mask in their .dll.Now, before converting the ADF to NEEDLE (if I ever get around to that anyway), I'll check them both out in the VC to make sure they look ok, and use the SPRITE if this effect is noticable.

  • Moderator

>I did so after also noticing that MS's gauge must use NEEDLE>due to the lack of a mask in their .dll.Which gauge set? The two VORs in the c172 gauge set both have masks for the compass card:VOR2#7026.....compass card#7027.....compass card mask#7526.....compass card hi res#7527.....compass card mask hi resVOR1#7037.....compass ring#7038.....compass ring mask#7537.....compass ring hi res#7538.....compass ring mask hi res...and of course the "night time versions" of both lo res and hi res graphics as well... ;)

Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

The B206 gauge set. =)

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.