Jump to content
The simFlight Network Forums

WASM LVARS TO OFFSET BASIC GUIDE


AlMassimo

Recommended Posts

11 minutes ago, AlMassimo said:

If it is an event it was not tracked by the events in console, i pressed repeatedly the button in the  VC but nothing was displayed under the console.

Only events available via SimConnect will be logged.

12 minutes ago, AlMassimo said:

Are the B and F type currently traceable somehow ?

No, not as far as I know, which is next to nothing about these new event types.

John

Link to comment
Share on other sites

Hi John

you were right, of course! variable L:BTN_TERRONND_ACTIVE was displayed in the list but I missed it. This is solved and works.

Coming to the variable AIRLINER_LS_Toggle I tested with 1 (>K:AIRLINER_LS_On) but it didn't work

I enclose a screenshot of the Behavior panel in developer mode with the variables highlighted and pinned.

Searching on the net I found this reference to "(>B:AIRLINER_LS_Toggle)" but I can't speak deutsch so I cannot understand what they say

It's a pity because all the efis controls are listed under the tab "airliner" in MSFS/Behavior/Events page.

 

Screenshot 1.jpg

Link to comment
Share on other sites

1 minute ago, AlMassimo said:

I enclose a screenshot of the Behavior panel in developer mode with the variables highlighted and pinned.

No point in doing that really - I can't read anything in that image due to the resolution.

2 minutes ago, AlMassimo said:

Searching on the net I found this reference to "(>B:AIRLINER_LS_Toggle)" but I can't speak deutsch so I cannot understand what they say

