MobiFlight Community Support

Welcome to the forum for MobiFlight! Feel free to reach out to the community in case you have questions, issues or just want to share great ideas or details about your latest home cockpit project.

You like MobiFlight? Donate via PayPal and support the MobiFlight development. Thanks! 

05/03/2024 - This forum is read-only

The community support for MobiFlight has moved exclusively over to our Discord server. Register for free and enjoy more interactive functions like image and video upload, voice chat. More than 7,000 registered users around the world make it a great experience!

See you on our MobiFlight Community Discord server.

A HUGE Thank You to everyone who participated in the forum, especially obviously to Pizman and Stephan who did an outstanding job over so many years providing an incredible service to the MobiFlight community.

The forum is still providing a lot of good content, hence we keep this information accessible.

icon
Avatar
kingofpain
Posts: 5
Hello,

I'am pretty new to this stuff and just started playing around with my new Arduino since yesterday. In general my test so far were successful but I have a question regarding using the Event-ID instead of the FSUICP offset values:
At least MF only gives the opportunity to set a Event-ID plus a parameter-value. But it seems I can't use formulas here, right?

Will there be an opportunity to change that in future? Background is that I'am trying to get some things working with the FCU of the A320 (FS2020). For example I want a single push button for switching between the altitude-hold mode (managed / manual). Using the FSUICP offsets I would do something like "if($=1,2,1)" as parameter, but for Event-IDs this won't work.

Of course I could use two push-buttons and assign them individually, but thats not my goal ;-).

Any ideas? ;-)
2020-10-06 08:12
Avatar
StephanHo
Moderator
From: EDDG, Germany
Posts: 1867
Supporter
Hi kingofpain,

welcome to MobiFlight.

If you are pretty new to this stuff you have to know that there are two kinds of actions. 1st are the EventIDs. These are the inputs for the sim. Here you can move a switch and transmit a certain value to the sim which represents an action. It is not required to transmit a result of a condition. You switch something on or off, you turn a rotary switch and transmit via a paramter the position of the rotary. This should not be linked to a condition.
Therefore it won't be realized in the future.
What you want to do is the readout of an offset and at the same time you want to manipulate it by a switch position.

2nd are the outputs. This are the offsets you can read out from the sim. This ones can be manipulated with a formula in the transformline.

If you want to transmit a specific parameter via EventID set it with the setting of the switch. Read out the switch via offset (if possible) and manipulate it in transform.
For your project you can take a latching switch. If you set it on, transmit an 1 and if you switch it off transmit a 2.
Grüße,
Stephan (Time: UTC+2)
2020-10-06 08:28
Avatar
kingofpain
Posts: 5
Hi StephanHo,

I understand what you told about the EventIDs. But anyway - I thought it would be nice to have an opportunity to switch between two parameter values using one switch/button (thats because I was asking if there might be the opportunity in future).
Sure, on a lot of EventIDs that might have no sence, but for some it might be quide useful, because they use different parameter-values.

You are right, I could use a latching switch for that but I was searching for a more elegant way ;-)
2020-10-06 08:53
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6010
Supporter
A easy question that need a detailed and complex awnser!

Your right. It´s not posible to set a formula in Input Typ EventID !

I still think about that.... Cause YES There exist some rare situations, this would be verry usefull. BUT as i said in last sentence.... this situations are extremly rare !
The master problem of this implemention is the missing value ! . A EventID ( instead of a "FSUIPC Offset" Input Typ) NOT read a Offset itself. So in the current UI it would be not possible to Say something like $+1 or if($=1,0,1) cause "$" can not be difined if no value is readout basicly.
Sure.... Today we got "placeholders" So in theory we can use here instead of "$" a variable like "a" .... So "a" is defined by the value of a output config ( we read e.g. a switch position).
But years ago when Sebastian build the basic Code for MF and the Input Logic those refferences not already exist..... So there is no posibility a.t.m. to use Variables in the Input section cause the "refferences field" is only useable in Output Tabs.
Summary: No readout Value and no access to placeholders means a formula is not possible !


Now about the neednes.... As i said... "rare" . Cause if we would allow to define a "$" here.... So the EventID Config additional allow to read a Offset and build a formula..... Then this is unprofitable.... Cause if a Offset exist we could diretly wrtie it via "FSUIPC Offset" in 99% of cases.
Same with Placeholders.... I just know 2-3 situations in many years i would ever need this.... And those was all custom builds that was not realsitic !


