Jump to content
The simFlight Network Forums

FSUIPC WASM module + client-side API + lvar/hvar discussion topic


John Dowson

Recommended Posts

7 minutes ago, SAC002 said:

Hi, I think I am getting close but I seem to be missing something about macros to control LVARS...

I want to control the XMLVAR_APTRIM Lvar for the TBM930.

I have created a macro named: XMLVAR_APTRIM.mcro and put it in my main FSUIPC folder.

It has 2 lines: 

[Macros]

1=L:XMLVAR_APTRIM=Set,0

 

I don't see this command in the drop down menu for assigning a button ?

Thanks for your help.

That should be ok... did you create the macro file when FSUIPC was running? If so, you need to 'Reload all buttons' or restart FSUIPC7 to pick up the macro.

Presumably you are using a registered version of FSUIPC7, no?

Can you see the macro file in the [MacroFiles] section of your FSUIPC7.ini?

Btw, better to call your macro file something like TBM930.mcro. Its then more obvious and you can use the same file to add other macros to the TBM930 later if needed.

Link to comment
Share on other sites

Hello,

what's the correct format to activate HVARS via a macro file in order to assign a button from the drop down list (example please if possible)? For the record, I can activate them via the WASM add-ons submenu just fine. Thank you

Using v7.1.0f.

Just Flight PA28 Arrow III Custom.hvar

Edited by Ohmsquare
Edit: attaching GNS530 HVARs for anyone interested.
Link to comment
Share on other sites

Hello everybody! Boeing 747 has lVAR: 
B747_8_MFD_Range 
with a value from 0 to 11. What should the *.mcro file look like?
I am trying something like this:
[Macros]

1 = L: B747_8_MFD_Range = Set, 0
2 = L: B747_8_MFD_Range = Set, 1
3 = L: B747_8_MFD_Range = Set, 2
And so on..

But the switch in the cockpit only works once. That is, after loading the plane, 
I can only switch the range when the assigned button is pressed for the first time. 
vThen it is inactive until the simulator is restarted.
Edited by Eliagh
Link to comment
Share on other sites

12 hours ago, Eliagh said:

I am trying something like this:

[Macros]
1 = L: B747_8_MFD_Range = Set, 0
2 = L: B747_8_MFD_Range = Set, 1
3 = L: B747_8_MFD_Range = Set, 2

And so on.. But the switch in the cockpit only works once. That is, after loading the plane, I can only switch the range when the assigned button is pressed for the first time.

That is because you can only assign the one action, L: B747_8_MFD_Range.  That's the name of the macro within the file, and using that name only the first entry (or maybe the last depending on how Windows does these INI selections) will be used.

Just have the one entry:

1 = L: B747_8_MFD_Range = Set

and assign to that with the parameter in the assignment (the "parameter" entry there) in your button or keyboard assignments.

Pete

 

Link to comment
Share on other sites

14 hours ago, Ohmsquare said:

what's the correct format to activate HVARS via a macro file in order to assign a button from the drop down list (example please if possible)?

Create a macro file in  your FSUIPC7 installation folder, called (say) PA28Arrow.mcro, and then add the following:

Quote

[Macros]
1=H:AS530_CLR_Push=Set
2=H:AS530_CLR_Push_Lon=Set
3=H:AS530_COMSWAP_Push=Set
4=H:AS530_DirectTo_Push=Set
5=H:AS530_ENT_Push=Set
6=H:AS530_FPL_Push=Set
7=H:AS530_LeftLargeKnob_Left=Set
8=H:AS530_LeftLargeKnob_Right=Set
9=H:AS530_LeftSmallKnob_Left=Set
10=H:AS530_LeftSmallKnob_Push=Set
11=H:AS530_LeftSmallKnob_Right=Set
12=H:AS530_MENU_Push=Set
13=H:AS530_MSG_Push=Set
14=H:AS530_NAVSWAP_Push=Set
15=H:AS530_OBS_Push=Set
16=H:AS530_PROC_Push=Set
17=H:AS530_RightLargeKnob_Left=Set
18=H:AS530_RightLargeKnob_Right=Set
19=H:AS530_RightSmallKnob_Left=Set
20=H:AS530_RightSmallKnob_Push=Set
21=H:AS530_RightSmallKnob_Right=Set
22=H:AS530_RNG_Dezoom=Set
23=H:AS530_RNG_Zoom=Set
24=H:AS530_VNAV_Push=Set

You should then see the entries in the assignments drop-downs.

Edited by John Dowson
script corrected
Link to comment
Share on other sites

