Jump to content
Sign in to follow this  
Jofre

Detect plane shutdown/change from gauge

Recommended Posts

Hi,I´m building a gauge using C and I´d like to detect when the user is shooting down the plane.My gauge is open some network connection I´d like to close them properlyIs there a function called when the plane is being shutdown?Thanks in advanceJofre

Share this post


Link to post
Share on other sites

You would have to define conditions for when the plane is shut down and then test them.For example, the plane could be considered shut down when all engines have 0 rpm and the main bus voltage is 0.But maybe you want to test the magnetos or fuelvalve as well.If you want to detect the moment the plane is shut down you can use a variable to record the previous state.You first determine the plane's current state and compare it to the previous state.If they are the same nothing has happened, if they are different the plane has just changed it's state.Then you write the current state into the previous state variable for the next iteration.

Share this post


Link to post
Share on other sites
Hi,I´m building a gauge using C and I´d like to detect when the user is shooting down the plane.My gauge is open some network connection I´d like to close them properlyIs there a function called when the plane is being shutdown?Thanks in advanceJofre
1. There is a dedicated forum for technical questions named MSFS Aircraft and Panel Design Forum, where such questions are best asked. Many folks who are gauge/panel systems developers don't follow this forum all that closely... :( 2. You will need to need to set up a callback to the sim's "Panel_Service" function, and place your "disconnect routine(s)" here:
void FSAPI gaugecall(PGAUGEHDR pgauge, int service_id, UINT32 extra_data){	switch(service_id)	{		case PANEL_SERVICE_CONNECT_TO_WINDOW:			/* START UP STUFF GOES HERE! */		break;		case PANEL_SERVICE_DISCONNECT:			/* SHUT DOWN STUFF GOES HERE! */		break;	}}

See the SDK's gauges.h file for a complete list of Panel_Service case events.


Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

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...