Then it sounds like its one of the new B type variables. Did you read the link I posted about these (https://devsupport.flightsimulator.com/questions/1859/b-input-events-and-the-simconnect-and-gauge-apis-f.html)? You can try to see if that works as calculator code, i.e.
           (>B:AIRLINER_LS_Toggle)
but I don't think it will work. That is what the post I referenced was talking about - no access to these new B-type variables at the moment either using SimConnect or WASM.

I will have to wait for further functionality (and, hopefully, some documentation) from Asobo before these can be used.

John 

Link to comment
Share on other sites

Yes, I read it and understood that it was not yet possible to handle these vars...

Fortunately at least terrain display is Ok.

Regarding the resolution of the image, I took it at 2560x1080 and didn't scale it down, if I click on it and use the "+" on magnifier glass it is shown at full resolution,

unless it is compressed during transmission to the forum. Sorry.

 

 

Link to comment
Share on other sites

I have tested all I could figure out about the use of the vars I found under developer mode / behavior / A320_Neo_interior / Airliners

but it's clear that MS/Asobo for the moment and despite all the requests I've seen on the net, seems not be going to release an update that allows

cockpit builders, hardware and software producers to control the B: F: and maybe also O: variables. I think I reached the maximum level possible of interaction with default A320 available at the moment, and the cockpit is performing quite well after all.

For the sake of study (and fun I hope) I will now switch to FBW A320, that seems to allow the use of all it's local and H: variables (besides giving a much wider functionality)

BUT apparently it causes a lot of CTD to my PC configuration/cockpit addons - with FBW removed from community folder I'm having almost no CTD

even using extensively FSUIPC, Mobiflight, SIOC, Spacedesk.

The main aspect I hope to be able to manage is to create 2 profiles in order to switch from default A320 Neo to FBW A320 with only simple actions

(ideally only selecting one or the other, but for sure I'll have to reload a SIOC and probably a MobiFlight configuration)

I will also try to join the requests to ASOBO for the accessibility of B: and F: variables or "input events".

Link to comment
Share on other sites

49 minutes ago, AlMassimo said:

BUT apparently it causes a lot of CTD to my PC configuration/cockpit addons - with FBW removed from community folder I'm having almost no CTD

even using extensively FSUIPC, Mobiflight, SIOC, Spacedesk.

I also experience a lot of crashes when the FBW and even when it isn't being used - just being installed in the Community folder can cause issues. I do use the dev version though (and don't update that often), maybe the stable is better.

51 minutes ago, AlMassimo said:

I will also try to join the requests to ASOBO for the accessibility of B: and F: variables or "input events".

This is the MobiFlight request that you should vote for:
     https://forums.flightsimulator.com/t/enhanced-api-to-access-all-aircraft-state-and-trigger-all-cockpit-functions/454608

John

Link to comment
Share on other sites

Hi John,

I need your help (yes, again...)

The work with the implementation of FBW A320 functions on my cockpit is proceeding very well, I have a lot of controls already working fine,

I solved some difficulties with encoders (that used to control directly a variable with ROTATE function in SIOC, now I have to use INC e DEC commands, but works), and other issues with lua code, mix between activation of HVARS and setting of LVARS, but after all nothing too difficult thanks to the advanced manual and your precious explanations and hints. Even the CTD issue is pretty kind with me at least in the last 3-4 days, and FBW A320 is a beautiful addon, great sounds and a lot of functions to enable!

Now I am stuck with the A32NX.FCU_SPD_PUSH and A32NX.FCU_SPD_PULL functions.

Under the HVAR list I couldn't find these two essential controls, it looks strange. But I found them under button assignment list, and they work, they work also under the calculator code, perfectly.

I have an A32NX.evt file under FSUIPC7 dir, and this is the content :

[Events]
0 = A32NX.FCU_AP_1_PUSH
1 = A32NX.FCU_AP_2_PUSH
2 = A32NX.FCU_AP_DISCONNECT_PUSH
3 = A32NX.FCU_ATHR_PUSH
4 = A32NX.FCU_ATHR_DISCONNECT_PUSH
5 = A32NX.FCU_SPD_INC
6 = A32NX.FCU_SPD_DEC
7 = A32NX.FCU_SPD_SET
8 = A32NX.FCU_SPD_PUSH
9 = A32NX.FCU_SPD_PULL
10 = A32NX.FCU_SPD_MACH_TOGGLE_PUSH
......

So A32NX.FCU_SPD_PUSH is the 8th position, It should be 32768 + 8 (I have only one evt file and there is only that group of events t.w.i.k.)

and A32NX.FCU_SPD_PULL should be 32768 + 9 (that means 32776 and 32777)

but issuing these 2 commands from SIOC doesn't work.

Also in LUA I can only call controls by number and not by name, so I don't know how I'm missing to make them work...

Can you help me ?

 

Link to comment
Share on other sites

PS

I mentioned HVARS (not controls) because under HVAR list I find

201: H:A320_Neo_FCU_HDG_PUSH
202: H:A320_Neo_FCU_HDG_PULL
203: H:A320_Neo_FCU_SPEED_INC
204: H:A320_Neo_FCU_SPEED_DEC
205: H:A320_Neo_FCU_VS_INC
206: H:A320_Neo_FCU_VS_DEC
207: H:A320_Neo_FCU_VS_PULL
208: H:A320_Neo_FCU_VS_PUSH
209: H:A320_Neo_FCU_ALT_PULL
210: H:A320_Neo_FCU_ALT_PUSH
211: H:A320_Neo_FCU_VS_INC_FPA
212: H:A320_Neo_FCU_VS_INC_VS
213: H:A320_Neo_FCU_VS_DEC_FPA
214: H:A320_Neo_FCU_VS_DEC_VS

But there are not the HVARS

H:A320_Neo_FCU_SPD_PULL and  H:A320_Neo_FCU_SPD_PUSH that are supposed to exist (I found them somewhere under FBW documentation) but trying to activate them in LUA seems to have no effect (I used exactly the same code that worked with HDG_PUSH and HDG_PULL that works fine).

BTW the only HVAR I found in the list was H:A320_Neo_FCU_MODE_MANAGED_SPEED, but strangely it turns on CSTR button in EFIS and has no effect with SPD controls.

Link to comment
Share on other sites

13 minutes ago, AlMassimo said:

Now I am stuck with the A32NX.FCU_SPD_PUSH and A32NX.FCU_SPD_PULL functions.

Under the HVAR list I couldn't find these two essential controls,

It is because they are custom controls, not hvars. *.evt files make custom controls known to FSUIPC for assignment.

24 minutes ago, AlMassimo said:

So A32NX.FCU_SPD_PUSH is the 8th position, It should be 32768 + 8 (I have only one evt file and there is only that group of events t.w.i.k.)

and A32NX.FCU_SPD_PULL should be 32768 + 9 (that means 32776 and 32777)

Yes, that should be correct.

24 minutes ago, AlMassimo said:

but issuing these 2 commands from SIOC doesn't work.

Also in LUA I can only call controls by number and not by name, so I don't know how I'm missing to make them work...

Can you help me ?

Are they being sent and not having the desired affect, or are they not being sent? Activate logging for events and see what you see in the log. If they are being sent but have no affect, I cannot help really.

I presume those custom controls just trigger the associated hvars, as do the MobiFlight presets. If the hvars aren't working, then the custom event and the MF preset won't work.

Which FBW version are you using? The MF documentation states this was tested and working in the stable FBW v0.7.0. If you look at the presets for the A320 dev  version, these don't appear so I suspect they may only work in the stable.

I cannot really help if the hvar is not working. FSUIPC is just the conduit to send these controls to the FS. It is up to you to determine what controls to use.

John

Link to comment
Share on other sites

SOLVED!

Hi John, after a lot of trial and errors, and checking the controls sent on the console, I understood that the number of the controls I needed wasn't the one in the file "A32NX.evt" but the one that appeared in the commands to be assigned to a button in FSUIPC interface, and this was confirmed because, assigning the controls A32NX.FCU_SPD_PUSH and A32NX.FCU_SPD_PULL in the console I saw 33032 and 33033. So this is the LUA code that solved and worked perfectly :

    BTN_SPD_MODE = ipc.readUB(0xA052)
    if (BTN_SPD_MODE == 1) then
       if (ipc.readUB(0xA009) == 0) then
          ipc.control(33032)
       else
          ipc.control(33033)
       end
    end

while other functions of the FCU (like heading) are controlled by HVARS (and in theory there should be also for the speed but they don't work).

    BTN_HDG_MODE = ipc.readUB(0xA053)
    if (BTN_HDG_MODE == 1) then
       if (ipc.readUB(0xA00A) == 0) then
          ipc.activateHvar("H:A320_Neo_FCU_HDG_PUSH")
       else
          ipc.activateHvar("H:A320_Neo_FCU_HDG_PULL")
       end
    end

    BTN_ARPT = ipc.readUB(0xA056)
    if (BTN_ARPT == 1) then
        ipc.activateHvar("H:A320_Neo_MFD_BTN_ARPT_1")
    end

All works very well now, I found some LVARS that gave me the information about the current state (MANAGED / SELECTED) that are

20=A32NX_AUTOPILOT_HEADING_SELECTED=UWA020
22=A32NX_AUTOPILOT_SPEED_SELECTED=UWA022

So checking the byte A020 and A022 I can switch from the current AP HDG and SPD value in managed mode (PUSH) to "---" displayed in selected mode (PULL) that looks very A320 style on a B737 MCP!

Since I'm not having CTD for the moment, I love the FBW A320, it's a great plane. I'm currently using the last stable release (v0.7.4)

 

Link to comment
Share on other sites

17 hours ago, AlMassimo said:

SOLVED!

Great!

17 hours ago, AlMassimo said:

assigning the controls A32NX.FCU_SPD_PUSH and A32NX.FCU_SPD_PULL in the console I saw 33032 and 33033.

Ag, then that must be in event file 1. Note that the event file number you should use to determine the control number for custom controls should be taken from the [EventFiles] section of your FSUIPC7.ini, and not by counting the number of *.evt files in your installation folder. This is probably not clear in the documentation - I will check and update.

I'm glad you are making such good progress. Maybe you could consider writing a FAQ entry on how to configure FSUIPC7 for use with the A320/FBW A320 to help others with this aircraft.

Regards,

John

Link to comment
Share on other sites

Yes, I would be happy to gather all the things I discovered and made to work, because before finding the right variables and the right procedures I had to face many errors, doubts, things not working, etc. So a FAQ summarizing all the steps that worked will be pretty useful for others.

I am now trying to write the code for the pedestal (fuel valves and startup, eg starter knob) and the overhead, in order to be able to go from cold and dark to fully operative and configured plane without clicking on a single spot in the virtual cockpit, excluding the CDU that I don't have as hardware.

Looking on the console, moving the valves send 2 controls, one to shut off the fuel, and one to switch off the starter. I tried to send 2 controls with SIOC but something goes wrong (probably a timing issue) and I get 2 times the same control instead of 2 different controls one after the other. I will try with LUA instead of SIOC but I can't remember if lua checks only the change in state of the vars (as SIOC does) or reads continuously the vars, in that case will send repeatedly the controls, and I'll have to set a flag to execute the controls only once (maybe the FS or L variable that read the status of the valve).

I have only a concern about the events numer calculated upon the order of the event in the list. I have used many events now, and I'm worried that if FBW should add some new control all the numbers could be shifted and will be necessary to find them again an change the values in the code. Being able to call events by name (as happens with HVARS) would be a very interesting possibility, but I can imagine that is not at all easy to do...!

Link to comment
Share on other sites

20 hours ago, John Dowson said:

Note that the event file number you should use to determine the control number for custom controls should be taken from the [EventFiles] section of your FSUIPC7.ini, and not by counting the number of *.evt files in your installation folder. This is probably not clear in the documentation - I will check and update.

Ok thanks, probably it was clear but I didn't remember that, but on the other hand seems to be a good thing to me, in fact this means that the order of the events cannot change if the content of the files isn't modified (but I can ADD events at the bottom of each file adding new progressive numbers). I could also copy the rows in a "guide" file with the control numbers to be used for each event.

The question is that I found only one .evt file in my FSUIPC folder, where could be the second one ? And what happens if an event is duplicated in both files ?

Thanks for all your clarifications and hints, they save me a lot of troubles and smoking brain!

Link to comment
Share on other sites

17 hours ago, AlMassimo said:

have only a concern about the events numer calculated upon the order of the event in the list. I have used many events now, and I'm worried that if FBW should add some new control all the numbers could be shifted and will be necessary to find them again an change the values in the code.

Yes, this is an issue and why I recommend that you don't use the events.txts file for now, but only the myevents.txt file, where you have control over the order and number of each preset. You can copy any of the presets you use from the FBW events.txt file to the myevents.txt file, and also add comments to keep track of the preset numbers.

17 hours ago, AlMassimo said:

Being able to call events by name (as happens with HVARS) would be a very interesting possibility, but I can imagine that is not at all easy to do...!

It should be pretty east to implement - I just need to find an offset area of a minimum of 60 bytes in length, which is the tricky bit! I'll take a look in the next few days and maybe get this into the official release.

2 hours ago, AlMassimo said:

The question is that I found only one .evt file in my FSUIPC folder, where could be the second one ?

I don't know - take a look at the [EventFiles] section of your FSUIPC7.ini and that should tell you what it was.

2 hours ago, AlMassimo said:

And what happens if an event is duplicated in both files ?

I don't think that should be an issue. You would just have the same custom event registered twice under two different numbers, if this was allowed, or maybe an error would be logged when registering the same custom control the second time. I'm not sure really, but either way it shouldn't cause any problems.

18 hours ago, AlMassimo said:

Yes, I would be happy to gather all the things I discovered and made to work, because before finding the right variables and the right procedures I had to face many errors, doubts, things not working, etc. So a FAQ summarizing all the steps that worked will be pretty useful for others.

Yes, that would be great - thanks!

Cheers,

John

Link to comment
Share on other sites

The files listed in FSUIPC.ini are .evt not .txt, or at least I remember so (I'm not in front of my PC now, I'll check this evening), and they have no path, just the filename, so they should be in the same dir, or in a default dir that requires no further path indications.

Anyway, I'll try to do as you suggest, I'll create a myevents.txt file, and then call the events from 262144, 262145 and so on, in order to be sure that the number won't change unless I do so.

What is the difference (if there is one) between .evt files and events.txt files ?

There are also .hvar files but I haven't tested them yet.

For the moment I have done only this :

1) insert LVARS and assign offsets to them in the appropriate section of FSUIPC.ini file, and then reading the offset in SIOC or in Mobiflight, eg to change the state of a led output or perform other actions based upon the value read (very seldom LVARS are also writable, most of them are read only) - each LVAR must be existing in the list visible under FSUIPC/WASM/LIST LVARS

2) calling events from SIOC or LUA code, after having found their number in console, temporarily assigning the control to a button, or watching the events generated by clicking on a control in the simulator.

