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

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

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

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
Guest HartmannH

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

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...