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.

C gauge-- Radar Altimeter code help needed

Featured Replies

Hi folks, I normally post over at FS.com, but browse here too (not often enough though...had to sign-up again. )I'm having problems coding a radar altimeter gauge. I think I have the math correct, but something in my callback code throughs a warning in VC++5 during the build. If I click through the warning, it will compile but the gauge needle is non-functional and stays frozen on 0 meters.Here's a code snip that includes the needle macro and callback.

//////////////////////////////////////////////////////////////////////// interpreted from post#3186 at FS.com panel forum////////////////////////////////////////////////////////////////////// UINT32 Ground = 0;  //set variables to 0UINT32 Plane = 0;UINT32 Ralt = 0;MODULE_VAR		PHeight = {PLANE_ALTITUDE};  //get plane altMODULE_VAR		GHeight = {GROUND_ALTITUDE}; //get ground alt////////////needle macro callback/////////////////////////////FLOAT64 FSAPI ralt_cb (PELEMENT_ICON pelement){int val;lookup_var(&PHeight);			//get Plane Altlookup_var(&GHeight);			//get Ground AltPlane == PHeight.var_value.n;	//Plane Alt in metersGround == GHeight.var_value.n;	//Ground Alt in (meters * 256)Ground == Ground/256;			//Ground Alt converted back to metersRalt == Plane - Ground;			//altitude of plane above terrain...I want this as my returned value. val = (Ralt);	return val;}//////////////////////////////////////////////////////////MAKE_NEEDLE(	ralt_needle,	BMP_RALT_NEEDLE,	NULL,	ralt_fail,	IMAGE_USE_TRANSPARENCY | IMAGE_USE_ERASE | BIT7,	0,	150, 150,	0, 7,	MODULE_VAR_NONE,ralt_cb,		ralt_nonlinearity,	6)PELEMENT_HEADER		ralt_needle_list[] ={	(PELEMENT_HEADER)&ralt_needle,	NULL};////////////////////////////////////////////////////////////////////////

Any ideas are welcome. Thanks!Mike

The reason for the warning is that you use an icon callback for a needle element (PELEMENT_ICON instead of PELEMENT_NEEDLE) Since do not access any of the pelement->.. variables it doesn't do any harm.The reason why it is stuck is a different one, you use the equality operator "==" where you need the assingment operator "=". By the way, there is a variable RADIO_HEIGHT for your purpose, it wasn't there is FS98 but it is now.Arne Bartels

DOH! That's two that I overlooked.Thanks Arne!

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.