Jump to content
The simFlight Network Forums

WASM LVARS TO OFFSET BASIC GUIDE


AlMassimo

Recommended Posts

There is (at least) one thing that I was not able to make to work, and is the myevents.txt HVAR setting via 262144 control.

This is the content of myevents.txt file:

A320_Neo_PFD_BTN_LS_1#(>H:A320_Neo_PFD_BTN_LS_1)
A320_Neo_MFD_BTN_ARPT_1#(>H:A320_Neo_MFD_BTN_ARPT_1)

but if I call the event 262144 or the 262145 with 3110 control set, eg

Var 0229, name BTN_ARPT, Link FSUIPC_INOUT, Offset $A056, Length 1
{
    if &BTN_ARPT = 1
    {
       &FS_PAR = 1
       &FS_CONTROL = 262145
       &FS_CONTROL = DELAY 0 10
    }
}

I get the following error messages

205547 Exception 1 "ERROR", Ref 4769, Index param 2 on TransmitClientEvent, object=0, id=262144 (????), data=1
210813 Exception 1 "ERROR", Ref 4772, Index param 2 on TransmitClientEvent, object=0, id=262145 (????), data=1

It is not clear to me (even having read the advanced manual more than once) if the number of myevents is 262144 or if I have to add the lines number of the entire events.txt in FSUIPC7 folder. I tested also numbers that included those in events.txt but I god the same error...

Link to comment
Share on other sites

These are 2 images of my home cockpit, I have left the VC visible so to give an idea of the alignment between the displays of the cockpit (MCP-FCU, PFD, MFD, etc) and the VC ones.

