How to update LocalVariables?


I’m building a multi-purpose panel from an Arduino and I’m facing an issue with the barometric selector when need to switch units (hPa or in Hg) on the A320Neo.
I found out that units are registered in a LocalVariable named Baro_Selector_HPA_1. Is there a way to update it with a C++ code?

I saw in Using LVARs (L:) with AxisAndOhs there is an software that can do it.

Thanks in advance.


Is there a way to update it with a C++ code?

Not from the outside and not with SimConnect. You need a WASM module running inside the simulator, and figure out a way to communicate with it. From WASM code (which is basically C++ too) you can access L and H vars.

AxisAndOhs provides an API based on Web technology. You can use XmlHttpRequests or JSONP to access all types of variables and events, including L: and H:

In this thread threre is a working demo of how to update LVARs via SimConnect.
In that thread you also find a link to another demo for reading/writing LVARs.

The basic concept is to create a WASM (in process) module which handles the LVAR access. Any out of process software can use SimConnect to communicate with that WASM module.

My software which beneath other functionalities binds my DIY A320 FCU and EFIS to MSFS is working in the way described above. My WASM is built in C++ (no other frameworks involved). My out of process SimConnect client is written in C#, using SimConnect to communicate with the WASM which is a SimConnect client itself.
Both in process and out of process parts use the same configuration wich is basically a list of LVARs to use. That way I can ensure that both parts do not differ concerning LVAR usage.


Thanks for the answers!

So if I understand well I need to create something inside the simulator. If I want to share my panel it’ll need the software and a plugin.

I know nothing about WASM but I’ll dig.


Until last week, I knew nothing about WASM at all. But that doesn’n matter. What you need to know (and what I know since the late '80s) is C++ as the WASM module is programmed in C++.

If you are not familiar with C++ I would excercise outside of MSFS since it is a real pain to start the sim over and over again just to load your just built WASM. When you are familiar with C++ it is no big deal to start with WASM as far as you use Visual Studio as there are project types for WASM modules.

In my case, I built a stand alone WASM module, i.e. the module is not being related to any aircraft.

However, there are working WASMs in the link I posted above. They are very good to start with as there you have a working sample.

Just note that the structure of community packages (and such is the WASM module) have to use a certain folder structure and must contain two JSON files, layout.json and manifest.json. In layout.json the size of the built WASM module is specified, so make sure to set this value whenever you have built the module. I use the MSFSLayoutGenerator to generate the appropriate entries in the file automatically and call that tool in my post build event.

1 Like

I am totaly new to this stuff. I built two button boxes controlling it with spadnext. it is working good so far
but i am missing events for A320 APU Master, APU Start, and a few more. Is it possible to get those local variables to spadnext?

Solved it with the Spadnext Beta and LVAR Modul

I have fsuicp7, how do I get the lvar in the dropdown list? Newbie