Solution:
Here the key is "time" . Your master Problem a.t.m. is that FSUIPC is not finished.... So many many things are missing. If the needed Offset ( for that switch) come in and is also writeable then you not need the EventID.... Then you write the Offset with your formula.
AddOn Aircrafts will support pretty sure EventID´s that are logical. Mean if your Switch got multiple positions then it will alow Position Parameters. If your Swtich needs to toggle in the Sim then the Event will be a Toggle Input.
BUT
What not be possible finaly is using unlogical inputs if the AddOn Puplisher not like this. so If e.g. PMDG say a System use a Latching 2 Position switch it will not support you a toggle EventID Cause they simply recommend to you to use also a latching Switch with SET parameters instead of a button that toggle between 1 and 0 .
Good Luck !
2020-10-06 16:13
Avatar
kingofpain
Posts: 5
Thanks for the detailed answer.

I got the point that my intention is not the way the implementation of Event-IDs was made.

I'am totally with you that my idea does not reflect the real-life situation. Because there I would need an encoder with an push/pull option (means two separate switches). Than I could implement this quite easy.

So I think I will have to wait until more features/offsets will be implemented in FSUICP.

Anyway, thanks for you help.
2020-10-06 18:29
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6010
Supporter
Hold On !!

You ask me if a EventID can include a formula. I awnser you it can not !
I explane you why.
But that NOT means we have no other way ! . Cause waiting is badly not one of my talents.... So i´m the guy who start now thinking and try to build a improvisional solution.

To help you, i must understand the situation. Tell me ( or better show me) what you like to controll.... and how it work in the sim.
Then you tell me what hardware you plan to use and how THIS should finaly work.
Then we find out if there is a logical way to handle this and finaly we need to build a config ( with some more deeper tricks i found over the years to let Mobiflight do things, it not want to do on first view ! For example via Custom Offsets, Dual layer Inputs or reversed preconditions!

If you like. Call me on DISCORD. There we got voice and can talk and share screen. Mostly a problem can be solved if we both work together!
Good Luck !
2020-10-06 21:44
Avatar
kingofpain
Posts: 5
Sorry, I'am not on DISCORD so far - so I could not accept this invite :-)

But I appreciate your engagement and I think I can describe what I was trying.

So...I'am working with the new FS2020 and the Airbus A320. Try to make a small FCU panel. My issue with the EventID came up as I want to build a functional ALT-selector. Setting the altitude-value works with the FSUICP offset value, no problem. But the offset for "altitude hold" does not work in the A320. Seems it did'nt recognize it.
So I checked the FSUIPS console and it tells me the following EventIDs when I push/pull the ALT-selector button on the A320:
Push (managed mode): 137250 *** EVENT: Cntrl= 68067 (0x000109e3), Param= 2 (0x00000002) ALTITUDE_SLOT_INDEX_SET
Pull (manual mode): 141938 *** EVENT: Cntrl= 68067 (0x000109e3), Param= 1 (0x00000001) ALTITUDE_SLOT_INDEX_SET

So both actions use the same EventID 68067 and just switches between Param-value 1 and 2.

I now want to use a KY-040 push encoder to control the altitude-value with the rotary encoder (works already) and the push-button of the encoder to switch the altitude hold-mode (via the EventID).

As I have some fundamental programming skills, I thought it might be possible to alter the Param value. Because in that particular case there is nothing to "read" from the Sim - just sending the EventID with the set param-value.

I think it's the same procedure with the speed and the heading-knob on the A320.
2020-10-06 22:09
Avatar
timsmithlx
Posts: 1
Hi kingofpain

So I wanted to do exactly the same as you... and managed to "bodge" a way of making an encoder push action a toggle for managed / selected modes

here's how (repeat for each encoder / attribute):

STEP 1
in the output tab create a new output - Call it say "ALT TOGGLE PRECONDITION" and set it up as follows:
- Offset = 0x66C2 (if your not using it already ... or any other user offset)
- Value Type = Int size = 1
- Mask = 0xFF


STEP 2
now create a new input - called "ALTTOGGLE FLIP FLIP" and set as follows:
- On press
- FSUIPC OFFSET
- Offset = 0x66C2 (or what you used above)
- Value Type = Int Size = 1
- Mask = 0xFF
Set Value = if($=0,1,0)

STEP 3
now create a new input - called "ALT MANGED" and set up as follows:
in the precondition tab, tick the box by NONE then

- Use Type = Config Item
- Choose Config = ALT TOGGLE PRECONDITION (or the name you gave it in Step 1
- if current value is = "=" (equals) "1"

In the input tab set as follows:

-On press
- Action Type = Event ID
- EventID = 68067 (Altitude) i think speed was 68066 maybe
- Param = 2


STEP 4
now create a new input - called "ALT SELECTED" and set up as follows:
in the precondition tab, tick the box by NONE then

- Use Type = Config Item
- Choose Config = ALT TOGGLE PRECONDITION (or the name you gave it in Step 1
- if current value is = "=" (equals) "0"

In the input tab set as follows:

-On press
- Action Type = Event ID
- EventID = 68067 (Altitude) i think speed was 68066 maybe
- Param = 1





If all goes well this should have created a toggle push button that will flip flop between managed / selected

Let me know if you need screenshots etc

:)
2020-10-09 21:42
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6010
Supporter
Hi Guys.

In case of busy days in my Job i was not be able to awnser . Apollogy for that.

So thank you tim smith .... Thats 100% the same idea i also like to recommend.

Just note one little disadvantage here. ! The Custom Offset is by default "0" at first systemstart of the Sim. So if you press the button first time it will execute the command you use with Precondition "0" . If "0" is used e.g. by "ALT Selected" like in the example and the Virtual button is still in alt selected at the moment then this first press will do nothing ( it set the switch to the same position it is still in the sim) . Sure. On second usage and from now all time the system work fine!
To avoid this situation you should set the switch position that mostly happen at systemstart in the sim as precondition "1" ..... Then also the first usage is corect !


About the future:

- If FSUIPC support us a READ ONLY Offset for the virtual switch we can use this as precondition and avoid that little problem i explane above.
- If FSUIPC support us a fully READ/WRITE Offset we can make a single Toggle Input with a formula like if($=1,2,1)
- if FSUIPC support finaly a "TOGGLE Event ID" ( i don´t think this will come) then we could simply use a event and all is done by the sim itself !


Summary: Now you got a solution ..... But i recommned to rework if we got a better tool by FSUIPC !
Good Luck !
2020-10-10 14:53
Avatar
kingofpain
Posts: 5
Hi again,

the recommended workaround makes sence and I will try this today.

Thanks so far :-)
2020-10-12 08:37
Avatar
Reensel
From: Berlin - EDDB, Germany
Posts: 26
Hi and I know this topic is a bit older but I need to ask you guys in the round how you tackle the override?

This means: I also did the managed/selected programming as Tim smith / pizman mentioned. Works fine :)
But when I do the takeoff (condition during takeoff is managed for SPD/HDG/ALT) and After a Short while I switch the Autopilot ON - the FCU within the Simulator changed into selected mode all 3 parameters. This also means my DIY FCU is not recognizing it because the selected mode will just be selected if I would pull the knob.

