Jump to content
Sign in to follow this  
ddawson

Accessing an A var inside a cb function.

Recommended Posts

Guest HC001ST - Stick

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
Guest HC001ST - Stick

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  

  • Tom Allensworth,
    Founder of AVSIM Online


  • Flight Simulation's Premier Resource!

    AVSIM is a free service to the flight simulation community. AVSIM is staffed completely by volunteers and all funds donated to AVSIM go directly back to supporting the community. Your donation here helps to pay our bandwidth costs, emergency funding, and other general costs that crop up from time to time. Thank you for your support!

    Click here for more information and to see all donations year to date.
×
×
  • Create New...