Skip to content
View in the app

A better way to browse. Learn more.

The AVSIM Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Adaptive key repeat causing AAO hang (enhancement request)

Featured Replies

Hey Lorby!

 

Discovered an issue when using "Adaptive" key repeat feature. Wondering your opinion on whether you think an enhancement is in order, or whether users should just be wary when using certain scripts.


I have a TM Warthog throttle which has a thumb switch for speedbrakes/spoiler. In the forward position (the position you'd use to close the spoilers), the switch physically holds itself forward.

 

When you use this script with "Adaptive" enabled:

(A:SPOILERS HANDLE POSITION, Number) 0.0 > if{ (A:SPOILERS HANDLE POSITION, Number) 0.1 - } els{ 0.0 } 32767 * -16384 + (>K:AXIS_SPOILER_SET)

...leaving the spoiler switch in the close position eventually results in the adaptive feature crashing AAO because it cascades requests at a extremely high rate and never stops. 

Would it be possible to have the "Adaptive" feature check whether the axis has reached its min/max and stop sending the requests to prevent crashing AAO? It also results in overloading MSFS with requests...took me a while to figure out what was going on.

Anyway, thanks for reading. Let me know if I didn't make sense.

 

 

 

Edited by jstnj

  • Commercial Member

You are causing an endless loop - there is not a lot that AAO can do about that. To avoid "out of range" errors, use the "min" and "max" RPN commands in your script. Your script has to handle range, AAO can't do it for you.

The core issue here is using repeat with a button that actually locks in place and never gets released. That IMHO is not how this should be used. There is no way to tell the repeat logic that it should stop at some point - it doesn't know what you are doing with it, nor does it care. There could be a million different use cases that would all require different criteria - in implementation and for the user to figure out. That is not an "enhancement", this is a massive effort in implmentation and later in handling. And it would still be possible to cause the same issue any other way.

IMO you should do this differently, for example with automated scripts. So that the button movement doesn't control the script itself, and you don't use repeat. Instead the button sets a local LVar to -1, 0 or +1 and that tells an automated script to either move the spoilers up or down or not at all. And when the script runs "out of range", you reset the LVar back to 0.

The automated script would looks something like this: (not tested, off the top of my head)

(L:SpoilerDir)·0·!=·if{·(A:SPOILERS·HANDLE·POSITION,·Number)·0.0·>·if{·(A:SPOILERS·HANDLE·POSITION,·Number)·(L:SpoilerDir)·10·/·+·}·els{·0.0·}·32767·*·-16384·+·0·min·16384·max·s0·(>K:AXIS_SPOILER_SET)·l0·0·==·l0·16384·==·or·if{·0·(>L:SpoilerDir)·}·}

Edited by Lorby_SI

LORBY-SI

  • Author
1 hour ago, Lorby_SI said:

You are causing an endless loop - there is not a lot that AAO can do about that. To avoid "out of range" errors, use the "min" and "max" RPN commands in your script. Your script has to handle range, AAO can't do it for you.

The core issue here is using repeat with a button that actually locks in place and never gets released. That IMHO is not how this should be used. There is no way to tell the repeat logic that it should stop at some point - it doesn't know what you are doing with it, nor does it care. There could be a million different use cases that would all require different criteria - in implementation and for the user to figure out. That is not an "enhancement", this is a massive effort in implmentation and later in handling. And it would still be possible to cause the same issue any other way.

IMO you should do this differently, for example with automated scripts. So that the button movement doesn't control the script itself, and you don't use repeat. Instead the button sets a local LVar to -1, 0 or +1 and that tells an automated script to either move the spoilers up or down or not at all. And when the script runs "out of range", you reset the LVar back to 0.

The automated script would looks something like this: (not tested, off the top of my head)

(L:SpoilerDir)·0·!=·if{·(A:SPOILERS·HANDLE·POSITION,·Number)·0.0·>·if{·(A:SPOILERS·HANDLE·POSITION,·Number)·(L:SpoilerDir)·10·/·+·}·els{·0.0·}·32767·*·-16384·+·0·min·16384·max·s0·(>K:AXIS_SPOILER_SET)·l0·0·==·l0·16384·==·or·if{·0·(>L:SpoilerDir)·}·}

Thank you sir! will give this a go. All of that makes sense to me.

  • Commercial Member

I may have another idea, but that is a code change too (so if it works, it will be in the next version of AAO). I will look into adding a "max repeat" parameter where you can set the maximum number of repeated actions that make sense for this button. After that it will just release itself. 

And I just realized that when using min and max you don't need to query the variable at all, because the code limits the value anyway.. So that if/els around the calculation of the value to set is unnecessary.

LORBY-SI

  • Author
On 4/6/2022 at 3:26 PM, Lorby_SI said:

AAO 2.29 will have a "limit" option. With that you can tell the app that the repeat should stop automatically after X actuations.

Thanks Lorby, responsive as always 👍

  • Commercial Member
9 hours ago, jstnj said:

Thanks Lorby, responsive as always 👍

If you want, send an email to the support address with your proof of purchase, then you can have the 2.29 to try it. That should solve your particular issue.

LORBY-SI

Archived

This topic is now archived and is closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.