ABOUT, PROJECTSBLOG COMMUNITY TERMS of Use BARON 58

<<<      Conditional Input/output Configuration

Often behaviour of some outputs or inputs needs to be configured to depend on other parameters. Sometimes it required tricky logic to set up all the required functionality.

Variations of outside conditions that can influence I/O include switching modes using buttons or encoders, switching modes or disabling outputs based on dataref value, such as insufficient power, and so on.

In SimVimCockpit Interface, the whole logic for these functions was reworked to make them all unified and allow greater control over various conditions. The main idea now is that each config line can by dynamically enabled or disabled.

For example, you may have a single encoder for radio, which would switch between different COM/NAV (1 and 2) modes with a press of one button, and between MHz/KHz with a press of another button or buttons, or some switch can become

You may need a display (LCD, 7-segment) to be used for output different data or be turned off depending on some data values. Such condition, for example, can be used to disable a 7-segment radio display when the power failure has occured in the simulator, along with any encoders and buttons associated with it.


Any line can have separate parameters indicating what mode number and what mode switch it corresponds to. A line can even have several mode switches configured to it, making things like the encoder example described earlier more easy to implement.


SimVim special functions

Input state or 2-mode Switch or Button (On/Off) - "Mode_Switch"

Switches between 2 different modes according to pin state.

Single button to switch cyclically between several modes - "Mode Button"

Toggles several modes in a cycle. Each button click activates the next mode in a row.

Mode Set button group or Rotary switch - "Mode_Group"

A group of buttons assigned to several Arduino (or extension) pins in a row. Each button activates its corresponding mode number. For rotary switch mode = position.

Analog Input condition - "Analog_State"

Used for a condition to check the current position of an analog input, in the range of 0-1024.

LED output (or digital output signal) - "Mode_LED"

A LED (or digital output) that switches to ON state when specified conditions are met.

Group of LEDs (or digital outputs) - "Mode_LED_Group"

A group of LEDs assigned to several Arduino (or extension) pins in a row. References the corresponding set of modes (Mode_Button, Mode_Group). Only one LED is ON, based on the current mode number.



MODE Switch options

Example: You have a mode button on pin 5 and mode switch on pin 6:

B5	Mode_Button
S6	Mode_Switch

Mode switch has 2 states. Mode button can have more than 2 states, and cycles through them with each click. Default is 2. To increase the number of states the button has, add the "n" option to it with the desired number. For example:

B5		Mode_Button		n=4

Use the "c" option in the controlled I/O config lines to link them to the mode button/switch state. For example:

E10		Some_Param_Set		c=B5:1
E10		Some_Param_Set		c=B5:2
E10		Some_Param_Set		c=B5:3
E10		Some_Param_Set		c=B5:4

E12		Com1_k25_Set		c=S6:1
E12		Com1_Mhz_Set		c=S6:2

For the Mode_Switch, state 1 is OFF, and state 2 is ON. Some other, more convenient ways of linking the mode buttons with the controlled parameters may also be added later.


Conditions

Conditions are placed in the configuration file under the [Conditions] category, and can be used to enable and disable inputs or outputs based on the value of a specified dataref. The dataref conditions can be used intermittently with mode buttons for determining the working state of a particular config line.

Any config line can have any combination of conditions the determine if this line is "Active". For example, if an output has the option "c=B6:2,C1>10", that means that this output will only work when the mode button B6 is in mode state 2, and the value of the dataref specified in Condition 1 is greater than 10.

Configuration

First, mark the "Assign condition parameters" checkbox to switch into condition assignment mode, and select any of the output parameters to act as condition. Then, return to normal configuration mode, and when you assign a new input or output, you'll be able to select the "Link to conditions" option before selecting a pin, which will allow you to link any of the assigned conditions to this parameter, so that this paramater will only be active in your configuration when these conditions are met.

Select a condition parameter from the list, select the comparison type and type in the value to compare it to, and click "Add condition". The condition for this parameter will be added to the list, and you can add several other conditions to it this way, so that the parameter will only be active when all conditions are met.

If you've added mode buttons or mode switches to your configuration, they will also be available as conditions for other parameters.


Start Up

The [Startup] section of the configuration file allows you to list the parameters to be set at simulator startup. This function is rarely required and not included in the Configurator. You can add this manually (using any pre-defined SimVim names) in your data file, for example:

[Startup]======================

Instr_Brightness_1_Set		v=0.5

This will set instrument brightness value to 0.5 when X-Plane starts. If you reload SimVimCockpit configuration while X-Plane is running, startup parameters that were already set will not be changed again. Only new parameters that you add into the Startup section will be set when you reload the configuration.






© Copyright 2012-2018 - SimVim Design