Jump to content
The simFlight Network Forums

Disable all controller input whilst in autopilot


Adamski

Recommended Posts

Is there a way (in MSFS/FSUIPC) to disable all flight controls input when the autopilot is engaged?

I spend a lot of time screenshotting (in external views) and often move the controller when panning/zooming.

I know there's an option to disconnect the elevator TRIM axis for A/P mode - and wondered it could be possible to add similar options for the primary controls.

Link to comment
Share on other sites

8 hours ago, Adamski said:

I know there's an option to disconnect the elevator TRIM axis for A/P mode - and wondered it could be possible to add similar options for the primary controls.

Please see offset 0x310A in the FSUIPC7 Offset status document (although some of the bit numbers seem to be missing, which I will correct):

Controls the joystick connection to the main flight controls.
Normally all zero, set the following bits to actually
disconnect the specific joystick axes (from least significant
bit = 0):
    0 Elevator
    1 Aileron
    2 Rudder
    3 Throttles (all).
    4 See below (throttle sync control)
    5 Elevator trim
    6 Throttle #1
    7 Throttle #2 (see next byte for others)
This feature is intended for use in protecting autopilot flight
from interference from axis flutter. In order to protect the
user from a broken or crashed application, all the flags are
cleared 10 seconds after they have been set, so
applications will need to repeat the setting every few
seconds.
...

John

Link to comment
Share on other sites

  • 2 weeks later...

Fantastic!!! I just set 0x310A to 255 when the autopilot (0x07BC) is set. This effectively disables the lot 🙂

Now I can pan around and customise my views for screenshots without upsetting things!

Thanks again!

Link to comment
Share on other sites

OK - so far so good!

With the FBW A32NX and X56 Throttle, I get an annoying "throttle creep" that often takes me out of the detent (regardless of how I set the friction).

I thought this newly created "freeze controls" LUA would cure that - but the offset for the FBW A/P must be something else. Does anyone happen to know what it might be? I'll ask in the FBW channels as well.

 

Link to comment
Share on other sites

9 hours ago, Adamski said:

but the offset for the FBW A/P must be something else.

To determine if the AP is set in the FBW A320 (dev version), you should use the lvars L:A32NX_AUTOPILOT_1_ACTIVE and L:A32NX_AUTOPILOT_2_ACTIVE.
If you want them in offsets, you can add to a free (for general use) offset area using the lvars-to-offsets functionality. Check the Advanced User guide for details on how to achieve this.

John

Link to comment
Share on other sites

Thanks, John! I found those two Lvars earlier, but after a fair bit of Googling and reading, I couldn't find a way of reading the Lvar value.

Bear in mind that this is my first foray into LUA programming and (at this stage) understanding the docs is a bit of a struggle!!! I've used FSUIPC for donkeys' years but have never need to "look under the hood" before! The functionality is mind boggling!

I tried enabling WASM but all the options were greyed out - and my test script still couldn't serve up a value. I'm obviously missing a few steps, so will re-visit those [advanced] docs!!!

Link to comment
Share on other sites

4 minutes ago, Adamski said:

Bear in mind that this is my first foray into LUA programming and (at this stage) understanding the docs is a bit of a struggle!!!

Understood, but you don't need lua to add lvars to offsets, just a section in your FSUIPC7.ini file. It should be quite straight forward...

5 minutes ago, Adamski said:

I tried enabling WASM but all the options were greyed out

The options are not available until you have an aircraft loaded and ready to fly (i.e. not when MSFS is in the main menu).

John

Link to comment
Share on other sites

The aircraft was loaded and ready. It turns out a PC/MSFS reboot got that going 🙂

*However* I now have another problem. When I list the LVARS (in WASM - now working, thank you!) ... I get a long list - but can't scroll it in any way, so can't get to see the actual LVARS I need (!!). I tried resizing the window etc. but to no avail. This was Win10x64 + all latest .net (as far as I know).

In the meantime, I'll try the .ini method!

Link to comment
Share on other sites

9 hours ago, Adamski said:

*However* I now have another problem. When I list the LVARS (in WASM - now working, thank you!) ... I get a long list - but can't scroll it in any way, so can't get to see the actual LVARS I need (!!). I tried resizing the window etc. but to no avail. This was Win10x64 + all latest .net (as far as I know).