I am also testing MobiFlight events (I had removed the MF wasm module from my community folder, but now I have restored it and I am currently using calculator code directly in MF assignments (custom events) and seems to work great.

EG I wrote some calculator code to control beacon and strobe lights with only one switch, just looking the code in events.txt and pasting some lines in the calculator code, it is really powerful, but I must check if there are some conflicts in events numbers, or with presets numbers, but so far all seems to work fine.

 

 

IMG_8633.JPG

IMG_8634.JPG

Link to comment
Share on other sites

17 hours ago, AlMassimo said:

I get the following error messages

205547 Exception 1 "ERROR", Ref 4769, Index param 2 on TransmitClientEvent, object=0, id=262144 (????), data=1
210813 Exception 1 "ERROR", Ref 4772, Index param 2 on TransmitClientEvent, object=0, id=262145 (????), data=1

It is not clear to me (even having read the advanced manual more than once) if the number of myevents is 262144 or if I have to add the lines number of the entire events.txt in FSUIPC7 folder. I tested also numbers that included those in events.txt but I god the same error...

That looks strange - it is trying to send as a normal control than as calculator code. I will look into this.
Why not try the new offset 0x7C50, where you can use the preset name directly?

I've attached the latest FSUIPC7 version that i will be releasing later today.

John

FSUIPC7.exe

Link to comment
Share on other sites

That sounds amazing!

How can I send a string with the name of the presets via an offset ? In LUA code this looks feasible, in SIOC much less...

I searched "FSUIPC7 and 0x7C50" but I found no match on the net. I hope this will be documented in the updated advanced user manual!

I'll test the new FSUIPC7.exe, and try to find out how this works.

Thanks!

 

Link to comment
Share on other sites

6 minutes ago, AlMassimo said:

I searched "FSUIPC7 and 0x7C50" but I found no match on the net. I hope this will be documented in the updated advanced user manual!

I will be updating the documentation today. I did provide instructions in a post earlier in this thread, where I attached the beta for this functionality - check that. Not sure how you would write strings to that offset from SIOC though...

Checked writing a preset control number to 0x3110 and this is no longer working. I will look into it.

John

Link to comment
Share on other sites

18 hours ago, AlMassimo said:

There is (at least) one thing that I was not able to make to work, and is the myevents.txt HVAR setting via 262144 control.

This is the content of myevents.txt file:

A320_Neo_PFD_BTN_LS_1#(>H:A320_Neo_PFD_BTN_LS_1)
A320_Neo_MFD_BTN_ARPT_1#(>H:A320_Neo_MFD_BTN_ARPT_1)

but if I call the event 262144 or the 262145 with 3110 control set, eg

Sorry, the control number is wrong. The first control will be 0x400000 and not 0x40000, so the first one will be 4194304 (and not 262144). Of course, if you also install the events.txt file then that control will be the first preset in that file, and it will be difficult to determine the control number for your own presets (which is why I suggest you don't use that file!).

John

Link to comment
Share on other sites

Hi John, I am activating and setting up the new version, and studying the new manual, seems very well done.

In the manual the location of the FSUIPC_WASM.ini for MS-Store users, is indicated as

AppData\Local\Packages\Microsoft.FlightSimulator_8wekyb3d8bbwe\LocalState\Packages\fsuipc-lvar-
module\work

but (at least in my case) it is

LocalCache\Packages\Community\fsuipc-lvar-module\FSUIPC_WASM.ini

I have no ini file in the LocalState\Packages\fsuipc-lvar-module\work folder

Link to comment
Share on other sites

1 hour ago, AlMassimo said:

In the manual the location of the FSUIPC_WASM.ini for MS-Store users, is indicated as

AppData\Local\Packages\Microsoft.FlightSimulator_8wekyb3d8bbwe\LocalState\Packages\fsuipc-lvar-
module\work

but (at least in my case) it is

LocalCache\Packages\Community\fsuipc-lvar-module\FSUIPC_WASM.ini

Please read the manual more carefully...it does first say:

Quote

These are named FSUIPC_WASM.ini and can be located:
1. In the WASM folder, under your
Community/fsuipc-lvar-module folder

That is the one that is installed. If you change the settings there, they will be over-written the next time you install FSUIPC7 (i.e. on the next release/update). To prevent this, you should use the second location. Also, as the manual states:

Quote

Parameters found in location 2 (WASM persistent storage) will take president and overwrite any parameters found in
the first location. A default ini file is installed with the WASM and can be found in location 1. It is recommended to
leave this file as is, and copy to your persistent storage area and modify as and when needed from there.

 

1 hour ago, AlMassimo said:

I have no ini file in the LocalState\Packages\fsuipc-lvar-module\work folder

That is because you have not created one, or made a copy of the original in that location. You only need to do this if changing any settings that you want to stay on an update.

This should be clear from the documentation...

John

Link to comment
Share on other sites

Hi John,

the new version, with numbers corrected to 4194304 + line number of the preset required works absolutely well, and this is such a powerful thing!

This opens huge persepectives in SIOC, since I no longer need to interact with LUA code to set hvar, send controls, modify lvars, and also create combinations of operations, conditional operations, math, conversion, all that can be done with calculator code. Great, great job, well done!

The assessment of the line number was difficult though, because the editor give me the line number, but then all the comment lines have to be removed or subtracted to obtain the proper number. As you said, this could be avoided using only myevents.txt and inserting in it all the presets I need.

So your suggestion is (very sorry to ask again...)

1) copy and paste all the events I need into myevents.txt

2) remove or rename events.txt (only the one in FSUIPC7 folder, not the one in MF Wasm module in community folder ?)

3) change all the preset numbers I used in SIOC according to the order in myevents.txt

As an alternative I could

1) write LUA code to use the presets using 7C50 and preset names, activating them through a "bridge" custom offset sent by SIOC - this should not require the deletion of events.txt

The code should be, eg

ipc.writeSTR(0x7C50, “P:A32NX_EFIS_L_CSTR_PUSH”)

I'll do some testing, in order to solve some of my doubts by myself, without you having to correct all my mistakes...!

What I want to tell you is that these new functionalities are adding a lot of power to FSUIPC7 and make interacting with MSFS2020 an amazing and exciting experience!

 

Link to comment
Share on other sites

Next days I'll do more experiment with removing events.txt and using only myevents.txt.

In the file events.txt that probably installing the new release of FSUIPC7 has overwritten my current events.txt there is an error, the preset

A32NX_ENG1_MASTER_SWITCH_OFF#2 (>K:FUELSYSTEM_VALVE_CLOSE)

should be

A32NX_ENG2_MASTER_SWITCH_OFF#2 (>K:FUELSYSTEM_VALVE_CLOSE)

so the assignment I did to the fuel cutoff lever 2 was broken (automatically removed from that button)
Now I have modified again manually the wrong name of the preset and reassigned it to fuel cutoff lever 2.

By using myevents.txt this kind of problem would be avoided, so I'll try to transfer all my needed presets to myevents.txt and test everything again.

 

Link to comment
Share on other sites

11 hours ago, AlMassimo said:

So your suggestion is (very sorry to ask again...)

