IO32, SIOC et HVAR de MSFS

fab

PILOTE DE BROUSSE
Messages
5 837
Réactions
961
Points
1 001
Si vous comprenez le titre de ce sujet, c'est que vous cherchez comme moi à agir sur les boutons d'un GNS430, d'un G1000, d'un CDU et autre composant d'un avion MSFS ...

Le but étant d'avoir des switch sur une IO32, et de pouvoir les interfacer avec les instruments spécifiques des avions.

C'est chose faite avec l'utilisation des offset $3110 et $3114 de FSUIPC.
L'astuce est de déclarer dans FSUIPC une liste "d'event" que vous allez pourvoir déclencher par un script ...

Je prépare une vidéo tuto pour cela ...

Restez à l'écoute, je reviens ...

Fabien
 
Super Fab...:)
Pourrais tu en profiter pour renseigner à un non-initié qui n'a pas MSFS, ce qu'est une variable HVAR, please.;)

Je sais, je sais... Je n'ai pas utilisé Google.:giggle:
 
Les Lvars, que je traduis par variables locales sont des variables specifique aux avions, les Hvar sont des déclencheur d'actions comme des appuies sur des touches du GPS ou CDU.
 
Une définition trouvée sur Google :

LVAR is a local variable in XML model behavior code. LVARs are defined by the developer and their name can be whatever you like.

(L:Hi_Im_A_local_variable,number)

SimVar is an A or E variable. Simvars are defined by the sim and allow the developer to read the values of the aircraft and environment variables.


HVAR is a HTML variable. These are used in XML model behavior code to trigger an event in a HTML gauge.
 
Les Lvars, que je traduis par variables locales sont des variables specifique aux avions, les Hvar sont des déclencheur d'actions comme des appuies sur des touches du GPS ou CDU.
Merci Fab...
Pour les LVARs, je connais bien depuis FSX.
Par contre, pour les HVARs, n'ayant pas le produit, je ne voyais pas à quoi cela pouvait faire référence.;)
 
  • Like
Les réactions: fab
En attendant ma vidéo tuto, pour votre culture générale, je vous laisse découvrir un extrait de la doc du SDK de MSFS...

Variable PrefixSystem NameDescriptionUnits

A​

Simulation VariableGets a specified SimVar from a simulation object.Yes

B​

Input EventsGets the value of the specified input event (see Input Event Definitions for more information).No

C​

Callback VariablesThis variable prefix is only used when dealing with GPS Variables.Yes

E​

Environment VariableThis is an environment variable. See the section on Environment Variables, below.Yes

F​

Function LibraryThis denotes a built in function from the function library. See the Function Library section below for more details.No

G​

Gauge VariablesGets a variable that can be used to transfer unitless data between gauges.No

H​

HTML EventAn HTML event sent to the JavaScript. These are defined in cockpit panel Model Behaviors, and only go in one direction: from the panel to the JavaScript / HTML code. H: events are not required to be defined ahead of time (similar to L: vars) and can be named with any contiguous string of alphanumeric characters. Each cockpit panel in Microsoft Flight Simulator sends a number of cockpit specific H: events that have no analogous key event, such as pressing individual buttons on an FMS computer. These individual panel specific events can be received by JavaScript instruments.No

I​

Instrument VariableUsed for variables within components, where the variable scope is the component and it's children.No

K​

Key Event IDThis is a specific variable for a key Event IDfor user input.
(>K:TOGGLE_ICS)
Note that some key events require one or more values to be sent, so please see the section SimVars And Keys for more information on this.
No

L​

Local VariableRetrieves and/or creates a user defined local variable. If the local variable has not been defined in any of the associated files then it will be created and set to 0 the very first time it is referenced (and will not persist between runs). You can, however, define a default value for local variables using the following files:
This variable can be read and set within the scope of the user aircraft, and can be read by AI Aircraft.
IMPORTANT! "L:" vars can only hold numeric data and nothing else, eg: no strings, no binary values, no structs, etc...
No

M​

Mouse VariableGets the state of the mouse for use in mouse click handlers. Please see the Mouse Variables section below.No

O​

Component VariableUsed for variables within components, where the variable scope is the component itself.No

P​

Program VariableSame as the Environment Variable E:Yes

R​

Resource VariableThis is used to retrieve a value from an external resource, which can either be a legacy Help ID or Tooltip ID, or something from a custom localization file. See Resource Variables for more details.

X​

Calculator VariableThis variable is used exclusively when creating Mission Definitions and is for referencing parameters created in the <CalculatorParameterList> element within an RPN calculation (inside a <CalculatorFormula>).No

