Sign in to follow this  
Guest

C gauge-- Radar Altimeter code help needed

Recommended Posts

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

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

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

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