Yes, that is, of course easier and it works. Thank you. However, for som unknown reason, my code works today too. I don't know what was wrong yesterday. Your example allows you to assign a variable, and mine allows you to choose from ready-made ones. 

Thanks a lot anyway. 

Edited by Eliagh
Link to comment
Share on other sites

29 minutes ago, John Dowson said:

Create a macro file in  your FSUIPC7 installation folder, called (say) PA28Arrow.mcro, and then add the following:

You should then see the entries in the assignments drop-downs.

Thank you very much, John.

For some reason, the format in the provided example doesn't work for me. I had to change the ", Set" to "=Set" (e.g. "12=H:AS530_MENU_Push=SET") and now it works like a charm.

Kind regards

Link to comment
Share on other sites

I don't really understand the inner workings of the FSUIPC wasm, but it is great to be able to assign buttons/keys to lvar's now, thank you so much.

One of the other things I am trying to solve is that I build virtual bezels in Air Manager to surround the pop-out gauges with functional softkeys. Does the FSUIPC wasm expose the lvar's to Simconnect? I believe that is what Air Manager uses for it's interface with the sim and many aircraft use lvar's for their softkey functionality.

What would I need to do to access the lvar's FSUIPC wasm finds in Air Manager (via lua).

Thanks,

Mike

Link to comment
Share on other sites

7 minutes ago, Helibrewer said:

Does the FSUIPC wasm expose the lvar's to Simconnect?

No - no way to currently access lvars via simconnect.

8 minutes ago, Helibrewer said:

What would I need to do to access the lvar's FSUIPC wasm finds in Air Manager (via lua).

I don't know Air Manager - can it access fsuipc offsets? If so, your best bet is probably to write the lvar values to free/user offsets, and then read them back from Air Manager using the offsets. If Air Manager doesn't use FSUIPC, then I'm not sure how you can do this - maybe using files, but that would probably be problematic as well as rather slow...

 

Link to comment
Share on other sites

John, is there a specific way to name Hvar files for the wasm module ?  I named mine TBM930 and it did not work but i changed it to just TBM and it works.  I did not find a reference to this in the doc.

When I am done with the file, I will post it here.

Cheers,

Daniel

Link to comment
Share on other sites

5 minutes ago, SAC002 said:

John, is there a specific way to name Hvar files for the wasm module ?  I named mine TBM930 and it did not work but i changed it to just TBM and it works.  I did not find a reference to this in the doc.

The file name has to be a substring of the aircraft name/title. The full aircraft title is "TBM 930 Asobo", so TBM930 doesn't match - you need the space, so use "TBM 930.hvar".

Link to comment
Share on other sites

I would like to ask one more question. Take for example the same previously mentioned LVAR command for Boeing 747:
1 = L: B747_8_MFD_Range = Set
Can the encoder be programmed to switch the scale? Or two buttons, one of which will add the values 0, 1, 2... and the other will subtract 6, 5, 4 ...?

Link to comment
Share on other sites

@Eliagh, as mentioned here you can use only 1 L:Var in a .MCRO file.
Using buttons, in this case, 1 button, you can cycle through the ranges and repeat :
1 = L:B747_8_MFD_Range = Cyclic,11
This will give 0,1,2,3,4,5,6,7,8,9,10,11,0,1,2 .... On each button press.
See FSUIPC# for Advanced Users.pdf, "Macros to change Lvars" section.

For an increment/decrement you would have to use lua. Something like this, NOT TESTED :
Use [AUTO] in .ini to start the lua then assign buttons or encoder as such -
Decrease = LuaToggle <lua_name> with a parameter of 1
Increase =  Lua Toggle <lua_name> with a parameter of 2

Function mfd_adjust(flag)
	a = ipc.readLvar("L:B747_8_MFD_Range")
	if flag == 1 then
		a = a - 1
		if a < 0 then
			a = 11
		end	
	else
		a = a + 1
	end
	a = a % 12
	ipc.writeLvar("L:B747_8_MFD_Range", a)
end

event.flag(1, "mfd_adjust")
event.flag(2, "mfd_adjust")

Roman
 

  

Link to comment
Share on other sites

1 minute ago, Eliagh said:

Thanks, I don't have access to the sim right now, but I'll try this weekend. Will also something like this work in the MCRO file:

1=L:B747_8_MFD_Range=Inc,6

2=L:B747_8_MFD_Range=Dec,0

No! You cannot use the same lvar more than once in a macro, as the lvar name is also the macro name. Therefore there is no way to distinguish between those entries. If you want to do it that way (i.e. multiple macros on the same lvar), you would need each macro definition (using the same lvar) in its own file.

