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

Share this post


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

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

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

Share this post


Link to post
Share on other sites

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

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

Share this post


Link to post
Share on other sites

Well works fine in FS2004 so thx a million for the great tip !Bj

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