Sign in to follow this  
ddawson

Accessing an A var inside a cb function.

Recommended Posts

GoalTo keep the oil temperature needle from falling below ambient air temperature. (vs. going to zero on shutdown).Proposed StrategyUse the needle's call back function and clip the minimum at the current TOTAL_AIR_TEMP.ProblemHow do you access TOTAL_AIR_TEMP while inside the call back function?Could I do this:

FLOAT64 FSAPI	temp_needle_cb( PELEMENT_STRING pelement ){	FLOAT64	val = pelement->source_var->var_value.n;	SINT16 nTemp = 0;	MODULE_VAR curr_Temp = {TOTAL_AIR_TEMP};		lookup_var(&curr_Temp);	nTemp = curr_Temp.var_value.n;	if (val < nTemp)		val = nTemp;	return val;}

inside the call back function?

Share this post


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

Ok, this works, but I changed the SINT16 to a FLOAT64.

Share this post


Link to post
Share on other sites

You can use the 'lookup_var' command anywhere. You may want to move the 'MODULE_VAR' declaration out of the function. I've never tried that - not sure if it will work...Doug

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