1) copy and paste all the events I need into myevents.txt

2) remove or rename events.txt (only the one in FSUIPC7 folder, not the one in MF Wasm module in community folder ?)

3) change all the preset numbers I used in SIOC according to the order in myevents.txt

Yes to all. You can also add comments to your myevents.txt with the control number to be used for offset 0x3110.

9 hours ago, AlMassimo said:

In the file events.txt that probably installing the new release of FSUIPC7 has overwritten my current events.txt

Yes, this file will be installed and overwrite the existing file each time you update, which is why its better to use the myevents.txt file. You can also uncheck the option to install that file (in the installer).

 

11 hours ago, AlMassimo said:

As an alternative I could

1) write LUA code to use the presets using 7C50 and preset names, activating them through a "bridge" custom offset sent by SIOC - this should not require the deletion of events.txt

Yes, you can also do that.

 

Link to comment
Share on other sites

All functions transferred to myevents.txt, no longer need for .lua program, all presets are now called from SIOC using offset 4194304 + number of preset, starting from 0 and easilly calculated by the row number in my editor (NotePad).

Some controls (or events) are activated using the A32NX.evt file (FCU controls), other use lvars defined in FSUIPC7.ini

All the functions controlled by Arduino boards are activated directly with MobiFlight Wasm commands.

All seems reasonably clear now, but it took me some weeks to understand how the new functions and variables worked, and it would have been very hard without the patient and always stimulating help from John Dowson!

I think FBW A320 is an extremely good project, I must only say that I am a bit confused by the many different variables and presets called A320_Neo, A32NX, A32NX_dev, A32NX_sdk... I use FBW A320 latest stable release (not dev) but many variables or presets are only available under "dev" group, but they work quietly with my stable version.

Anyway, I recommend to follow John's advice to avoid using events.txt (i changed the extension) and copy and paste all the presets you need in myevents.txt, this way you only have the presets you need, the numbering is easy to find and you have total control over this file (it is not modified or overwritten during updates).

The power of these new functions is extraordinary and give an almost complete control over all of the planes functions.

I hope that these posts will help other simmers to experiment all this beautiful set of tools, it's really worth the effort.

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

latest news

I added "master warning" and "master caution" annunciator and reset button, always with 737 NG hardware but A320 logic and LVARS.

Initially I tried to use directly Mobiflight, but setting 0(>L:32NX_MASTER_WARNING) or 0(>L:A32NX_MASTER_CAUTION) seemed not to work. So I used FSUIPC, adding the LVARS in FSUIPC7.ini

31=A32NX_MASTER_WARNING=UBA027
32=A32NX_MASTER_CAUTION=UBA028

And then I used some "bridge" offsets (UBA106, UBA107) to read the button from Mobiflight and write the status of the annunciator to Mobifligth.

This is the code in SIOC (but I think the same can be done adding events in myevents.txt and then calling them appropriately)

// ---  MASTER CAUTION / MASTER WARNING

Var 0525, name ann_mast_warn, Link FSUIPC_INOUT, Offset $A106, Length 1

Var 0526, name FS_m_caution, Link FSUIPC_INOUT, Offset $A028, Length 1
{
     C0 = &FS_m_warn = 0
     C1 = &FS_m_caution = 0
     IF C0 AND C1
       {
          &ann_mast_warn = 0
       }
     ELSE
       {
          &ann_mast_warn = 1
       }
}

Var 0527, name FS_m_warn, Link FSUIPC_INOUT, Offset $A027, Length 1
{
     C0 = &FS_m_warn = 0
     C1 = &FS_m_caution = 0
     IF C0 AND C1
       {
          &ann_mast_warn = 0
       }
     ELSE
       {
          &ann_mast_warn = 1
       }
}

Var 0528, name btn_mast_warn, Link FSUIPC_INOUT, Offset $A107, Length 1
{
    IF &btn_mast_warn = 1
    {
        &FS_m_caution = 0
        &FS_m_warn = 0
    }
}

I had to put the two annunciators (Warning and Caution) together since I have only one button in my 737 cockpit, and the same for the annunciator, but all worked perfectly. The logic is : if both warning and caution are off then turn off the annunciator, if one of the two is ON then the annunciator is ON.

If the button is pressed then both warnings are set to 0 and this quit the alarm and turn off the annunciators.

Another little step but very useful!

 

 

Link to comment
Share on other sites

Today subject is APU controls.