3) activating HVARS in LUA code, eg  -->    ipc.activateHvar("H:A320_Neo_PFD_BTN_LS_1")   after finding the HVAR under the list in FSUIPC/WASM/LIST HVARS menu

 

Link to comment
Share on other sites

20 minutes ago, AlMassimo said:

The files listed in FSUIPC.ini are .evt not .txt, or at least I remember so (I'm not in front of my PC now, I'll check this evening), and they have no path, just the filename, so they should be in the same dir, or in a default dir that requires no further path indications.

Yes - event files have the extension .evt, not .txt, and the location is always the FSUIPC7 installation folder. Remember we are talking about custom events here, not presets, which are held only in the events.txt and myevents.txt files. This is a bit confusing, i.e. the name of the preset files (as the MF one is called events.txt - presets.txt would be a better name!), but remember that they are presets and not custom events. Do not confuse the two, especially when working out the control number for the event or preset.

24 minutes ago, AlMassimo said:

Anyway, I'll try to do as you suggest, I'll create a myevents.txt file, and then call the events from 262144, 262145 and so on, in order to be sure that the number won't change unless I do so.

Ok, but they are presets, not (custom) events...

25 minutes ago, AlMassimo said:

What is the difference (if there is one) between .evt files and events.txt files ?

.evt files define custom events to FSUIPC7. Custom events need to be handled somehow in the FS, either by the aircraft itself (such as the A32NX.* customevents) or by something else, such as the MF WASM module. The events.txt and myevents.txt files hold preset definitions, which execute calculator code. The FSUIPC WASM module is needed for these to work.

 

