Jump to content
Sign in to follow this  
bcs112

How to detect if elevator trim is changed manually ?

Recommended Posts

Hi,I'm finishing up my A300B4 panel right now (C gauges and freeware) and I'm trying to add the final touches. One of the things I haven't been able to do was add the trim wheel sound that the real panel uses when the elevator trim is changed manually (so not when the AP changes the trim). Manually trimming while the AP is turned should also disable the AP.So how do you detect this ? Anybody have an idea ?Thx,Bj


simcheck_sig_banner_devteam.jpg

 

Bj

Share this post


Link to post
Share on other sites
Guest HartmannH

You can either store the last trim setting in a variable and compare it to the current setting to detect changes or use an event handler which captures keyboard/joystick input:// Prototypevoid FSAPI msys_EventHandler(ID32 event, UINT32 evdata, PVOID userdata);// in your gauge callback function:case PANEL_SERVICE_POST_INSTALL:register_key_event_handler((GAUGE_KEY_EVENT_HANDLER)msys_EventHandler, 0);break;case PANEL_SERVICE_PRE_KILL:unregister_key_event_handler((GAUGE_KEY_EVENT_HANDLER)msys_EventHandler, 0);break;// and the event handler function itselfvoid FSAPI msys_EventHandler(ID32 event, UINT32 evdata, PVOID userdata){switch (event){case KEY_ELEV_TRIM_DN:case KEY_ELEV_TRIM_UP:// do something herebreak;}}That should do what you want.

Share this post


Link to post
Share on other sites

Hans,Thing is that, as far as I understand, the FS autopilot also uses the trim to make changes in the aircraft pitch so detecting a change in the trim will not detect wether this change was made by the autopilot or by the pilot. Bj


simcheck_sig_banner_devteam.jpg

 

Bj

Share this post


Link to post
Share on other sites

Hi,In XMl I should add a custom variable to generate sound when trimming manually.May be in C++ that is possible too.Jan"Beatus Ille Procul Negotiis"

Share this post


Link to post
Share on other sites

Jan,That's what I plan to do, but how to distinguish manual trimming from FS AP trimming ? That's the question !Bj


simcheck_sig_banner_devteam.jpg

 

Bj

Share this post


Link to post
Share on other sites
Guest HartmannH

The event handler code I posted above, only reacts on key commands, not on trim changes made by the autopilot. This is actually the code I used on the Flight1 ATR to switch off the autopilot when the user moves the yoke.

Share this post


Link to post
Share on other sites

Thx Hans,Will give it a try tonight, I'll keep you posted how it works out...Bj


simcheck_sig_banner_devteam.jpg

 

Bj

Share this post


Link to post
Share on other sites

I use this one to see when AP is trimming:(A:ELEVATOR TRIM PCT,percent) (>G:Var1) (A:AUTOPILOT MASTER,bool) if{ (A:ELEVATOR TRIM PCT,percent) (G:Var1) 0.1 + > if{ 1 } els{ (A:ELEVATOR TRIM PCT,percent) (G:Var1) 0.1 - < if{ 2 } } } els{ 0 }Manual trimming disconnects the autopilot through the custom var.Jan"Beatus Ille Procul Negotiis"

Share this post


Link to post
Share on other sites

Hans,Tried the code, is it possible that this is FS2004 only ? Can't seem to get it to work in FS2002. Is a similar interception of events possible in FS2002 ?Bj


simcheck_sig_banner_devteam.jpg

 

Bj

Share this post


Link to post
Share on other sites
Guest HartmannH

No idea, sorry. I never tried this in FS2002.

Share this post


Link to post
Share on other sites
Guest HartmannH

deleted... answered without thinking ;)

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