Jump to content
The simFlight Network Forums

Accessing Fenix A320 radio frequencies via external script (LVARs / HVARs / SimConnect?)


Recommended Posts

Posted (edited)

Hi everyone,

I’m currently working on a small external script for the Fenix A320 and I’m trying to control the COM/NAV radio frequencies programmatically — not via a hardware peripheral like the Logitech Radio Panel, but purely through software.

I already contacted Fenix Support, but didn’t receive further information on this, so I thought I’d ask the community:

My question:
Which variables (LVARs, HVARs, or SimConnect events) are used to control the radio frequencies in the Fenix A320?

In other words — is there a way to change the active or standby frequency via script, or to simulate knob rotations on the radio panels externally?

I’m not looking to read data from a device, but to send the relevant variable updates myself (for example, through a Python or C# SimConnect script).

If anyone knows the variable names or how to interact with these radios from outside the sim, I’d really appreciate your help!

Thanks in advance,
trayced

Edited by trayced
Appearance issue
Posted

First, I presume this is with using MSFS2020 / MSFS2024, so I have moved it to the appropriate forum.

16 hours ago, trayced said:

Which variables (LVARs, HVARs, or SimConnect events) are used to control the radio frequencies in the Fenix A320?

I don't have the fenix, but looking at the avionics presets in HubHop (https://hubhop.mobiflight.com/presets/?vendor=FenixSim&system=Avionics) it looks like lvars are used for most of the buttons. I don't know if the standard FS controls (Simconnect events)  to set the frequencies will work, but I suspect they would (they work in most aircraft to set the frequencies).

16 hours ago, trayced said:

I’m not looking to read data from a device, but to send the relevant variable updates myself (for example, through a Python or C# SimConnect script).

If anyone knows the variable names or how to interact with these radios from outside the sim, I’d really appreciate your help!

If you don't want to use the SimConnect SDK, you can use one of the FSUIPC SDKs to do this (and the WASM with the WAPI for lvar/hvar access). The C# library is the most advanced and also integrates with the WASM / WAPI- see Paul' Henty's .Net dll client sub-forum: https://forum.simflight.com/forum/167-fsuipc-client-dll-for-net/

A Python wrapper is also available - see the FSUIPC SDK folder (i.e. install FSUIPC7 and look in the SDK folder).

John

Posted (edited)

Thanks a lot for the detailed reply!

Yes, I’m using MSFS 2020, and I already tried the standard SimConnect events (like COM_RADIO_SET, COM_STBY_RADIO_SET, etc.) — unfortunately, none of them work with the Fenix A320. It seems those are completely disconnected from the internal radio logic.

I also haven’t been able to find any LVARs or HVARs related to the COM/NAV frequencies or the rotary knobs so far, but I’ll take a look at the HubHop database you linked to and see if anything shows up there.

Thanks again for the pointers!

trayced

Edited by trayced
Appearance issue
Posted

For COM frequencies, you can use FenixQuartz (https://github.com/Fragtality/FenixQuartz) which provides the lvars  "FNX2PLD_com1Active", "FNX2PLD_com1Standby", "FNX2PLD_com2Active" and "FNX2PLD_com2Standby" - although these may be read-only. This post indicates that these hold the correct values in MSFS2020, but not in MSFS2024: 

The OP of that topic also indicated that he has found a way without using FenixQuartz - I have asked if he can provide any further information on this.

John

 

 

Posted

Thanks!

Yes, I’ve already managed to get the COM frequencies through MobiFlight – the values show up correctly there when I use the corresponding LVARs (for example, L:N_PED_RMP1_ACTIVE).

The issue is now that MobiFlight can only send those values to physical hardware devices (like an LCD, LED, or servo), but not back to an external script or program.

What I’m trying to do is make those same values available as variables in my Python script, without using any actual hardware.

Do you know if there’s any way to read the MobiFlight output values directly (e.g. from memory, logs, or via a virtual device), or if FenixQuartz could be used to expose them in a way that Python could access?

trayced

Posted
2 hours ago, trayced said:

Do you know if there’s any way to read the MobiFlight output values directly (e.g. from memory, logs, or via a virtual device), or if FenixQuartz could be used to expose them in a way that Python could access?

No, I do nut use or support MobiFlight. If you are using MobiFlight, try MobiFlight support (via their discord server).

If they are standard lvars, you can also use FSUIPC to read/write these, and use the python wrapper of the FSUIPC SDK.
However, the python wrapper is quite old and will not use the WAPI/WASM, which is the API that I provide to access lvars. You will therefore only be able to access lvars via FSUIPC offsets, which means that you would need to add the lvars you want to use to spare/free FSUIPC offsets before they can be read/updated. 

John

Posted

Alright, thank you. 
I will take a look at FSUIPC. 
Is there any documentation or tutorial for adding those offsets and using the python wrapper?

I couldn’t find anything regarding this issue.

trayced

Posted
2 minutes ago, trayced said:

Is there any documentation or tutorial for adding those offsets and using the python wrapper?

To add lvars to offsets, see the Advanced User guide, page 47.

The Python wrapper around the FSUIPC was provided as a user contribution, and as such comes as-is and I cannot support this.
In fact, it is quite old now and may need updating to be compatible with MSFS2020/MSFS2024, as otherwise it may not recognise the FS version. It may work as-is - I just don't know as I have not used this wrapper. I have attached the README.txt.

John

README.txt

 

  • Like 1
Posted

Axis and Ohs has a StreamDeck Plugin for setting Frequencies ... it uses a own variable (to "collect" all numbers and thereafter send this custom variable as a freq to the respective COM by use of RPN..) im using this for years.

And the idea crating a variable and send it to the COM might be an idea as well for your purpose

Added how it looks (customized by myself)

image.png.e853f56b04f96e7622d6be0cc4737174.png

Example to Set COM1 Active

Dial your Freq, e.g. 123.150 will be the Variable1 (String) 

On 'Button down' e.g. 'COM1 Active' this RPN will be executed [The current active COM1 will be SET to COM1 STBY (to switch back) and the Variable1 will be set as Active]

(L:Variable1, String) stod 1000000 * (>K:COM_STBY_RADIO_SET_HZ) '' (>L:Variable1, String) 1 (>K:FENIX_A3XX_MY-SWAP)

 

 

 

Posted
16 hours ago, EisernUnion said:

Example to Set COM1 Active

Dial your Freq, e.g. 123.150 will be the Variable1 (String) 

On 'Button down' e.g. 'COM1 Active' this RPN will be executed [The current active COM1 will be SET to COM1 STBY (to switch back) and the Variable1 will be set as Active]

(L:Variable1, String) stod 1000000 * (>K:COM_STBY_RADIO_SET_HZ) '' (>L:Variable1, String) 1 (>K:FENIX_A3XX_MY-SWAP)

Thanks. Thats interesting, and would seem to indicate that the COM_STBY_RADIO_SET_HZ works (and possibly COM_RADIO_SET_HZ for active), at least when using calculator code. The FENIX_A3XX_MY-SWAP k-event looks strange though - this must be a custom event for the Fenix (I have not seen a custom event like this before!). Not sure why those double quotes are there (and only one), and why the Variable1 lvar is being updated ('(>L:Variable1, String)')  or why FENIX_A3XX_MY-SWAP is taking two parameters...

John

Posted
8 hours ago, John Dowson said:

Thanks. Thats interesting, and would seem to indicate that the COM_STBY_RADIO_SET_HZ works (and possibly COM_RADIO_SET_HZ for active), at least when using calculator code. The FENIX_A3XX_MY-SWAP k-event looks strange though - this must be a custom event for the Fenix (I have not seen a custom event like this before!). Not sure why those double quotes are there (and only one), and why the Variable1 lvar is being updated ('(>L:Variable1, String)')  or why FENIX_A3XX_MY-SWAP is taking two parameters...

John

Its a 'S:' Var

 

I cant really help as RNP will be a myth forever to me .. despite im coding, im so bad in logical, maths etc... so i takes me ages to understand them (after drawing them ;)'

And yes im sorry the MY-SWAP is just another RNP Script inside AAO as i had no idea how to write it inside the streamdeck profile or combine it to the rest of the key-down event ... as i said im bad on this 😉

 

MY-SWAP:

(L:S_PED_RMP1_XFER,·Number)·2·+·(>L:S_PED_RMP1_XFER,·Number)

 

Here are all RNP Codes used (they work for FENIX, i have no idea if they work on other aircraft as i fly fenix only)

- The custom var used inside the streamdeck plugin is called MyFreq ...

- when hitting the numbers, will be pre-stored on each of the 4 (COM1, COM2 Active | COM1, COM2 STBY) Buttons 

- Once on of them is pushed ("on button-down") the respective Code will be executed

Key-Down event on ...

COM1 ACTIVE

  • S: (L:MyFreq, String) stod 1000000 * (>K:COM_STBY_RADIO_SET_HZ) '' (>L:MyFreq, String) 1 (>K:FENIX_A3XX_MY-SWAP) 
  • Event Value: 1

COM1 STBY

  • S: (L:MyFreq, String) stod 1000000 * (>K:COM_STBY_RADIO_SET_HZ) '' (>L:MyFreq, String)
  • Event Value: 1

 

COM2 ACTIVE

  • S: (L:MyFreq, String) stod 1000000 * (>K:COM2_RADIO_SET_HZ) '' (>L:MyFreq, String)
  • Event Value: 1

COM2 STBY

  • S: (L:MyFreq, String) stod 100 * s0 '5' (L:MyFreq, String) schr 6 == if{ l0 0.1 - s0 } l0 dec2b16 (>K:COM2_STBY_RADIO_SET) '' (>L:MyFreq, String)
  • Event Value: 1

The Plugin Settings look like this

image.png.d0c98e55d57498d2e8f707153a59d190.png

 

The middle Buttons

image.png.cf174c3327e58c3982afa1f3d5038222.png

are used to display the ACTIVE (green) and STBY (orange) Freq on the respective COM. Key-Down event is swapping them

SWAP COM1

  • S: (>K:FENIX_A3XX_MY-SWAP)

SWAP COM2

  • K: COM2_RADIO_SWAP

 

 

Here is a short clip when using it

 

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.