Hello,
Voici le code que j'ai pu mettre au point concernant le MCP oc adapté à une utilisation A320 (Wilco) (FSX pour ma part mais ça doit aussi marcher pour FS9): je sais qu'effectivement ce MCP est plus dévolu au 737NG mais bon...
Dernière chose: la gestion du mach n'est pas super fidèle puisque le bouton C/O chez Wilco 320 n'est pas émulable par key (même chose d'ailleurs pour le bouton ATHR) la conf des keys est dispo dans l'utilitaire de configuration de l'avion. La philosophie générale que j'ai adopté est un clic (par exemple sur le bouton SPEED) pour le mode managé (affichage d'un ---) et un double clic sur ce même bouton pour le mode sélecté (avec affichage de la valeur courante). L'état Cold'N Dark de l'avion est aussi géré: le MCP ne s'allumera que sur action bouton de la batterie :) .
En espérant que ce code puisse servir à qqun dans le même cas que moi (je passe à l'adaptation de mon MCP pour la serie Ejet Wilco et 747PMDG :) )
N'hésitez pas à m'indiquer toute boulette ou quoi que ce soit
Bon WE à tous
//******************************************** FICHIER TXT DEscriptION AVION *****************************************************
Var 0000 Value 0
{
// init emulated buttons:
v279 = 0
v281 = 0
v283 = 0
v284 = 0
&D_COURSE1 = -999999 // Affiche --- au lieu d'un nombre
&D_COURSE2 = -999999 // Affiche --- au lieu d'un nombre
&D_ALT = -999999 // Affiche --- au lieu d'un nombre
&D_HDG = -999999 // Affiche --- au lieu d'un nombre
&D_IAS = -999999 // Affiche --- au lieu d'un nombre
&D_VS = -999999 // Affiche --- au lieu d'un nombre
&VSMINUSd = 10 // Affiche rien
&BATT = 0 // Le coldndark dans l'état de la batterie
&I_CO = 1
}
Var 1 name Key Link KEYS
Var 3 name COLDNDARK
Var 0076, name O_DECIMAL, Link IOCARD_OUT, Output 20
Var 0078, name O_N1, Link IOCARD_OUT, Output 21
Var 0080, name O_AT, Link IOCARD_OUT, Output 22
Var 0082, name O_SPDLed, Link IOCARD_OUT, Output 23
Var 0084, name O_LVLCHG, Link IOCARD_OUT, Output 24
Var 0086, name O_VNAV, Link IOCARD_OUT, Output 25
Var 0088, name O_HDGHLDLed, Link IOCARD_OUT, Output 26
Var 0090, name O_APP, Link IOCARD_OUT, Output 27
Var 0092, name O_VORLOC, Link IOCARD_OUT, Output 28
Var 0094, name O_LNAV, Link IOCARD_OUT, Output 29
Var 0096, name O_ALTHLD, Link IOCARD_OUT, Output 30
Var 0098, name O_VS, Link IOCARD_OUT, Output 31
Var 0100, name O_CWSA, Link IOCARD_OUT, Output 32
Var 0102, name O_CMDA, Link IOCARD_OUT, Output 33
Var 0104, name O_CWSB, Link IOCARD_OUT, Output 34
Var 0106, name O_CMDB, Link IOCARD_OUT, Output 35
////////////////////// AP MASTER SWITCH /////////////////////
Var 0002, name AP_MASTER_SW, Link FSUIPC_INOUT, Offset $07BC, Length 4
{
IF &COLDNDARK = 1
IF &ON_GROUND = 0
{
IF &CMD = 1
{
IF &AP_MASTER_SW = 1
{
&O_CMDA = 1
&O_CMDB = 0
}
ELSE
{
&O_CMDA = 0
&O_CMDB = 0
}
}
ELSE
{
IF &AP_MASTER_SW = 1
{
&O_CMDA = 0
&O_CMDB = 1
}
ELSE
{
&O_CMDA = 0
&O_CMDB = 0
}
}
}
}
Var 0050, name CMD
{
IF &COLDNDARK = 1
IF &ON_GROUND = 0
{
IF &CMD = 1
{
&O_CMDA = TESTBIT &AP_MASTER_SW ,0 // LED_AP_SW
}
ELSE
{
&O_CMDB = TESTBIT &AP_MASTER_SW ,0 // LED_AP_SW
}
}
}
Var 0054, name T_IAS
Var 0056, name T_MACH
Var 0010, name APD_HDG, Link FSUIPC_INOUT, Offset $07CC, Length 2 // APD_HDG
Var 0011, name BATT, Link FSUIPC_INOUT, offset $281C, length 4 // Interrupteur Batterie
{
IF &BATT = 0
{
&COLDNDARK = 0
&O_DECIMAL = 0
&O_N1 = 0
&O_AT = 0
&O_SPDLed = 0
&O_LVLCHG = 0
&O_VNAV = 0
&O_HDGHLDLed = 0
&O_APP = 0
&O_VORLOC = 0
&O_LNAV = 0
&O_ALTHLD = 0
&O_VS = 0
&O_CWSA = 0
&O_CMDA = 0
&O_CWSB = 0
&O_CMDB = 0
&D_COURSE1 = -999999
&D_IAS = -999999
v68 = -999999
&D_VS = -999999
&VSMINUSd = 10
&D_ALT = -999999
}
ELSE
{
&COLDNDARK = 1
&D_COURSE1 = 0
&Key = 2
&Key = 0
&D_IAS = -999998
&Key = 4
&Key = 0
v68 = -999998
&Key = 5
&Key = 0
&D_VS = -999998
&VSMINUSd = 11
L0 = &APD_ALT * 0.00005006164
&D_ALT = L0
}
}
Var 0018, name APD_ALT, Link FSUIPC_INOUT, Offset $07D4, Length 4 // APD_ALT
Var 0020, name AP_MACH, Link FSUIPC_INOUT, Offset $07E4, Length 4 // AP_MACH
Var 0023, name ON_GROUND, Link FSUIPC_IN, offset $0366, Length 2 // =1 si a/c au sol
{
IF &ON_GROUND = 0
{
&O_SPDLed = 0 // S'il s'agit d'un décollage
&O_DECIMAL = 0 // on deselecte IAS managé
&D_IAS = -999998 // Affiche --- au lieu du nombre
}
}
Var 0026, name APD_VS, Link FSUIPC_INOUT, Offset $07F2, Length 2 // D_V/S
{
IF &COLDNDARK = 1
IF &ON_GROUND = 0
{
L0 = &APD_VS // IN L0 THE VALUE
C0 = TESTBIT &APD_VS ,15 // It verifies if he is Negative
IF C0
{
&VStemp = L0 - 65536 // he is negative
}
ELSE
{
&VStemp = L0 // is not negative
}
CALL &VSsub // It puts value in display
}
}
Var 1012, name VStemp // Temporary value of the V/S
Var 1011, name VSsub, Link SUBRUTINE // Subrutine for the - of the VS
{
IF &COLDNDARK = 1
{
IF &O_VS = 1
{
IF &VStemp < 0
{
L0 = ABS &VStemp
&VSMINUSd = 11
}
ELSE
{
&VSMINUSd = 10
L0 = &VStemp
}
&D_VS = L0
}
ELSE
{
&VSMINUSd = 11
}
}
}
Var 0072, name D_VS, Link IOCARD_DISPLAY, Digit 14, Numbers 4
Var 0008, name VSMINUSd, Link IOCARD_DISPLAY, Digit 18, Numbers 1 // VS -SIGN
Var 0028, Link FSUIPC_INOUT, Offset $0810, Length 4 // AP_AT
{
IF &COLDNDARK = 1
{
IF V0028 = 1
{
&O_AT = 1
}
ELSE
{
&O_AT = 0
}
}
}
Var 0030, Link FSUIPC_INOUT, Offset $2EE0, Length 4 // AP_FD
Var 0034, Link FSUIPC_INOUT, Offset $0800, Length 4 // AP_APP
{
IF &COLDNDARK = 1
{
IF V0034 = 1
{
&O_VORLOC = 1
&O_APP = 1
}
ELSE
{
&O_VORLOC = 0
&O_APP = 0
}
}
}
Var 0140, name IP_APP, Link IOCARD_SW, Input 24
{
IF &COLDNDARK = 1
{
IF &IP_APP = 1
{
IF V0034 <> 1
{
V0034 = 1
}
ELSE
{
V0034 = 0
}
}
}
}
Var 0040, name APD_COURSE1, Link FSUIPC_INOUT, Offset $0C4E, Length 2 // APD_COURSE1
Var 0042, name APD_COURSE2, Link FSUIPC_INOUT, Offset $0C5E, Length 2 // APD_COURSE2
Var 0066, name D_IAS, Link IOCARD_DISPLAY, Digit 3, Numbers 3
Var 0068, name D_HDG, Link IOCARD_DISPLAY, Digit 6, Numbers 3
{
IF &COLDNDARK = 1
{
L1 = &D_HDG * 182.04444
L0 = L1 + 1
&APD_HDG = L0
}
}
Var 0070, name D_ALT, Link IOCARD_DISPLAY, Digit 9, Numbers 5
Var 279 // emulated type P button
Var 281 // emulated Type P button
Var 283 // emulated type P button
Var 284 // emulated type P button
//////////////////////////////// CRS ////////////////////////////
Var 0064, name D_COURSE1, Link IOCARD_DISPLAY, Digit 0, Numbers 3
{
IF &COLDNDARK = 1
{
&APD_COURSE1 = &D_COURSE1
}
}
Var 0074, name D_COURSE2, Link IOCARD_DISPLAY, Digit 19, Numbers 3
{
IF &COLDNDARK = 1
{
&APD_COURSE2 = &D_COURSE2
}
}
Var 0112, name E_COURSE1, Link IOCARD_ENCODER, Input 4, Aceleration 4, Type 2
{
IF &COLDNDARK = 1
{
L0 = &E_COURSE1 * -1
&D_COURSE1 = ROTATE 0 ,359 ,L0
}
}
///////////////////////////// FD //////////////////////////////
Var 0126, name I_FD1, Link IOCARD_SW, Input 16
{
IF &COLDNDARK = 1
{
IF &I_FD1 = 1
{
V0030 = 1
}
ELSE
{
V0030 = 0
}
}
}
//////////////////// SPEED ///////////////////////
Var 4633 name Button_1 Link IOCARD_SW Input 31 Type I // = OC SPD Button
{
IF &COLDNDARK = 1
{
IF &Button_1 = 1
{
IF &SButton_1 = 0
{
&SButton_1 = 1
&Double_1 = 0
&SButton_1 = DELAY 3 70
}
ELSE
{
IF &SButton_1 = 1
{
&SButton_1 = 2
}
}
}
ELSE
{
IF &SButton_1 = 2
{
&Double_1 = 1
v279 = CHANGEBITN 0 v279 // DOUBLE CLICKED: SPD Intervention
&Key = 1
&Key = 0
&O_SPDLed = 1
&O_DECIMAL = 0 // Vitesse forcément affichée en Kts
&D_IAS = &APD_IAS
&I_CO = 0
}
}
}
}
Var 4634 name Double_1
Var 4635 name SButton_1 // state of Button_1
{
IF &COLDNDARK = 1
{
IF &SButton_1 = 3
{
&SButton_1 = 0 // reset
IF &Double_1 <> 1
{
v281 = CHANGEBITN 0 v281 // SINGLE CLICKED: SPD
&Key = 2
&Key = 0
&O_SPDLed = 0
&O_DECIMAL = 0
&D_IAS = -999998 // Affiche --- au lieu du nombre
}
}
}
}
Var 0108, name E_IAS, Link IOCARD_ENCODER, Input 0, Aceleration 4, Type 2
{
IF &COLDNDARK = 1
{
IF &I_CO = 0
{
L0 = &E_IAS * -1
&T_IAS = &APD_IAS
&T_IAS = LIMIT 100 ,360 ,L0
&O_DECIMAL = 0
&D_IAS = &T_IAS
&APD_IAS = &T_IAS
}
ELSE
{
L0 = &E_IAS * -1
&T_MACH = &APD_MACH * 0.00152587890625 // Conversion MACH -> DIGIT
&T_MACH = LIMIT 50 ,99 ,L0
&O_DECIMAL = 1
&D_IAS = &T_MACH
&APD_MACH = &T_MACH / 0.00152587890625 // Conversion DIGIT -> MACH
}
}
}
Var 0120, name I_CO, Link IOCARD_SW, Input 13, Type P // O/C INPUT SWITCH
{
IF &COLDNDARK = 1
{
IF &I_CO = 0
{
&O_DECIMAL = 0
&D_IAS = &APD_IAS
}
ELSE
{
&O_DECIMAL = 1
&D_IAS = &APD_MACH * 0.00152587890625 // Conversion MACH -> DIGIT
}
}
}
Var 0016, name APD_IAS, Link FSUIPC_INOUT, Offset $07E2, Length 2 // APD_IAS
{
IF &COLDNDARK = 1
{
IF &O_SPDLed = 1
{
IF &I_CO = 0
{
&O_DECIMAL = 0
&D_IAS = &APD_IAS
}
}
ELSE
{
&O_DECIMAL = 0
&D_IAS = -999998 // Affiche --- au lieu du nombre
}
}
}
Var 0022, name APD_MACH, Link FSUIPC_INOUT, Offset $07E8, Length 4 // APD_MACH
{
IF &COLDNDARK = 1
{
IF &O_SPDLed = 1
{
IF &I_CO = 1
{
&O_DECIMAL = 1
&D_IAS = &APD_MACH * 0.00152587890625
}
}
ELSE
{
&O_DECIMAL = 0
&D_IAS = -999998 // Affiche --- au lieu du nombre
}
}
}
//////////////////////////////// HDG /////////////////////////////
// double click button support:
// (needed because of shortage of buttons in the OC MCPNG737)
Var 4630 name Button_0 Link IOCARD_SW Input 28 Type I // = OC HDG SEL button
{
IF &COLDNDARK = 1
{
IF &Button_0 = 1
{
IF &SButton_0 = 0
{
&SButton_0 = 1
&Double_0 = 0
&SButton_0 = DELAY 3 70
}
ELSE
{
IF &SButton_0 = 1
{
&SButton_0 = 2
}
}
}
ELSE
{
IF &SButton_0 = 2
{
&Double_0 = 1
// v283 = CHANGEBITN 0 v283 // DOUBLE CLICKED: HDG HLD
v283 = 1
v284 = 0
v1 = 3
v1 = 0
L0 = &APD_HDG / 182.04444
v68 = L0
&O_HDGHLDLed = 1
}
}
}
}
Var 4631 name Double_0
Var 4632 name SButton_0 // state of Button_0
{
IF &COLDNDARK = 1
{
IF &SButton_0 = 3
{
&SButton_0 = 0 // reset
IF &Double_0 <> 1
{
// v284 = CHANGEBITN 0 v284 // SINGLE CLICKED: HDG SEL
v284 = 1
v283 = 0
v1 = 4
v1 = 0
v68 = -999998 // Affiche --- au lieu du nombre
&O_HDGHLDLed = 0
}
}
}
}
Var 0114, name E_HDG, Link IOCARD_ENCODER, Input 6, Aceleration 4, Type 2
{
IF &COLDNDARK = 1
{
IF &O_HDGHLDLed = 1
{
L0 = &E_HDG * -1
&D_HDG = ROTATE 0 ,359 ,L0
}
}
}
/////////////////////////////// CMD/CWS /////////////////////////
Var 0130, name I_CMDB, Link IOCARD_SW, Input 19
{
IF &COLDNDARK = 1
IF &ON_GROUND = 0
{
IF &I_CMDB = 1
{
&CMD = 2
IF &AP_MASTER_SW = 1
{
&AP_MASTER_SW = 0
}
ELSE
{
&AP_MASTER_SW = 1
}
}
}
}
Var 0134, name I_CMDA, Link IOCARD_SW, Input 21
{
IF &COLDNDARK = 1
IF &ON_GROUND = 0
{
IF &I_CMDA = 1
{
&CMD = 1
IF &AP_MASTER_SW = 1
{
&AP_MASTER_SW = 0
}
ELSE
{
&AP_MASTER_SW = 1
}
}
}
}
/////////////////////////////// ALT SELECTION //////////////////////////////
Var 0117, name E_ALT, Link IOCARD_ENCODER, Input 2, Aceleration 1, Type 2
{
IF &COLDNDARK = 1
{
IF &E_ALT = 1
{
&Key = 9
&Key = 0
}
IF &E_ALT = -1
{
&Key = 10
&Key = 0
}
}
}
Var 4639 name Button_3 Link IOCARD_SW Input 23 Type I // = OC ALT Button
{
IF &COLDNDARK = 1
{
IF &Button_3 = 1
{
IF &SButton_3 = 0
{
&SButton_3 = 1
&Double_3 = 0
&SButton_3 = DELAY 3 70
}
ELSE
{
IF &SButton_3 = 1
{
&SButton_3 = 2
}
}
}
ELSE
{
IF &SButton_3 = 2
{
&Double_3 = 1
&Key = 12
&Key = 0 // Un click
&O_ALTHLD = 1
L0 = &APD_ALT * 0.00005006164
&D_ALT = L0
}
}
}
}
Var 4640 name Double_3
Var 4641 name SButton_3 // state of Button_3
{
IF &COLDNDARK = 1
{
IF &SButton_3 = 3
{
&SButton_3 = 0 // reset
IF &Double_3 <> 1
{
&Key = 11 // Double click
&Key = 0
&O_ALTHLD = 0
L0 = &APD_ALT * 0.00005006164
&D_ALT = L0
}
}
}
}
/////////////////////////////// VS //////////////////////////////
Var 0118, name E_VS, Link IOCARD_ENCODER, Input 11, Aceleration 4, Type 2
{
IF &COLDNDARK = 1
{
IF &O_VS = 1
{
IF &E_VS = 1
{
&Key = 7
&Key = 0
}
IF &E_VS = -1
{
&Key = 8
&Key = 0
}
}
}
}
Var 4636 name Button_2 Link IOCARD_SW Input 22 Type I // = OC V/S Button
{
IF &COLDNDARK = 1
IF &ON_GROUND = 0
{
IF &Button_2 = 1
{
IF &SButton_2 = 0
{
&SButton_2 = 1
&Double_2 = 0
&SButton_2 = DELAY 3 70
}
ELSE
{
IF &SButton_2 = 1
{
&SButton_2 = 2
}
}
}
ELSE
{
IF &SButton_2 = 2
{
&Double_2 = 1
&Key = 5
&Key = 0
&O_VS = 1 // Un click
&D_VS = &APD_VS
}
}
}
}
Var 4637 name Double_2
Var 4638 name SButton_2 // state of Button_2
{
IF &COLDNDARK = 1
IF &ON_GROUND = 0
{
IF &SButton_2 = 3
{
&SButton_2 = 0 // reset
IF &Double_2 <> 1
{
&Key = 6 // Double click
&Key = 0
&O_VS = 0
&D_VS = -999998 // Affiche ----- au lieu du nombre
&VSMINUSd = 11
}
}
}
}
Var 4643 name T_ALT
Var 4642 name FS_ALT, Link FSUIPC_IN, Offset $3324, Length 4 // VALEUR D'ALTITUDE REELLE POUR DESACTIVER VS
{
IF &COLDNDARK = 1
{
&T_ALT = &APD_ALT * 0.00005006164
L0 = &FS_ALT - &T_ALT // SI L'ALTITUDE EST PROCHE (500FT) DE LA CONSIGNE
&T_ALT = ABS L0
IF &T_ALT < 500
{
&O_VS = 0
&D_VS = -999998 // Affiche ----- au lieu du nombre
&VSMINUSd = 11
}
}
}
//*********************************************** FICHIER SIOC.INI ASSOCIE *********************************************************
[Fichero de configuracion para el SIOC]
[ Configuration file for SIOC ]
Version=3.5
generated_by=Config_SiocIni
[SIOC]
IOCP_port=8092
IOCP_timeout=4000
Minimized=Yes
toggle_delay=10
CONFIG_FILE=C:\Essai MCP\Wilco_A320_5.txt
[IOCARDS MODULE]
IOCard_disable=No
IOCard_LPT=No
[MASTERS]
MASTER=0,5,1,27
[USBSTEPPER]
[USBKEYS]
[USBSERVOS]
[USBRELAYS]
[USBMOTOR]
[USBANALOGIC]
[FSUIPC MODULE]
FSUipcdisable=No
FSUipcRefresh=100
[IOCP CLIENTS MODULES]
IOCPini_delay= 3000
IOCPclient0_disable=Yes
IOCPclient0_host=localhost
IOCPclient0_port=8090
IOCPclient1_disable=Yes
IOCPclient1_host=localhost
IOCPclient1_port=8099
[SOUND MODULE]
Sound_disable=Yes
Volume=100
[ #1 ]
Sound=*outermk.wav,-1,-1,-1
[KEYBOARD EMULATOR MODULE]
window= "Microsoft Flight Simulator X"
#1=
#2=
#3=
#4=
#5="
#6='
#7=(
#8=-
#9=
#10=_
#11=
#12=<$
[ End of File ]