Replies: 42 comments
-
Maybe this is the solution: |
Beta Was this translation helpful? Give feedback.
-
Thank you @SQLSammy I probably found a part of the answer in #14 "Conditional triggers can set and get global variables", but it doesn't work for local variables. For instance, I wish to change the MFD range of the A32NX using the encoder 3:
|
Beta Was this translation helpful? Give feedback.
-
Since you linked the simvars documentation of the FBW A320 I guess you want to directly change a simvar with an encoder. In this case you should be able to use the get_simvar_value and set_simvar_value. But there might be a problem with the way python-simconnect returns None when you request a simvar that is not in it's list. I will do some research for this. {
"index": 3,
"event_up": {
"type": "condition",
"event": [ "{% set mfd_range = data.get_simvar_value('A320_NEO_MFD_RANGE_1') %}",
"{{ data.set_simvar_value('A320_NEO_MFD_RANGE_1', mfd_range + 1) }}"]
},
"event_down": {
"type": "condition",
"event": [ "{% set mfd_range = data.get_simvar_value('A320_NEO_MFD_RANGE_1') %}",
"{{ data.set_simvar_value('A320_NEO_MFD_RANGE_1', mfd_range - 1) }}"]
}
}, For more information about how to write code for the condition events. I use jinja2 to parse and execute the template https://jinja.palletsprojects.com/en/2.11.x/templates/ |
Beta Was this translation helpful? Give feedback.
-
I've been looking into this and I'm not fully aware what an LVAR is. But I guess that it is a local variable that stays inside of the simulator / aircraft code. With that I was unable to connect to them using the simconnect API. I used the latest experimtal build of the FBW A320 and the simconnect API gave me this:
also tried with the L: in front of it
|
Beta Was this translation helpful? Give feedback.
-
Hi, I've been able to use some of LVAR variables of the FBW 320NX thanks to the Mobifligh WASM module. Note everything is not available, as some commands use "HVAR" variables. I don't know the difference between LVAR and HVAR. Personnaly, I recently move from X-Touch-Mini-FS2020 to SPAD.NEXT, to be able to manage two X-Touch at the same time (and to gain the benefit of a UI tool to setup the commands). But I keep an eye on X-Touch-Mini-FS2020, I might switch back some time ;-) @gleclere funny, we've recently been in touch on "Flight Simulator 2020 France" facebook group :-) |
Beta Was this translation helpful? Give feedback.
-
#41 has changes so the mobiflight WASM module can be used in conditional triggers. The config is really complex. So I will investigate adding a feature for using the encoder as a selector switch. Since these selector switches are quite common in aircraft. |
Beta Was this translation helpful? Give feedback.
-
Release https://github.com/maartentamboer/X-Touch-Mini-FS2020/releases/tag/v1.3.0 is now available. This release can set the range using conditional triggers and the mobiflight wasm module. I've added it to the config_a320.json in the release. {
"index": 8,
"event_up": {
"type": "condition",
"event": [ "{% if data.get_global_variable('MFD_RANGE') == 10 %}",
"{{ data.trigger_event('MobiFlight.A320_neo_MFD_Range_1_20', 1) }}",
"{{ data.set_global_variable('MFD_RANGE', 20) }}",
"{% elif data.get_global_variable('MFD_RANGE') == 20 %}",
"{{ data.trigger_event('MobiFlight.A320_neo_MFD_Range_1_40', 1) }}",
"{{ data.set_global_variable('MFD_RANGE', 40) }}",
"{% elif data.get_global_variable('MFD_RANGE') == 40 %}",
"{{ data.trigger_event('MobiFlight.A320_neo_MFD_Range_1_80', 1) }}",
"{{ data.set_global_variable('MFD_RANGE', 80) }}",
"{% elif data.get_global_variable('MFD_RANGE') == 80 %}",
"{{ data.trigger_event('MobiFlight.A320_neo_MFD_Range_1_160', 1) }}",
"{{ data.set_global_variable('MFD_RANGE', 160) }}",
"{% elif data.get_global_variable('MFD_RANGE') == 160 %}",
"{{ data.trigger_event('MobiFlight.A320_neo_MFD_Range_1_320', 1) }}",
"{{ data.set_global_variable('MFD_RANGE', 320) }}",
"{% elif data.get_global_variable('MFD_RANGE') == 320 %}",
"{{ data.trigger_event('MobiFlight.A320_neo_MFD_Range_1_320', 1) }}",
"{% else %}",
"{{ data.trigger_event('MobiFlight.A320_neo_MFD_Range_1_10', 1) }}",
"{{ data.set_global_variable('MFD_RANGE', 10) }}",
"{% endif %}" ]
},
"event_down": {
"type": "condition",
"event": [ "{% if data.get_global_variable('MFD_RANGE') == 320 %}",
"{{ data.trigger_event('MobiFlight.A320_neo_MFD_Range_1_160', 1) }}",
"{{ data.set_global_variable('MFD_RANGE', 160) }}",
"{% elif data.get_global_variable('MFD_RANGE') == 160 %}",
"{{ data.trigger_event('MobiFlight.A320_neo_MFD_Range_1_80', 1) }}",
"{{ data.set_global_variable('MFD_RANGE', 80) }}",
"{% elif data.get_global_variable('MFD_RANGE') == 80 %}",
"{{ data.trigger_event('MobiFlight.A320_neo_MFD_Range_1_40', 1) }}",
"{{ data.set_global_variable('MFD_RANGE', 40) }}",
"{% elif data.get_global_variable('MFD_RANGE') == 40 %}",
"{{ data.trigger_event('MobiFlight.A320_neo_MFD_Range_1_20', 1) }}",
"{{ data.set_global_variable('MFD_RANGE', 20) }}",
"{% elif data.get_global_variable('MFD_RANGE') == 20 %}",
"{{ data.trigger_event('MobiFlight.A320_neo_MFD_Range_1_10', 1) }}",
"{{ data.set_global_variable('MFD_RANGE', 10) }}",
"{% elif data.get_global_variable('MFD_RANGE') == 10 %}",
"{{ data.trigger_event('MobiFlight.A320_neo_MFD_Range_1_10', 1) }}",
"{% else %}",
"{{ data.trigger_event('MobiFlight.A320_neo_MFD_Range_1_10', 1) }}",
"{{ data.set_global_variable('MFD_RANGE', 10) }}",
"{% endif %}" ]
}
} |
Beta Was this translation helpful? Give feedback.
-
Hello, Any ideas? Thanks for your great work. |
Beta Was this translation helpful? Give feedback.
-
If I understand correctly from my playing around last night, the MFD_RANGE is an internal variable. You can set it to whatever, introduce your own etc. And you need to use the MobiFlight implementation of the NAV_MODE. It's easy from there, I've just implemented NAV mode myself:
One question I have myself, just trying to implement the radio - even though it says tested on the WASM Events list, I'm getting no response with this code. Any glaring obvious reason I'm missing here?
|
Beta Was this translation helpful? Give feedback.
-
Too quick - apparently the FBW team fixed the default call. So we can just use:
|
Beta Was this translation helpful? Give feedback.
-
For radios its easier |
Beta Was this translation helpful? Give feedback.
-
Thanks for that mate, great stuff. One more, I'm having an issue setting the Captain EFIS for the ILS - is the following the right way to make a single call to MobiFlight?
|
Beta Was this translation helpful? Give feedback.
-
If you want to fire off a single event you can just place the name of the event: {
"index": 2,
"event_press": "MobiFlight.A320_Neo_PFD_BTN_LS_1"
}, Some events have an option of passing a value with them, for those you can either use the manual event or the condition event. |
Beta Was this translation helpful? Give feedback.
-
That makes way more sense, thanks @maartentamboer . This does throw a warning "WARNING: Event MobiFlight.A320_Neo_PFD_BTN_LS_1, was not found in simconnect list. Using a manual binding". I'm assuming this is fine (edit: should've set "type" to "manual" to suppress this message) - however I'm not getting the expected result. I was hoping to control this button but so far without success. Is there anything I'm missing? |
Beta Was this translation helpful? Give feedback.
-
Is it possible that you read and print sample has some missing or wrong brackets? |
Beta Was this translation helpful? Give feedback.
-
I've made the baro somewhat more complicated .. ;)
NB The events.txt does require the following lines to be added, best to put them in the >> // A32X FBW - GLARE << section.
|
Beta Was this translation helpful? Give feedback.
-
Woah nice config. The website is on its way. I hopefully have some time tonight to push it to the repo and configure the github action so it will be automatically published |
Beta Was this translation helpful? Give feedback.
-
Website is live at https://dev-tty.nl/X-Touch-Mini-FS2020/ I've opened up a discussion over at #48 to further discuss website content / snippets and so on. Since this issue has deviated quite a bit from the original LVAR issue. |
Beta Was this translation helpful? Give feedback.
-
Since the conditional triggers in this topic are becoming quite complex, I've just made a new release that enables you to have the conditional trigger in a seperate file. This means you can also get syntax highlighting in Visual Studio Code with the https://marketplace.visualstudio.com/items?itemName=samuelcolvin.jinjahtml plugin. Nice benefit is that these conditional-file triggers can now be reused accross multiple config files Example: Download is at https://github.com/maartentamboer/X-Touch-Mini-FS2020/releases/tag/v1.4.0 |
Beta Was this translation helpful? Give feedback.
-
Coming back to the Lvars, do you have an idea if we can get the value of the MobiFlight Lvars? For example, I have these Lvars in MobiFlight's events.txt: A320_Neo_MFD_NAV_MODE_1_LS#0 (>L:A320_Neo_MFD_NAV_MODE_1) Is there a way to get the value of L:A320_Neo_MFD_NAV_MODE_1? But it's not working, the value I get for that Lvar is 'None' |
Beta Was this translation helpful? Give feedback.
-
With the mobiflight plugin we call events and then they set the value in the simulator. It appears that they don't provide any simvars |
Beta Was this translation helpful? Give feedback.
-
Thanks a lot! I have asked the question in MobiFlight's forum. :) |
Beta Was this translation helpful? Give feedback.
-
Does anyone have the description of the format used in MobiFlight's |
Beta Was this translation helpful? Give feedback.
-
The first part appears the event that you can call using simconnect, between the braces () stands the variable that you want to write it to. I think it works like this: |
Beta Was this translation helpful? Give feedback.
-
I’ve modded the code so you can use a new function data.get_mobiflightsimvar_value(‘L:A320_Neo_MFD_NAV_MODE_1’) I’ve sent a pull request to Maarten with the modded code |
Beta Was this translation helpful? Give feedback.
-
New release has been made: https://github.com/maartentamboer/X-Touch-Mini-FS2020/releases/tag/v1.7.0 |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
If those are the new variables, I guess you would need to add them to Mobiflight as well (if not done already). |
Beta Was this translation helpful? Give feedback.
-
See a solution here #89 |
Beta Was this translation helpful? Give feedback.
-
I've tried mimicking other variables in the events txt but I don't really understand how it works so I don't think I'm doing it right. And it doesn't work obviously. Is there a tutorial somewhere that illustrates the process of adding new variables? |
Beta Was this translation helpful? Give feedback.
-
Hi Maarten,
I'm wondering if it's possible to set LVAR such as A32NX ones described here https://github.com/flybywiresim/a32nx/blob/master/docs/a320-simvars.md
More generally, where can I find some documentation about the way the code should be written in type condition events?
Thank you for the great job you're doing.
Beta Was this translation helpful? Give feedback.
All reactions