Since I have a B737 cockpit and overhead, I don't have push buttons but switches, and I also have the APU EGT gauge based on a stepper motor (in this case I used a X27-168 with the Easydriver (e.g. TECNOIOT A3967 EasyDriver Stepper Motor Driver V44) that is controlled directly by MobiFlight using the L:A32NX_APU_N instead of EGT, because it is more smooth and gives a better idea of the APU startup.

So I assigned these offsets to the relevant LVARS:

19=A32NX_OVHD_APU_MASTER_SW_PB_IS_ON=UBA013
20=A32NX_OVHD_APU_START_PB_IS_AVAILABLE=UBA014
21=A32NX_OVHD_APU_START_PB_IS_ON=UBA015
22=A32NX_OVHD_ELEC_APU_GEN_PB_IS_ON=UBA016

And then I used SIOC (but the same could be done with LUA as well) to control the operations of the APU :

// APU ==================================

Var 0475, name APU_master_ON, Link FSUIPC_INOUT, Offset $A013, Length 1 // this is the master APU button

Var 0476, name FS_APU_avail, Link FSUIPC_INOUT, Offset $A014, Length 1 // this is the flag from MSFS that the APU is available
{
     IF &FS_APU_avail = 1
       {
          IF &sw_APU_gen = 0
          {
              &APU_gen_OFFB = 1  // turn on the led on the annunciator APU GEN OFF BUS (737 overhead...)
          }
       }
       ELSE
       {
           &APU_gen_OFFB = 0 
       }     
}

Var 0477, name APU_start_ON, Link FSUIPC_INOUT, Offset $A015, Length 1  // this controls the startup of the APU

Var 0481, name sw_APU_start, Link FSUIPC_INOUT, Offset $A109, Length 1  // this is the phisical swithc "APU START"
{
   IF &sw_APU_start = 1
   {
       &APU_master_ON = 1    // these 2 variables actually make the APU to start. Both must be set to 1 to start
       &APU_start_ON = 1
   }
}

Var 0482, name sw_APU_off, Link FSUIPC_INOUT, Offset $A10A, Length 1
{
   IF &sw_APU_off = 1
   {
       &APU_master_ON = 0   // this is not immediate. Sometimes it takes a lot for the APU to stop
       &APU_start_ON = 0
   }
}

Var 0483, name FS_APU_gen, Link FSUIPC_INOUT, Offset $A016, Length 1   // APU generator status in MSFS

Var 0484, name APU_gen_OFFB, Link FSUIPC_INOUT, Offset $A102, Length 1   // phisical annunciator "APU GEN OFF BUS"

Var 0485, name sw_APU_gen, Link FSUIPC_INOUT, Offset $A103, Length 1
{
   IF &sw_APU_gen = 1
   {
     IF &FS_APU_avail = 1
       {
          IF &FS_APU_gen = 0  // since the command is a toggle, I want to send it only if the generator is not operating
          {
             &FS_PAR = 1
             &FS_CONTROL =  66707 //  APU_GENERATOR_SWITCH_SET
             &FS_CONTROL = DELAY 0 10
          }
          &APU_gen_OFFB = 0
       }
    }
   ELSE
   {
      IF &FS_APU_gen = 1  // same as above, if the generator is ON then TOGGLE it off
         {
             &FS_PAR = 0
             &FS_CONTROL =  66707 //  APU_GENERATOR_SWITCH_SET
             &FS_CONTROL = DELAY 0 10
         }
     IF &FS_APU_avail = 1
       {
          &APU_gen_OFFB = 1
       }
       ELSE
       {
          &APU_gen_OFFB = 0   // when APU is not running, the annunciator APU GEN OFF BUS turns off
       }
    }
}

This simple code allow complete control over the APU start, stop and APU gen ON/OFF and status led

I enclose the the schematic image of how to connect an X27-168 to Arduino, but if you are interested you can find an exhaustive guide here: https://www.mobiflight.com/en/tutorials/community-guides/easy-driver-tutorial.html

 

 

X27-168 connection diagram.png

Link to comment
Share on other sites

21 minutes ago, AlMassimo said:

Today subject is APU controls.

This is the support forum.  I appreciate you are trying to help others, but the place for that is the User Contributions forum. Please post there, with a suitable title for your posts. I am sure people will find them useful, but they will get little, if any, attention, on the third page of this ongoing topic... 

I am closing this topic now.

John

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • 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.