Jump to content
The simFlight Network Forums

Recommended Posts

Posted (edited)

                  *** Moved to FSUIPC7 support sub-forum ***

I have a Virpil Control Panel #2 controller. I want to assign an encoder (knob) to increase/decrease the brightness of the front instrument panel backlight of the SF50 VisionJet G2 (from Asobo) in MSFS2024. When assigning, I use the MobiFlight presets: SF50_Lights_Panel_1_Dec …/... Inc

From the events.txt file and save them in a separate profile file for this aircraft (this is clearer to me).

But for some reason this option with this assignment does not work.

Although when assigning another encoder to another preset for this aircraft: GARMIN_Perspective_Touch_GTC_2_LowerKnob_DEC/...INC – changing the scale on the MFD, everything works fine.

All presets are selected from the Preset for SF50 VisionJetG2 by FligtFX

 What am I doing wrong?

 

And the second question. I noticed that when using the control (knob) in the virtual cockpit of FS to change the instrument panel lighting, the input event SF50_LIGHTING_INSTRUMENT_LIGHTS is used.

Can it be used to bind the controller buttons (knob) to the lighting control?

Edited by John Dowson
Moved to FSUIPC7 support forum
Posted

Many presets for MSFS2020 aircraft won't work for the same aircraft in MSFS2024, and unfortunately there is no current way to know if they work or not except by testing. In MSFS2024, many functions have switched to use Input Events, or B vars, which are equivalent and can be used in preset calc code in MSFS2024 whereas it couldn't in MSFS2020.

Note that there are some MF presets that are specifically labeled for MSFS2024 aircraft, but there is no general mechanism yet to know if a preset is for MSFS2020, MSFS2024 or both. There have been some discussions on the MF forums on how to handle this, but i don't think anything has been decided yet. Once something has been implemented, I will updated FSUIPC7 to handle this - hopefully by only loading the presets flagged as working for the version being used.

41 minutes ago, Vitved said:

Can it be used to bind the controller buttons (knob) to the lighting control?

Yes. There are two ways of doing this. You need to determine the parameter values for the input event (you can use FSUIPC's Input Event logging for this), and you can then assign directly to the input event by checking the relevant checkbox and selecting the Input Event in the drop-down.

Alternatively, you could define a preset to trigger the B-var.

The following article shows how you can discover B-vars: https://www.badcasserole.com/uncovering-input-events-using-the-msfs2024-model-behavior-dialog/
That article also shows you how to use the b-var in MobiFlight, but for use in FSUIPC7 you would create a preset for the calc code in your myevents.txt file instead of configuring MF.

Note that using Input Events directly would be the preferred option. However, not all B-vars are mapped to the Input Event interface, and so if there is a B-var available but no corresponding Input Event you would have to use the b-var via calc. code or a preset.

John

Posted

Thank you very much for the quick reply.

This is very valuable information. And I will definitely try both options.

Posted

Dear John,

Thank you so much for your help and aiming in this matter.

I did it and it works.  I applied the second option with preset and writing a script for myevents.txt (attached) because FSUIPS receives only one input event: SF50_Lighting_instrument_Lights, with which nothing can be done, you can assign the buttons for SF50_Lighting_instrument_Lights_Set, _Dec, _Inc input events.

It’s a great solution, and most importantly universal and, in my opinion, beautiful.

Thank you.

myevents.txt

Posted

So, these are your presets:

Quote

//Asobo/Cirrus SF50 Vision Jet  (MSFS2024)/Lights

SF50_LIGHTING_INSTRUMENT_LIGHTS_INC#(B:SF50_LIGHTING_INSTRUMENT_LIGHTS_Inc) 5 + 0 max 100 min s0 (>B:SF50_LIGHTING_INSTRUMENT_LIGHTS_Set)
SF50_LIGHTING_INSTRUMENT_LIGHTS_DEC#(B:SF50_LIGHTING_INSTRUMENT_LIGHTS_Dec) 5 - 0 max 100 min s0 (>B:SF50_LIGHTING_INSTRUMENT_LIGHTS_Set)

To be honest, that looks overly complicated to me...! It does work, but I am not sure why...the *_INC and *_DEC B:vars must both just return the value of SF50_LIGHTING_INSTRUMENT_LIGHTS for that to work.... 

I would set this up this way:

1. Add the Input Event SF50_LIGHTING_INSTRUMENT_LIGHTS to a  free/spare FSUIPC offset. You do this by adding an [InputEventOffsets] or [InputEventOffsets.xxx] section (where xxx is a profile name) to your FSUIPC7.ini file, or a [InputEventOffsets] section to your profile ini file (when using profiles-in-separate-files). e.g.

Quote

[InputEventOffsets]
1=I:SF50_LIGHTING_INSTRUMENT_LIGHTS=UW0xA040

That adds the input event to offset 0xA040 as a 2-byte int (unsigned word).

2. Assign your buttons to inc/dec that offset as follows:

image.png.a5230e69a820d141e93b1cc4214f8dcb.png

image.png.4ce063a5bfec4e31bacbd15576f2b585.png

Just another way of doing this, FYI. Doing it this way, you also always have access to the current value of the input event which can be useful in some circumstances (but probably not needed for this one).

Cheers,

John

Posted

John,

You are absolutely right about the difficulty of understanding RPN when writing preset code.

I just started learning how to use offsets when managing controls in the simulator.

Clarification, offsets are a kind of allocation of specific memory for changing the parameters of controls?

And what is the basis for allocating this memory?

But I will definitely try this method when assigning buttons in a suitable situation.

Posted
4 hours ago, Vitved said:

You are absolutely right about the difficulty of understanding RPN when writing preset code.

Yes, but the latest Asobo documentation on RPN is a vast improvement on what was previously available:  https://docs.flightsimulator.com/flighting/html/Additional_Information/Reverse_Polish_Notation.htm

4 hours ago, Vitved said:

Clarification, offsets are a kind of allocation of specific memory for changing the parameters of controls?

No... Offsets are a memory area that hold data and/or trigger functionality. Most offsets are already defined to hold various bits of data (mainly simvars and lvars) and you can read this (e.g. for display purposes) or write to them to trigger an update or an action. There are many free/spare offsets as well, which can be used to add further data not yet available (e.g. simvars, lvars or input events) fir both reading and writing, Please see the included Offset Status document for details on what is held in offsets and what thehy allow (read, write or both).

The example I gave above adds the value of the input event SF50_LIGHTING_INSTRUMENT_LIGHTS to an offset, so reading that offset will give you the current % of the instrument/panel lights, and if you write/update that offset this will update the input event and thus adjust the instrument lighting. The assignments increment/decrement that offset by a value of 5, so will inc/dec the lighting by 5% on each activation.

5 hours ago, Vitved said:

And what is the basis for allocating this memory?

This memory is pre-allocated and available for use. As I said, please see the FSUIPC7 Offset Status document,

Posted
19 hours ago, John Dowson said:

Please see the FSUIPC7 Offset Status document,

John, Thanks for the clarification. I'll definitely check out the documentation for Offset Status and try using them when assigning joystick buttons.

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.