Skip to content
Sebastian M edited this page Jun 6, 2022 · 1 revision

Expression-Engine (complex formulas)

With the expression engine syntax you are able to perform more complex calculations in an easy way. Additionally to the original "multiply"-field on the FSUIPC-tab in the Config Wizards you have more freedom for setting and calculating values.

If you have a look at the FSUIPC documentation, there are a bunch of offset values that need to be transformed prior to displaying them, for example on a 7 segment LED Display. One example for such a value is the "Current Heading". If the value is smaller than 0, you have to add 360 degrees. This cannot be achieved with the "multiply". Formulas that make use of the Expression Engine syntax can be put into the "If-Set-It-To-Else-Set-It-To"-fields on the "Comparison"-Tab.

The current value after the multiply operation can be referenced by using the "$"-symbol. It can appear various times in a formula if needed.

Example "Current Heading"

https://www.mobiflight.com/tl_files/en/documentation/software/mfconnector-config-wizard-expression-example-current-heading.png

Example "Leading 1 for COM/NAV"

When you read out the Offset value for the, e.g. COM1 you will see that it does not contain the leading "1". So instead of 126.50 you will get 2650 only. Let's simply add 10000 in any case so that we don't have to care about this when displaying the value on a MAX7219 LED Display. The comparison tab would then look like this:

https://www.mobiflight.com/tl_files/en/documentation/software/mfconnector-config-wizard-expression-example-com1.png

To the original value in all cases 10000 is added converting 2650 into 12650. For the Display you then add the decimal point and everything works like one expects it.

Advanced formulas

The expression engine syntax supports more complex stuff. You can use parenthesis as you know it from your math classes ;)and also there are mathematical functions available (Sin, Cos) and logical functions like known from Excel. The logical functions are used for input in the example configuration, e.g. for the COM1

https://www.mobiflight.com/tl_files/en/documentation/software/mfconnector-config-wizard-expression-input-com1-left.png In the "value"-field the following "if"-expression
if($>1900,$-100,$+1800)

is used. We want to reduce the MHz-part of COM1 reading every time the "On Left" event is triggered. The solution is more or less straight forward and easy to read if you are familiar with Excel. As long as the current value is greater than 1900 (119.00) we can reduce it by 100 ($-100). If the value of the COM1 reading already is smaller than 1900, e.g. (1850) 118.50, we want to make sure that it "wraps around" going up to 3650 (136.50). Therefore 1800 is added.

A complete documentation can be found on the Website of the expression engine library.

Hint:**Currently no real validation of your formula is performed. If the formula has a problem then an error message will be shown when the configuration is executed.

Installation

User Interface

Examples and tutorials

MSFS2020

X-Plane

Workshops

Community Boards & Devices

Additional Information

Firmware

Clone this wiki locally