Home Cockpit Hardware, FBW A320NX or Fenix A320, SimConnect and wasm - some help needed

With a fresh mind, I have done my first MobiFlight experiments. And it worked from the first time! I connected a button to the BAT 2 switch, and an LED to the BAT 1 Off indicator. When I press the switch, a fraction of a second later, the LED goes on. And I didn’t use FSUIPC, but the new FS2020 events/variables.

And this allowed me to dig into some detail. Probably all known stuff for you @Pieter1982NL , but I explain what I found here, because it will definitely help some other newbie’s like me (who are getting frustrated not finding what they are looking for). In fact, I “reversed engineered” some stuff.

In MobiFlight, I configured a push button, and I connected it with an input using the “MSFS2020 - Events”. The BAT switch can be found in the “Electrical” section, where I found the event “OVHD_ELEC_BATTERY_2_TOGGLE”:

image

I read somewhere that the events are found in the “events.txt” file that can be found somewhere in the “community folder”. To get to that folder, I went in FS2020 [DevMode] / Tools / Virtual File System, and from there you can open the Community Folder.

image

There you will find the folder “mobiflight-event-module” in which you have a folder “Modules”, and there is the “events.txt”. Now I opened that text file and search for “OVHD_ELEC_BATTERY_2_TOGGLE”.

Under “//Fly By Wire/A320-Dev/Electrical” (which seems to be the Group), I find the above event:

OVHD_ELEC_BATTERY_2_TOGGLE#(L:A32NX_OVHD_ELEC_BAT_2_PB_IS_AUTO, Bool) if{ 0 (>L:A32NX_OVHD_ELEC_BAT_2_PB_IS_AUTO) } els{ 1 (>L:A32NX_OVHD_ELEC_BAT_2_PB_IS_AUTO) } (L:XMLVAR_Momentary_PUSH_OVHD_ELEC_BAT2_Pressed) ! (>L:XMLVAR_Momentary_PUSH_OVHD_ELEC_BAT2_Pressed)

If I’m not mistaken, when the above event is triggered in MobiFlight, the “commands” behind the “#”-sign are executed via the WASM and/or SimConnect module.

But how do we know what commands need to be executed? Well, we have to rely on the contributors that create the “events.txt” file (file is updated regularly). But you can find things yourself if you make use of the FS2020 [DevMode] / Windows / Behavior window. For me, most of that window is mystery, and very intimidating. But if you have the window open, you can hover over a button in the sim cockpit, and when the button turns blue, you can press “CTRL G”. This immediately finds the button (you don’t need to look in the sometimes “fuzzy” names). I did that for the BAT 2 button on the ELEC panel of the A320NX, and it finds “PUSH_OVHD_ELEC_BAT2”.

image

If you now scroll down in the window, at the bottom, you will find an entry “Mouserect”. If I understand it correctly, this defines what should happen when the button is clicked by the mouse. Again, I don’t know the details, but what I’m interested in is the part “Logger”. And this is where you find exactly the same commands that are shown in the “events.txt” file. BINGO!!!

3 Likes