Link to comment
Share on other sites

To be sure. These LVARs in one MCRO file work:


1 = L: B747_8_MFD_Range = Set
2 = L: B747_8_MFD_Range = Dec,
3 = L: B747_8_MFD_Range = Inc, 11

This works as a standard FSUIPC assignment and also via Mobiflight (some of my encoders are connected to the Arduino Mega and I can only assign them via MobiFlight).

Untitled.jpg

Link to comment
Share on other sites

16 hours ago, Eliagh said:

In order to clarify. These LVARs in a single MCRO file works:
1 = L: B747_8_MFD_Range = Set
2 = L: B747_8_MFD_Range = Dec, 0
3 = L: B747_8_MFD_Range = Inc, 11

This may work as you are using different commands (Set, Dec, Inc), and so the menu entries are different. However, due to the lvar name being the macro name (internally) this can cause problems. Its fine if it works for you, but if you get problems doing it this way the first think I would recommend is that this be changed.

Link to comment
Share on other sites

2 hours ago, John Dowson said:

if you get problems doing it this way the first think I would recommend is that this be changed.

Thanks, I understood and created separate files.

And again a question from the audience. I continue to understand the issue of assigning various commands and came to HVAR.
To control the EICAS Boeing FBW screens, I created a separate MCRO file with the following content:
[Macros]
1 = H: A320_Neo_EICAS_2_ECAM_CHANGE_PAGE_ENG = Set, 1
2 = H: A320_Neo_EICAS_2_ECAM_CHANGE_PAGE_BLEED = Set, 1
3 = H: A320_Neo_EICAS_2_ECAM_CHANGE_PAGE_PRESS = Set, 1
Etc.
Everything works fine. Now it remains to set up the autopilot. Using Model Behavior, I found one of the HVARs I needed:
H: A320_Neo_FCU_VS_HOLD
But something strange happens: the line
1 = H: A320_Neo_FCU_VS_HOLD = Set, 1
does not work. The console writes: "No HVAR found with name ..."
Then I tried Set, Toggle, Cycle. Added this HVAR to existing MCRO files and created a separate one. However, this command works if I execute it through Mobiflight and its * .cip and * .evt files.
Why are EICAS HVARS triggered and AP HVARS not triggered?

Link to comment
Share on other sites

9 minutes ago, Eliagh said:

To control the EICAS Boeing FBW screens, I created a separate MCRO file with the following content:
[Macros]
1 = H: A320_Neo_EICAS_2_ECAM_CHANGE_PAGE_ENG = Set, 1
2 = H: A320_Neo_EICAS_2_ECAM_CHANGE_PAGE_BLEED = Set, 1
3 = H: A320_Neo_EICAS_2_ECAM_CHANGE_PAGE_PRESS = Set, 1

Thats ok, but there is no 'value' associated to an hvar, so you can just use:

  1=H:A320_Neo_EICAS_2_ECAM_CHANGE_PAGE_ENG=Set
  2=H:A320_Neo_EICAS_2_ECAM_CHANGE_PAGE_BLEED=Set
  3=H:A320_Neo_EICAS_2_ECAM_CHANGE_PAGE_PRESS=Set

(and no space between the 'H:' and the hvar name - I'm surprised it works if you have that...although white space may be removed, I'm not sure without checking the code....)

9 minutes ago, Eliagh said:

Everything works fine. Now it remains to set up the autopilot. Using Model Behavior, I found one of the HVARs I needed:
H: A320_Neo_FCU_VS_HOLD
But something strange happens: the line
1 = H: A320_Neo_FCU_VS_HOLD = Set, 1
does not work. The console writes: "No HVAR found with name ..."

If you list hvars (see the Add-ons->WASM->List Hvars... menu entry), can you see that hvar? If so, it may be that extra space after the 'H:'. Otherwise, the hvar is not know to FSUIPC7. FSUIPC7 only knows about hvars loaded from the aircraft *.hvar file, located in the FSUIPC7 WASM folder. Check that file and add it there if its not there already. If you do this when FSUIPC7 is running, issue a Reload (from the Add-ons->WASM menu) to reload the hvars (and lvars) for the current aircraft.

Link to comment
Share on other sites

Yes, this HVAR was not in the A320.hvar file. I added it and it worked. After adding new lines to the * .hvar file, you need to restart the simulator.
Spaces between the 'H:' and the hvar name in my previous post appeared when posting through a form. They are not in the file. I deleted the variables "1". Thanks for the advice.

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.