Is there any solution in place for that szenario - kind of override function.
Same for when I am in the managed mode and spill the Encoder that this will show me the value when using the encoder and if I am not pulling the knob to „selected“ that you will get the 3 (- - -) back.

Hope I could explained a bit what my actual blocker is :)

Thanks in advance for any hint and help.
2020-12-08 00:41
Avatar
randyx77
Posts: 1
It works perfect this workaround! Thank you!!!

icontimsmithlx:

Hi kingofpain

So I wanted to do exactly the same as you... and managed to "bodge" a way of making an encoder push action a toggle for managed / selected modes

here's how (repeat for each encoder / attribute):

STEP 1
in the output tab create a new output - Call it say "ALT TOGGLE PRECONDITION" and set it up as follows:
- Offset = 0x66C2 (if your not using it already ... or any other user offset)
- Value Type = Int size = 1
- Mask = 0xFF


STEP 2
now create a new input - called "ALTTOGGLE FLIP FLIP" and set as follows:
- On press
- FSUIPC OFFSET
- Offset = 0x66C2 (or what you used above)
- Value Type = Int Size = 1
- Mask = 0xFF
Set Value = if($=0,1,0)

STEP 3
now create a new input - called "ALT MANGED" and set up as follows:
in the precondition tab, tick the box by NONE then

- Use Type = Config Item
- Choose Config = ALT TOGGLE PRECONDITION (or the name you gave it in Step 1
- if current value is = "=" (equals) "1"

In the input tab set as follows:

-On press
- Action Type = Event ID
- EventID = 68067 (Altitude) i think speed was 68066 maybe
- Param = 2


STEP 4
now create a new input - called "ALT SELECTED" and set up as follows:
in the precondition tab, tick the box by NONE then

- Use Type = Config Item
- Choose Config = ALT TOGGLE PRECONDITION (or the name you gave it in Step 1
- if current value is = "=" (equals) "0"

In the input tab set as follows:

-On press
- Action Type = Event ID
- EventID = 68067 (Altitude) i think speed was 68066 maybe
- Param = 1





If all goes well this should have created a toggle push button that will flip flop between managed / selected

Let me know if you need screenshots etc

:)

2020-12-21 15:41
icon