W​

Wwise EventThis is a Wwise Event ID and allows you to trigger a Wwise event based on logic driven by the XML. This makes it more flexible than the sounds defined in sound.cfg and the AnimSoundEvents, although more complex to use.No

Z​

Custom SimVarThese are user-defined variables which are stored in an object's sim. The variable name is not one that has been predefined in the Microsoft Flight Simulator engine code, so anyone can create one with the name they want, as long as it doesn't conflict with an existing SimVar.No

Sources : https://docs.flightsimulator.com/html/Additional_Information/Reverse_Polish_Notation.htm
 
Alors accrochez-vous, c'est parti ...

Avant tout, présentation du matériel et du résultat :



L'envers du décor :




Le fichier "events.txt" du répertoire racine de FSUIPC utilisé pour cette demo

! Pensez à renommer le fichier d'origine avant d'en créer un nouveau !

Code:
AS530_RNG_Dezoom#(>H:AS530_RNG_Dezoom) //4194304 ($400000)
AS530_RNG_Zoom#(>H:AS530_RNG_Zoom) ////4194305
AS530_DirectTo_Push#(>H:AS530_DirectTo_Push) //4194306
AS530_MENU_Push#(>H:AS530_MENU_Push) //4194307
AS530_CLR_Push#(>H:AS530_CLR_Push) //4194308
AS530_ENT_Push#(>H:AS530_ENT_Push) //4194309
AS530_RightLargeKnob_Left#(>H:AS530_RightLargeKnob_Left) //4194310
AS530_RightLargeKnob_Right#(>H:AS530_RightLargeKnob_Right) //4194311
AS530_RightSmallKnob_Left#(>H:AS530_RightSmallKnob_Left) //4194312
AS530_RightSmallKnob_Push#(>H:AS530_RightSmallKnob_Push) //4194313
AS530_RightSmallKnob_Right#(>H:AS530_RightSmallKnob_Right) //4194314

Le script SIOC utilisé pour cette demo :

Code:
// *****************************************************************************
// * Config_SIOC ver 5.2   -     By Manuel Velez    -    www.opencockpits.com
// *****************************************************************************
// * FileName : FDcontrolHVAR.txt
// * Date : 16/02/2023
// * Fabien Deheegher


// ****************** Offset de controle *************************************************
Var 0001, name CONTROLH, Link FSUIPC_INOUT, Offset $3110, Length 4
{
  CALL &RESET
}

Var 0002, name VALUE, Link FSUIPC_INOUT, Offset $3114, Length 4
// *******************************************************************


// ************** Votre code à partir d'ici ****************
Var 0003, name RNGINC, Link IOCARD_SW, Input 0
{
  IF &RNGINC = 1
  {
    &CONTROLH = 4194304
  }
}

Var 0004, name RNGDEC, Link IOCARD_SW, Input 1
{
  IF &RNGDEC = 1
  {
    &CONTROLH = 4194305
  }
}

Var 0005, name DIRECT, Link IOCARD_SW, Input 2
{
  IF &DIRECT = 1
  {
    &CONTROLH = 4194306
  }
}

Var 0006, name MENU, Link IOCARD_SW, Input 3
{
  IF &MENU = 1
  {
    &CONTROLH = 4194307
  }
}

Var 0007, name CLR, Link IOCARD_SW, Input 4
{
  IF &CLR = 1
  {
    &CONTROLH = 4194308
  }
}

Var 0008, name ENT, Link IOCARD_SW, Input 5
{
  IF &ENT = 1
  {
    &CONTROLH = 4194309
  }
}

Var 0009, name LKNR, Link IOCARD_SW, Input 6
{
  IF &LKNR = 1
  {
    &CONTROLH = 4194311
  }
}

Var 0010, name LKNL, Link IOCARD_SW, Input 7
{
  IF &LKNL = 1
  {
    &CONTROLH = 4194310
  }
}

Var 0011, name KNRPUSH, Link IOCARD_SW, Input 10
{
  IF &KNRPUSH = 1
  {
    &CONTROLH = 4194313
  }
}


Var 00012, name ENC_GR_DR, Link IOCARD_ENCODER, Input 8, Aceleration 1, Type 2
{
  IF &ENC_GR_DR < 0
  {
    &CONTROLH = 4194314
  }
  IF &ENC_GR_DR > 0
  {
    &CONTROLH = 4194312
  }
}



// Sous programme de remise à zero de l'offset
Var 5000, name RESET, static, Link SUBRUTINE
{
  &CONTROLH = DELAY 0 ,5
}
 
Retour
Haut