This is a know issue with the current release, and will be fixed in the next release. You can see the full list in the FSUIPC7.log file, or there is a beta version with this fixed (where it was initially reported) in this topic: 

John

 

Link to comment
Share on other sites

Thanks again, John. Luckily, the next time I ran it, the LVAR in question was near the top - and updating nicely.

Still having fun getting the script to work though LOL!

UPDATE: Good News!!! I have the script working! I added the LVAR to the .ini file and pointed it to a user offset. Yippee!

Link to comment
Share on other sites

  • 2 weeks later...

Firstly - thanks, John, for fixing the LVARS scroll problem!!!

Now ... I'm thinking of allowing people to download my script(s) but I'm wondering if I could prevail on anyone here to run through what I've done to see if there are any "gotchas" <?>.

The archive is (temporarily) at:
https://www.nzfsim.org/?smd_process_download=1&download_id=3241

Here's a copy of the README that goes with it (should I just paste the Lua files here as well?):

Autopilot Freeze - FSUIPC LUA Scripts
====================================================

I have an X-56 stick/throttle combo and often find that when panning around in external view (taking screenshots) I can't
help moving the stick slightly - disturbing (or even de-activating) the autopilot.

Also - my X-56 suffers from [the dreaded] "throttle creep", which is particularly bothersome with the FBW A32NX when it
drifts out of one of the detents.

These scripts are an attempt to lock/disable all flight controls (including throttle) when the autopilot is active.

1) AP_Freeze_ON
=======================
Checks to see which A/P is enabled (GEN or FBW).
If either is enabled, all controls axes are disabled (Offset 0x310A set to 255).

2) AP_Freeze_OFF
=======================
Resets/enables all controls axes (Offset 0x310A set to 0).

The scripts are mapped to separate switches on the throttle base, using the FSUIPC "Button & Switch Assignments":

BUTTON 1 (toggles freeze to ON):
Control sent when button pressed:  Lua AP Freeze On
Control sent when button released: Lua Kill AP Freeze OFF

BUTTON 2 (toggles freeze to OFF):
Control sent when button pressed:  Lua AP Freeze OFF
Control sent when button released: Lua Kill AP Freeze On

IMPORTANT:
=============
For FSUIPC to be able to read the status of the FBW autopilot, the following two lines need to be added - either to
fsuipc.ini or (if using profiles) to your FBW profile.
Make backups of the original files!

[LvarOffsets]
1=A32NX_AUTOPILOT_1_ACTIVE=UB0x66C0

DISCLAIMER
=============
This is my first ever foray into LUA programming (!), so these scripts may be far from perfect - please use at your own risk!

CREDITS
=============
1) John Dowson for his patience.
2) Jason Fayre (the original author of the MyDisplay.lua script that was a starting point for mine.
3) Pete Dowson for the original FSUIPC. I can't imagine running any sim without it.

=======================================================================
Adamski_NZ
www.nzfsim.org
19 April 2022

 

Link to comment
Share on other sites

On 4/19/2022 at 5:48 AM, Adamski said:

Here's a copy of the README that goes with it (should I just paste the Lua files here as well?):

Best to create a new post/topic in the User Contributions section (with an appropriate title.

On 4/19/2022 at 5:48 AM, Adamski said:

I'm wondering if I could prevail on anyone here to run through what I've done to see if there are any "gotchas" <?>.

Looks ok to me. One thing you should be aware of (and maybe update your comments on this in the lua file) is the size and positioning if the wnd window being displayed. The size/position you provide in the wnd.open call will only be used the first time the script is ran, so if you change these after the first run the new size/position will be ignored, as this will be taken from the [ExtWindow] section of the FSUIPC7.ini. The size/position can be changed there, or you can use the arrow keys to move the wnd window (when it has the focus) and the ctrl+arrow keys to resize.

John

Link to comment
Share on other sites

Thanks, John! I created a new topic  in User Contributions:

As to the window sizing, I opted to use a FIXED window as it's less obtrusive - and added instructions on how to resize/move it in the readme 🙂

Thanks again!

Adam.

 

Link to comment
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
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.