Sign in to follow this  
Rocky

Using trigger_key_event (fix control acceleration)

Recommended Posts

In some panels, there is a problem with the autopilot heading or speed setting: when you try to increase or decrease the value, it changes 10 by 10 instead of 1 by 1.With the help of Pete Dowson, I found the explanation: the frequent use of "trigger_key_event" in the code generates key events and fools the acceleration system, making it believe the value change must be accelerated.I don't know how to avoid using "trigger_key_event". I am developing an FMC, which commands the autopilot heading to make the aircraft follow the route. The heading is calculated at each refresh (18 times a second) so that the aircraft follows the route accurately, and it is updated through a call to "trigger_key_event". Obviously, I have the problem explained above...Do you know any way of changing the autopilot heading value without using "trigger_key_event"?Do you know what is the minimum interval of time between 2 "triger_key_event" so that the acceleration doesn't start?Thanks for any help !!Eric

Share this post


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

Hi,In my FMC i use: (L:LNAV, bool) 1 == if{ (L:HDG,number) (>K:HEADING_BUG_SET) }(L:HDG,number) is a calculation: course from aircraft position to waypoint.Jan"Procul Negotiis"

Share this post


Link to post
Share on other sites

Eric,Don't know if you've "been there and done that" but my first thought would be a simple "if" statement:if heading <> course then KEY_HEADING_BUG_SET(course)If that doesn't work, then you may need to implement a counter or flag to ensure that heading hold is only reset every minute or so.The token variable CLOCK_MINUTE might work for this. Each time you reset the AP heading hold, set your flag equal to CLOCK_MINUTE. Only allow a change to heading hold if flag <> to CLOCK_MINUTE.Doug

Share this post


Link to post
Share on other sites

Yes, of course, I thought about this, but the problem is that the heading is updated very frequently. When the aircraft is on its route, this works perfect because the heading is almost constant. But when the aircraft is not on its route, it comes on its route smoothly, and this is a complex calculation. Every 1/10 second or so, a new target heading is calculated.I found another solution: using the ELAPSED_SECONDS timer, I trigger a key event 0.5 seconds after the previous trigger. This avoids fooling the acceleration system, but unofrtunately, the heading calculation is not as accurate as before.Thanks for your help !!Eric

Share this post


Link to post
Share on other sites

ALWAYS use SET events instead of INC/DEC eventsAnd you will not be affected by control acceleration at all

Share this post


Link to post
Share on other sites

Thanks for the hint, but I think you're wrong. I have always used HEADING_BUG_SET and and HEADING_BUG_INC/DEC, and the problem of acceleration still occurs.Eric

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