Link to comment
Share on other sites

Uhm... I must try to understand better these aspects (events, presets, HVARS, calculator code, controls, custom events...)

this is the section Eventfiles in my FSUIPC7.ini

[EventFiles]
0=A320_NX
1=A32NX

there is no path and no extension, but the only file with name A32NX is an .evt file with this content (can't remember how it was created and when...)

[Events]
0 = A32NX.FCU_AP_1_PUSH
1 = A32NX.FCU_AP_2_PUSH
2 = A32NX.FCU_AP_DISCONNECT_PUSH
3 = A32NX.FCU_ATHR_PUSH
4 = A32NX.FCU_ATHR_DISCONNECT_PUSH
5 = A32NX.FCU_SPD_INC
6 = A32NX.FCU_SPD_DEC
7 = A32NX.FCU_SPD_SET
8 = A32NX.FCU_SPD_PUSH
9 = A32NX.FCU_SPD_PULL
10 = A32NX.FCU_SPD_MACH_TOGGLE_PUSH
11 = A32NX.FCU_HDG_INC
12 = A32NX.FCU_HDG_DEC
13 = A32NX.FCU_HDG_SET
14 = A32NX.FCU_HDG_PUSH
15 = A32NX.FCU_HDG_PULL
16 = A32NX.FCU_TRK_FPA_TOGGLE_PUSH
17 = A32NX.FCU_ALT_INC
18 = A32NX.FCU_ALT_DEC
19 = A32NX.FCU_ALT_SET
20 = A32NX.FCU_ALT_PUSH
21 = A32NX.FCU_ALT_PULL
22 = A32NX.FCU_ALT_INCREMENT_TOGGLE
23 = A32NX.FCU_ALT_INCREMENT_SET
24 = A32NX.FCU_VS_INC
25 = A32NX.FCU_VS_DEC
26 = A32NX.FCU_VS_SET
27 = A32NX.FCU_VS_PUSH
28 = A32NX.FCU_VS_PULL
29 = A32NX.FCU_LOC_PUSH
30 = A32NX.FCU_APPR_PUSH
31 = A32NX.FCU_EXPED_PUSH

Then I have a file with the name of the second file in the FSUIPC7.ini (A320_NX) which is a LUA file (A320_NX.lua) that I wrote with some hvars;

Since A320_NX.lua is a name that I gave to that file, I don't think there are other files with this name (normally is A320_Neo  or A32NX).

The events.txt seems to contain sort of macros or calculator code with some instructions or conditions or whatever

//Aerosoft/CRJ 550-700-1000/Air Condition / Pressurization
ASCRJ_AIRC_AFT_CARGO_AIRCOND_SWITCH#(L:ASCRJ_AIRC_AFT_CARGO, Bool) ! (>L:ASCRJ_AIRC_AFT_CARGO)
ASCRJ_AIRC_PACK_L_SWITCH# (L:ASCRJ_AIRC_PACK_L, Bool) ! (>L:ASCRJ_AIRC_PACK_L)
ASCRJ_AIRC_PACK_R_SWITCH# (L:ASCRJ_AIRC_PACK_R, Bool) ! (>L:ASCRJ_AIRC_PACK_R)
ASCRJ_AIRC_RECIC_FAN_SWCH_OFF#0 (>L:ASCRJ_AIRC_RECIRC_FAN)

eg very interesting

G58_MAGNETO1_BOTH#3 (>K:MAGNETO1_SET) (A:GENERAL ENG STARTER:1, Bool) if{ 0 (>K:SET_STARTER1_HELD) }

contains both controls K: and A: vars!

I definitively must study more deeply these instructions, I think is calculator code, must search on advanced manual!

I can copy some of these rows in myevents.txt and use with offset $3110 and the numbers 262144, 262145 ?

This could probably solve the issue with sending 2 different controls in sequence with different parameters ?

 

Link to comment
Share on other sites

The files listed under the [EventFiles] section are all *.evt files that have existed in your FSUIPC7 installation folder. It does not mean that they currently exist! If an *.evt file is removed, it is still kept under that section. This is necessary as it is the indeed numbers of these files that are used by FSUIPC to record your assignments. Once it is added to that section, it remains there. Therefore that file used to be under your FSUIPC7 installation folder.

17 minutes ago, AlMassimo said:

but the only file with name A32NX is an .evt file with this content (can't remember how it was created and when...)

That is the second file in the [EventFiles] section. You created it or at least put it there. It is similar to the flybywire-aircraft-a320-neo.evt file (under your EventFiles folder) You even assigned to some of these custom events (see above - you initially got the number for these custom controls wrong as you thought it was the first event file, and so the control numbers you originally used were 256 out).

23 minutes ago, AlMassimo said:

The events.txt seems to contain sort of macros or calculator code with some instructions or conditions or whatever

Those are what I call the presets. The part to the left of the # is the preset name, the part to the right the calculator code associated to that preset. This is explained in the Advanced User guide.

25 minutes ago, AlMassimo said:

contains both controls K: and A: vars!

K vars are standard controls, A vars are simvars. That script is sending the controls Magneto1 Set and Set Starter1 Held if the General Eng Starter simvar is true.

36 minutes ago, AlMassimo said:

I definitively must study more deeply these instructions, I think is calculator code, must search on advanced manual!

It is calculator code, in RPN format. See https://docs.flightsimulator.com/html/Additional_Information/Reverse_Polish_Notation.htm, but there isn't that much information about how to use it though, and what is available for each aircraft. A lot of this stuff has been discovered from the html guage files,and from using the MSFS developer mode facilities to inspect the code if the aircraft when its running. i think there's an old tutorial on youtube from MobiFlight showing the basics.

44 minutes ago, AlMassimo said:

I can copy some of these rows in myevents.txt and use with offset $3110 and the numbers 262144, 262145 ?

This is what I advised originally when I first posted with the preset functionality, and also again later.

I think I have said everything I can about presets, custom events, lvars, hvars, calculator code, etc now, and several times. Can you try re-reading these posts and consulting the MSFS documentation (as well as the FSUIPC documentation) before posting again. I will try to make the documentation clearer in the next release.

 

 

Link to comment
Share on other sites

Ok, sure, i will study all I can before writing again! But if I'm going to write some sort of tutorial or FAQ I must be sure to have understood what I read, and... ehm, I'm sure only when you confirm that I have understood! (even when something seems to work I'm not totally sure to have fully understood the process...)

Thanks, your support is invaluable and I can't "monopolize" your time, you really helped me a lot.

Massimo

Link to comment
Share on other sites

41 minutes ago, John Dowson said:

This is necessary as it is the indeed numbers of these files that are used by FSUIPC to record your assignments. Once it is added to that section, it remains there. Therefore that file used to be under your FSUIPC7 installation folder.

Essential information!!! Right! So the numbers don't change!

Link to comment
Share on other sites

I have an offset to allow you to set lvars, activate hvars, call a preset or execute calculator code in the attached version, if you would like to try.

The offset is at 0x7C50 (64 bytes), and the parameter value is at 0x780 (8 bytes). Always write the parameter first (or write both offsets together), as it is the write at offset 0x7C50 that triggers this.

For lvars, the first characters must be 'L:', and the parameter value is an 8 byte string (including terminator).
For hvars, the first characters must be 'H:', and the hvar must be known to FSUIPC (if it isn't known to FSUIPC, write as calc. code, e.g. '(>H:hvarName)').
For presets, the first characters must be 'P:', and the parameter is a 4-byte (dword) number (not a string!).

Anything not starting 'L:', 'H:' or 'P:' is considered to be calculator code and will be executed as such.

Let me know if you have any issues.

Note this version has also been built against the latest MSFS SimConnect SDK (v0.17.0.0) and contains additional controls/events. I will publish details when officially released.

John

FSUIPC7.exe

Link to comment
Share on other sites

And now, ladies and gentlemen, after some weeks of work (and with great support from John) I have reached a good level of control of the FBW A320 through my home cockpit, so I feel reasonably confident to be able to resume all I found in the promised WASM LVARS TO OFFSET BASIC GUIDE!

First of all, I must specify that my hardware is based on :

- Opencockpit 737 MCP and EFIS (+ NAV Radio, not yet programmed by now)
- Main Control Panel, Throttle quadrant and Overhead are self made and based on 3 arduino Mega boards controlled via MobiFlight, and - essentially - by FSUIPC7 (registered version).

So this "guide" (let me call it this way) tries to summarize what I achieved :

- Opencockpit 737 MCP and EFIS converted almost completely the to work emulating pretty well an A320 FCU

- Throttle quadrant (throttles, reverse levers, spoiler, flaps and flaps gauge indicator (stepper motor), engines fuel valves and ignition (start) switches is fully operational

- Overhead : for the moment I have APU master and APU start (unified because on 737 there is only one APU start/stop momentary switch. APU bleed and APU generator all working, also BLEED, APU GEN OFF BUS, GEN1 and GEN2 SOURCE OFF and GEN1-2 OFF BUS annunciators working.

Most of these controls are operated through these LVARS, either in SIOC or with MOBIFLIGHT.

[LvarOffsets]
1=A320_Neo_MFD_NAV_MODE_1=UBA000
2=A320_Neo_MFD_Range_1=UBA001
3=A32NX_PARK_BRAKE_LEVER_POS=UBA003
4=A32NX_FLAPS_HANDLE_INDEX=UBA004
5=BTN_TERRONND_1_ACTIVE=UBA005
6=AIRLINER_LS_On=UBA006
7=A32NX_AUTOBRAKES_ARMED_MODE=UBA007
8=A32NX_SPOILERS_HANDLE_POSITION=UBA008
9=A32NX_FCU_SPD_MANAGED_DOT=UBA009
10=A32NX_FCU_HDG_MANAGED_DOT=UBA00A
11=A32NX_AUTOTHRUST_MODE=UBA00B
12=A32NX_AUTOPILOT_1_ACTIVE=UBA00C
13=A32NX_AUTOPILOT_2_ACTIVE=UBA00D
14=A32NX_FCU_ALT_MANAGED=UBA00E
15=A32NX_FCU_VS_MANAGED=UBA00F
16=A32NX_HOME_COCKPIT_ENABLED=UBA010
17=BTN_LS_1_FILTER_ACTIVE=UBA011
18=A32NX_FCU_APPR_MODE_ACTIVE=UBA012
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
23=A32NX_APU_BLEED_ON=UBA017
24=A32NX_AUTOPILOT_HEADING_SELECTED=UWA020
25=A32NX_AUTOPILOT_SPEED_SELECTED=UWA022
26=A32NX_AUTOPILOT_VS_SELECTED=SWA024
30=A32NX_APU_EGT=UWA026
31=A32NX_APU_N=UWA028
32=A32NX_APU_BLEED_AIR_VALVE_OPEN=UBA02A
33=A32NX_OVHD_PNEU_APU_BLEED_PB_IS_ON=UBA02B

where

SB – signed byte (1 byte)
UB – unsigned byte (1 byte)
SW – signed word (2 bytes), use for signed short
UW – unsigned word (2 bytes), use for unsigned short
SD – signed double-word (DWORD) (4 bytes), use for signed int
UD – unsigned double-word (4 bytes), use for unsigned int
F – floating point number (4 bytes), use for float

Some functions are operated by controls offest sent from SIOC using

Var 0001 name FS_CONTROL Link FSUIPC_OUT Offset $3110 Length 4
Var 0002 name FS_PAR Link FSUIPC_OUT Offset $3114 Length 4

65879   HEADING_BUG_INC
65880   HEADING_BUG_DEC
65896   AP_SPD_VAR_INC
65897   AP_SPD_VAR_DEC
66241   TOGGLE_MASTER_BATTERY
66701   AVIONICS_MASTER_SET

Other controls, most of which related to FCU push/pull knobs, are sent by "custom" control numbers calculated according to the FSUIPC7 for Advanced Users.pdf
pag. 37 - Add-on Custom Events

This needs one (or more) files with .evt extension, that will be listed automatically in FSUIPC7.ini under "EventFiles" section like this (in my case)

[EventFiles]
0=A320_NX
1=A32NX

this is the content of my A32NX.evt file :

[Events]
0 = A32NX.FCU_AP_1_PUSH
1 = A32NX.FCU_AP_2_PUSH
2 = A32NX.FCU_AP_DISCONNECT_PUSH
3 = A32NX.FCU_ATHR_PUSH
4 = A32NX.FCU_ATHR_DISCONNECT_PUSH
5 = A32NX.FCU_SPD_INC
6 = A32NX.FCU_SPD_DEC
7 = A32NX.FCU_SPD_SET
8 = A32NX.FCU_SPD_PUSH
9 = A32NX.FCU_SPD_PULL
10 = A32NX.FCU_SPD_MACH_TOGGLE_PUSH
11 = A32NX.FCU_HDG_INC
12 = A32NX.FCU_HDG_DEC
13 = A32NX.FCU_HDG_SET
14 = A32NX.FCU_HDG_PUSH
15 = A32NX.FCU_HDG_PULL
16 = A32NX.FCU_TRK_FPA_TOGGLE_PUSH
17 = A32NX.FCU_ALT_INC
18 = A32NX.FCU_ALT_DEC
19 = A32NX.FCU_ALT_SET
20 = A32NX.FCU_ALT_PUSH
21 = A32NX.FCU_ALT_PULL
22 = A32NX.FCU_ALT_INCREMENT_TOGGLE
23 = A32NX.FCU_ALT_INCREMENT_SET
24 = A32NX.FCU_VS_INC
25 = A32NX.FCU_VS_DEC
26 = A32NX.FCU_VS_SET
27 = A32NX.FCU_VS_PUSH
28 = A32NX.FCU_VS_PULL
29 = A32NX.FCU_LOC_PUSH
30 = A32NX.FCU_APPR_PUSH
31 = A32NX.FCU_EXPED_PUSH

The number of each control is obtained by 32768 + number of the specific file containing the command selected * 256 + number of the control in the file.

So, eg., since A32NX.evt is the second file in the [EventFiles] section of FSUIPC7.ini, the control for A32NX.FCU_AP_1_PUSH
will be   32768 + 1 * 256 + 0 = 33024, while A32NX.FCU_AP_2_PUSH will be 32768 + 1 * 256 + 1 = 33025 and so on.

Anyway, you can assign the control you need to a "test" button under FSUIPC panel and then in the console you can see the number of the event that has to be used, and this helps a lot.

Some (fortunately very few, HVARS, can be controlled in various ways, but I simply used some very basic LUA code

function update_switches()

    BTN_LS = ipc.readUB(0xA050)
    if (BTN_LS == 1) then
        ipc.activateHvar("H:A320_Neo_PFD_BTN_LS_1")
    end

    BTN_HDG_MODE = ipc.readUB(0xA053)
    if (BTN_HDG_MODE == 1) then
       if (ipc.readUB(0xA00A) == 0) then
          ipc.activateHvar("H:A320_Neo_FCU_HDG_PUSH")
       else
          ipc.activateHvar("H:A320_Neo_FCU_HDG_PULL")
       end
    end

    BTN_ARPT = ipc.readUB(0xA056)
    if (BTN_ARPT == 1) then
        ipc.activateHvar("H:A320_Neo_MFD_BTN_ARPT_1")
    end

    BTN_CSTR = ipc.readUB(0xA057)
    if (BTN_CSTR == 1) then
        ipc.activateHvar("H:A320_Neo_MFD_BTN_CSTR_1")
    end

    SW_CUTOFF1 = ipc.readUB(0x6220)
    if SW_CUTOFF == 1 then
        -- ipc.control(67197, 1)
    end
   
end -- update_switches

-- =================================================================================
    
  event.timer(100,"update_switches")

THAT'S ALL FOLKS!

 

 

 

 

 

 

 

 

Link to comment
Share on other sites

To be more precise, the last rows on lua code

SW_CUTOFF1 = ipc.readUB(0x6220)
    if SW_CUTOFF == 1 then
        -- ipc.control(67197, 1)
    end

didn't work, and I commented them out and I'll remove them, since I used direct controls BUTTON assignment in FSUIPC7 panel

30=RA,2,C65602,0     -{THROTTLE_DECR}-
31=UA,2,C65604,0     -{THROTTLE_CUT}-
32=PA,7,C66064,0     -{SPOILERS_ON}-
33=UA,7,C66065,0     -{SPOILERS_OFF}-
35=PA,9,CPA32NX_ENG2_MASTER_SWITCH_OFF,0     -{Preset Control}-
37=PA,10,CPA32NX_ENG2_MASTER_SWITCH_ON,1     -{Preset Control}-
38=PA,0,CPA32NX_ENG1_MASTER_SWITCH_ON,0     -{Preset Control}-
39=PA,1,CPA32NX_ENG1_MASTER_SWITCH_OFF,1     -{Preset Control}-

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.