Jump to content
The simFlight Network Forums

Recommended Posts

Posted

There are several ways to assign an axis to an lvar in FSUIPC7, but the easiest way is to use a preset.

First, you need to know:
    1. The name of the lvar that you want to control. You can list the lvars using Add-ons->WASM->List Lvars to see the available lvars.
    2. The value range of your axis. Most axes will gave the range -16384 to +16384, however some potentiometer axes may have a different
        range (e.g. 0-100). To verify the axis range, you can look at the IN value in the axis assignment panel when you move the axis.
    3. The value range that the lvar takes. To determine this, you can list the lvars to see the values. Move the axis you want to control in the
        Virtual Cockpit to one extreme, then list the lvars (Add-ons->WASM->List Lvars). Then move the axis to the other extreme and list again.
        This will give you the maximum and minimum values for the lvar.

Once you have to determined these three things, you can define your own preset in the myevents.txt file, located in your FSUIPC7 installation folder. Note that this file will not exist by default - you need to create this file.

The format of a preset definition is
        <preset name>#<calculator code>
where
    <preset name> is the name of the preset, the name that you will see in the assignment drop-down menus in FSUIPC
    <calculator code> is the calculator code that is sent to MSFS when you trigger the preset.

The calculator code to set an lvar is as follows:
      <value>(>L:<lvarName>, Number)

As the value will be coming from an axis, you should use a placeholder - either the @ symbol or the string $Param.
You will also need to convert the axis value to the lvar value range. You do this using RPN (Reverse Polish Notation) calculations in the preset.

As an example, lets define a preset for the A2A Comanche carb heat switch. The details for this are:
    1. Lvar name is Eng1_CarbHeatSwitch
    2. My axis range is -16384 to +16384.
    3. The lvar range is 0 to 100

A preset for this would be:

//A2A SIM/Comanche 250/Engine
MY_PA24_250_Carbheat_Axis#$Param 16384 + 327.68 / 0 max 100 min (>L:Eng1_CarbHeatSwitch, Number)

Breaking this down:
    - the first line, starting '//', is not just a comment, but is used to position the preset in the appropriate node in the tree view that you see
      when you click the Find Preset... button. This preset will be listed under Personal -> A2A SIM -> Comanche 250 -> Engine
    - the preset name (in the drop-down menus) will be My Pa24 250 Carbheat Axis
   
- the input axis value ($Param) will be calibrated by
            1. first adding 16384 to produce a value between 0 and 32768: $Param 16384 +
            
2. the result will then be divided by 327.68 to give a value between 0 and 100: 327.68 /
            3. the result will be constrained to a minimum of 0 (0 max) and a maximum of 100 (100 min)
            4. the resulting value will be used to set the lvar Eng1_CarbHeatSwitch

Another example is for the ATR condition lever:
    1. Lvar name is MSATR_CONDITION1_POS
    2. My axis range is -16384 to +16384
    3. The lvar range is 0 - 3 (i.e. 4 discrete positions)

A preset for this would be:

//Microsoft/ATR 42-600, ATR 72-600/Fuel
MSATR CONDITION1 LEVER SET#$Param 16384 + 10923 / near 0 max 3 min (>L:MSATR_CONDITION1_POS)

 

Once you have defined your preset, you can assign your axis to use the preset by selecting to assign using Send Preset to FS on the left hand side of the axes assignment panel.

Note also that presets are only loaded automatically when FSUIPC7 initializes. If you modify the myevents.txt file while FSUIPC7 is running, you can use the menu option File -> Reload Presets to reload the preset files.

For further information on using presets in FSUIPC7, please see the WASM section in the Advanced User guide.

For further details on RPN and calculator code, please see https://docs.flightsimulator.com/flighting/html/Additional_Information/Reverse_Polish_Notation.htm

  • John Dowson changed the title to FSUIPC7: how to assign an axis to control an lvar

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.