This commit is contained in:
f1iwq2
2022-09-10 17:45:46 +02:00
parent 6dcb74c06c
commit 0de10fc845
16 changed files with 490 additions and 403 deletions
+40 -36
View File
@@ -2,12 +2,15 @@
Fonte=12
IpV4_PC=127.0.0.1:9999
IPV4_INTERFACE=192.168.1.23:5550
PROTOCOLE_SERIE=COM9:57600,N,8,1,2
PROTOCOLE_SERIE=COM5:57600,N,8,1,2
INTER_CAR=50
Tempo_maxi=7
Entete=1
Init_Aig=1
Tempo_Aig=100
Init_Aig=0
Init_Dem_Aig=0
Tempo_Aig=80
Init_demUSBCOM=1
Init_demETH=1
Fenetre=0
nb_det_dist=3
verif_version=0
@@ -15,43 +18,44 @@ NOTIF_VERSION=0
TCO=1
MasqueBandeauTCO=0
CDM=0
Lay=RESEAU_GILY_SIGNAL_AJOUTE.LAY
Lay=
Serveur_interface=1
retro=1
RazSignaux=0
Tempo_Feu=100
Nb_cantons_Sig=3
Alg_Unisemaf=1
/------------
[section_aig]
1,P518,D100D,S3P,V30,I0,INIT(9,5)
2,P12S,D519,S100S,V0,I0,INIT(9,5)
3,P1S,D4P,S5D,V0,I0,INIT(9,5)
4,P3D,D6S,S514,V0,I0,INIT(9,5)
5,P515,D3S,S100S,V0,I0,INIT(9,5)
6,P516,D0,S4D,V0,I0,INIT(9,5)
7,P527,D519,S520,V0,I0,INIT(9,5)
8,P527,D521,S522,V0,I0,INIT(9,5)
9,P526,D513,S515,V60,I0,INIT(9,5)
10,P101S,D29P,S528,V30,I0,INIT(9,5)
11,P18P,D30D,S101D,V0,I0,INIT(9,5)
12,P517,D20S,S2P,V0,I0,INIT(9,5)
17,P525,D535,S528,V0,I0,INIT(9,5)
18,P11P,D23P,S517,V0,I0,INIT(9,5)
19,P101D,D22P,S531,V0,I0,INIT(9,5)
20,P520,D21P,S12D,V0,I0,INIT(9,5)
21,P20D,D28D,S28D,V0,I0,INIT(9,5)
22,P19D,D537,S32P,V0,I0,INIT(9,5)
23,P18D,D538,S534,V0,I0,INIT(9,5)
24,P538,D32S,S533,V0,I0,INIT(9,5)
25,P31S,D529,S27P,V0,I0,INIT(9,5)
26TJD,D(530,28D),S(529,28S),V0,I0,INIT(9,5),E4
27,P25S,D530,S537,V0,I0,INIT(9,5)
28TJD,D(21D,26D),S(21S,26S),V0,I0,INIT(9,5),E4
29,P10D,D513,S30S,V60,I0,INIT(9,5)
30,P524,D11D,S29S,V0,I0,INIT(9,5)
31,P534,D34D,S25P,V0,I0,INIT(9,5)
32,P22S,D34S,S24D,V0,I0,INIT(9,5)
34,P0,D31D,S32D,V0,I0,INIT(9,5)
1,P518,D100D,S3P,V30,I0,INIT(2,5)
2,P12S,D519,S100S,V0,I0,INIT(2,5)
3,P1S,D4P,S5D,V0,I0,INIT(2,5)
4,P3D,D6S,S514,V0,I0,INIT(2,5)
5,P515,D3S,S100S,V0,I0,INIT(2,5)
6,P516,D0,S4D,V0,I0,INIT(2,5)
7,P527,D519,S520,V0,I0,INIT(2,5)
8,P527,D521,S522,V0,I0,INIT(2,5)
9,P526,D513,S515,V60,I0,INIT(2,5)
10,P101S,D29P,S528,V30,I0,INIT(2,5)
11,P18P,D30D,S101D,V0,I0,INIT(2,5)
12,P517,D20S,S2P,V0,I0,INIT(1,5)
17,P525,D535,S528,V0,I0,INIT(2,5)
18,P11P,D23P,S517,V0,I0,INIT(1,5)
19,P101D,D22P,S531,V0,I0,INIT(2,5)
20,P520,D21P,S12D,V0,I0,INIT(2,5)
21,P20D,D28D,S28D,V0,I0,INIT(2,5)
22,P19D,D537,S32P,V0,I0,INIT(2,5)
23,P18D,D538,S534,V0,I0,INIT(2,5)
24,P538,D32S,S533,V0,I0,INIT(2,5)
25,P31S,D529,S27P,V0,I0,INIT(2,5)
26TJD,D(530,28D),S(529,28S),V0,I0,INIT(2,5),E4
27,P25S,D530,S537,V0,I0,INIT(2,5)
28TJD,D(21D,26D),S(21S,26S),V0,I0,INIT(2,5),E4
29,P10D,D513,S30S,V60,I0,INIT(2,5)
30,P524,D11D,S29S,V0,I0,INIT(2,5)
31,P534,D34D,S25P,V0,I0,INIT(1,5)
32,P22S,D34S,S24D,V0,I0,INIT(1,5)
34,P0,D31D,S32D,V0,I0,INIT(2,5)
100CROI,D(1D,523Z),S(2S,5S)
101CROI,D(11S,525Z),S(19P,10P)
0
@@ -101,11 +105,11 @@ A31,A34,0
0
/------------
[section_act]
815,1,CC,F2,0,TGV
815,1,CC406526,F2,0,TGV
Mem[527,520],1,X,"KLAXON_2.WAV"
830,1,ZZ406526,"C:\PROGRAM FILES (X86)\BORLAND\DELPHI7\PROJECTS\SIGNAUX_COMPLEXES_GL\TRN.WAV"
821,1,BB16024,"KLAXON_3.WAV"
815,1,TGV,F10,0,TGV
/------------
(817,830),(820,840),PN(121+,121-)
(850,851),PN(12+,12-)
(527-519,519-517),(530-531,531-532),PN(122+,122-)
0
BIN
View File
Binary file not shown.
+76 -25
View File
@@ -1,9 +1,7 @@
object FormConfig: TFormConfig
Left = 281
Top = 138
Hint =
'Modifie les fichiers de configuration selon les s'#233'lections chois' +
'ies'
Hint = 'Modifie la configuration selon les s'#233'lections choisies'
BorderStyle = bsDialog
Caption = 'Configuration g'#233'n'#233'rale'
ClientHeight = 543
@@ -1582,7 +1580,7 @@ object FormConfig: TFormConfig
Top = 8
Width = 633
Height = 497
ActivePage = TabSheetSig
ActivePage = TabSheetAct
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
Font.Height = -11
@@ -1594,11 +1592,13 @@ object FormConfig: TFormConfig
object TabSheetCDM: TTabSheet
Caption = 'CDM Rail'
object Label36: TLabel
Left = 8
Top = 424
Width = 255
Left = 24
Top = 432
Width = 369
Height = 13
Caption = 'Param'#232'tres de connexion et d'#39#233'change avec CDM rail'
Caption =
'Param'#232'tres de connexion et d'#39#233'change avec CDM rail et param'#232'tres' +
' g'#233'n'#233'raux'
WordWrap = True
end
object GroupBox1: TGroupBox
@@ -1679,7 +1679,7 @@ object FormConfig: TFormConfig
Top = 112
Width = 241
Height = 25
Caption = 'Lancer CDM Rail au d'#233'marrage'
Caption = 'Lancer et connecter CDM Rail au d'#233'marrage'
TabOrder = 2
WordWrap = True
end
@@ -1982,8 +1982,8 @@ object FormConfig: TFormConfig
Caption = 'Mode autonome'
ImageIndex = 1
object Label9: TLabel
Left = 8
Top = 424
Left = 16
Top = 440
Width = 294
Height = 13
Caption = 'Ces param'#232'tres sont utilis'#233's en fonctionnement sans CDM Rail'
@@ -2196,7 +2196,7 @@ object FormConfig: TFormConfig
Left = 8
Top = 296
Width = 297
Height = 113
Height = 129
Caption = 'Au d'#233'marrage de signaux complexes en mode autonome'
TabOrder = 7
object Label32: TLabel
@@ -2234,6 +2234,28 @@ object FormConfig: TFormConfig
Caption = 'Demande positions des aiguillages '#224' la centrale'
TabOrder = 2
end
object CheckBoxDemarUSB: TCheckBox
Left = 16
Top = 88
Width = 273
Height = 17
Hint = 'Connecte l'#39'interface XpressNet en COM ou USB au d'#233'marrage'
Caption = 'Connexion de l'#39'interface Xpressnet en COM ou USB'
ParentShowHint = False
ShowHint = True
TabOrder = 3
end
object CheckBoxDemarEth: TCheckBox
Left = 16
Top = 104
Width = 265
Height = 17
Hint = 'Connecte l'#39'interface XpressNet en Ethernet ou Wifi au d'#233'marrage'
Caption = 'Connexion de l'#39'interface Xpressnet en Ethernet'
ParentShowHint = False
ShowHint = True
TabOrder = 4
end
end
end
object TabSheetAig: TTabSheet
@@ -2715,8 +2737,8 @@ object FormConfig: TFormConfig
WordWrap = True
end
object LabelNumBranche: TLabel
Left = 464
Top = 424
Left = 8
Top = 448
Width = 56
Height = 13
Caption = 'Branche n'#176' '
@@ -2784,6 +2806,30 @@ object FormConfig: TFormConfig
OnKeyDown = RichBrancheKeyDown
OnMouseDown = RichBrancheMouseDown
end
object Memo5: TMemo
Left = 464
Top = 232
Width = 153
Height = 209
Lines.Strings = (
'Une ligne doit commencer par '
'un aiguillage (ou un buttoir) et '
'se terminer par un aiguillage '
'(ou un buttoir). Il n'#39'est pas '
'n'#233'cessaire d'#39'avoir un '
'd'#233'tecteur dans une ligne.'
''
'Un aiguillage peut se retrouver '
#224' plusieurs endroits de cette '
'section, mais pas un d'#233'tecteur. '
''
'Tous les aiguillages d'#233'clar'#233's '
'doivent appara'#238'tre au moins '
'une fois dans les branches.'
'')
ReadOnly = True
TabOrder = 2
end
end
object TabSheetSig: TTabSheet
Caption = 'Signaux'
@@ -3202,7 +3248,7 @@ object FormConfig: TFormConfig
Top = 40
Width = 257
Height = 433
Caption = 'Description de l'#39'actionneur '
Caption = 'Description de l'#39'action'
TabOrder = 0
object Label40: TLabel
Left = 16
@@ -3219,10 +3265,9 @@ object FormConfig: TFormConfig
Top = 16
Width = 225
Height = 345
Hint = 'D'#233'tecteur 1 zone de fermeture'
Caption = 'Actionneurs gestion passage '#224' niveau'
Caption = 'Action gestion passage '#224' niveau'
ParentShowHint = False
ShowHint = True
ShowHint = False
TabOrder = 2
object Label21: TLabel
Left = 8
@@ -3357,6 +3402,9 @@ object FormConfig: TFormConfig
Top = 112
Width = 41
Height = 21
Hint = 'Actionneur 1 fermeture'
ParentShowHint = False
ShowHint = True
TabOrder = 4
OnChange = EditV1FChange
end
@@ -3397,6 +3445,9 @@ object FormConfig: TFormConfig
Top = 112
Width = 41
Height = 21
Hint = 'Actionneur 1 ouverture'
ParentShowHint = False
ShowHint = True
TabOrder = 9
OnChange = EditV1OChange
end
@@ -3574,11 +3625,11 @@ object FormConfig: TFormConfig
end
end
object GroupBoxRadio: TGroupBox
Left = 168
Left = 32
Top = 24
Width = 225
Height = 73
Caption = 'Type d'#39'actionneur '
Caption = 'Type d'#39'action'
TabOrder = 0
object RadioButtonLoc: TRadioButton
Left = 24
@@ -3609,11 +3660,11 @@ object FormConfig: TFormConfig
end
end
object GroupBoxAct: TGroupBox
Left = 112
Top = 12
Left = 24
Top = 92
Width = 225
Height = 293
Caption = 'Actionneur fonction de locomotive '
Caption = 'Action fonction de locomotive '
TabOrder = 1
object GroupBox18: TGroupBox
Left = 8
@@ -3669,7 +3720,7 @@ object FormConfig: TFormConfig
Height = 21
Hint =
'Train d'#233'clencheur pour lequel la condition s'#39'applique (mettre X ' +
'pour tous les trains)'
'pour tous les trains) - d'#233'clenchement par actionneur uniquement'
ParentShowHint = False
ShowHint = True
TabOrder = 2
@@ -3715,7 +3766,7 @@ object FormConfig: TFormConfig
Top = 160
Width = 209
Height = 113
Caption = 'Action '
Caption = 'Destinataire de l'#39'action '
TabOrder = 1
object LabelTempo: TLabel
Left = 48
+62 -10
View File
@@ -280,6 +280,9 @@ type
EditZdet2V4F: TEdit;
EditZdet1V4O: TEdit;
EditZdet2V4O: TEdit;
CheckBoxDemarUSB: TCheckBox;
CheckBoxDemarEth: TCheckBox;
Memo5: TMemo;
procedure ButtonAppliquerEtFermerClick(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure FormCreate(Sender: TObject);
@@ -416,6 +419,8 @@ IpV4_PC_ch='IpV4_PC';
retro_ch='retro';
Init_aig_ch='Init_Aig';
Init_dem_aig_ch='Init_Dem_Aig';
Init_dem_interfaceUSBCOM_ch='Init_demUSBCOM';
Init_dem_interfaceEth_ch='Init_demETH';
LAY_ch='Lay';
IPV4_INTERFACE_ch='IPV4_INTERFACE';
PROTOCOLE_SERIE_ch='PROTOCOLE_SERIE';
@@ -933,7 +938,7 @@ begin
delete(s,1,1);
val(s,adr,erreur); // adresse
c:=#0;
if erreur<>0 then c:=s[erreur]; // type
if erreur<>0 then c:=s[erreur]; // type
setlength(feux[i].AigDirection[k],j+1); // augmenter le tableau dynamique
feux[i].AigDirection[k][j].PosAig:=c;
feux[i].AigDirection[k][j].Adresse:=adr;
@@ -1248,6 +1253,14 @@ begin
// temporisation initialisation des aiguillages
writeln(fichierN,Tempo_aig_ch+'=',IntToSTR(Tempo_aig));
// connexion de l'interface en COM/USB
if AvecDemandeInterfaceUSB then s:='1' else s:='0';
writeln(fichierN,Init_dem_interfaceUSBCOM_ch+'='+s);
// connexion de l'interface en Ethernet
if AvecDemandeInterfaceEth then s:='1' else s:='0';
writeln(fichierN,Init_dem_interfaceEth_ch+'='+s);
// plein écran
writeln(fichierN,Fenetre_ch+'=',fenetre);
@@ -1363,7 +1376,7 @@ var s,sa,chaine,SOrigine: string;
trouve_Tempo_maxi,trouve_Entete,trouve_tco,trouve_cdm,trouve_Serveur_interface,trouve_fenetre,trouve_MasqueTCO,
trouve_NOTIF_VERSION,trouve_verif_version,trouve_fonte,trouve_tempo_aig,trouve_raz,trouve_section_aig,
pds,trouve_section_branche,trouve_section_sig,trouve_section_act,fichier_trouve,trouve_tempo_feu,
trouve_algo_uni,croi,trouve_Nb_cantons_Sig,trouve_dem_aig : boolean;
trouve_algo_uni,croi,trouve_Nb_cantons_Sig,trouve_dem_aig,trouve_demcnxCOMUSB,trouve_demcnxEth : boolean;
bd,virgule,i_detect,i,erreur,aig2,detect,offset,index, adresse,j,position,temporisation,invers,indexPointe,indexDevie,indexDroit,
ComptEl,Compt_IT,Num_Element,k,modele,adr,adr2,erreur2,l,t,Nligne,postriple,itl,
postjd,postjs,nv,it,Num_Champ,asp,adraig,poscroi : integer;
@@ -2060,7 +2073,6 @@ begin
AvecInitAiguillages:=s='1';
end;
// avec demande de position des aiguillages en mode autonome au démarrage
sa:=uppercase(Init_dem_aig_ch)+'=';
i:=pos(sa,s);
@@ -2071,6 +2083,28 @@ begin
delete(s,i,length(sa));
AvecDemandeAiguillages:=s='1';
end;
// avec demande de connexion en COM USB au démarrage
sa:=uppercase(Init_dem_interfaceUSBCOM_ch)+'=';
i:=pos(sa,s);
if i=1 then
begin
trouve_demcnxCOMUSB:=true;
inc(nv);
delete(s,i,length(sa));
AvecDemandeInterfaceUSB:=s='1';
end;
// avec demande de connexion en ethernet au démarrage
sa:=uppercase(Init_dem_interfaceEth_ch)+'=';
i:=pos(sa,s);
if i=1 then
begin
trouve_demcnxEth:=true;
inc(nv);
delete(s,i,length(sa));
AvecDemandeInterfaceEth:=s='1';
end;
// taille de la fenetre
sa:=uppercase(fenetre_ch)+'=';
@@ -2308,6 +2342,8 @@ begin
trouve_verif_version:=false;
trouve_Fonte:=false;
trouve_Raz:=false;
trouve_demcnxCOMUSB:=false;
trouve_demcnxEth:=false;
Nb_Det_Dist:=3;
// initialisation des aiguillages avec des valeurs par défaut
@@ -2343,6 +2379,8 @@ begin
TempoOctet:=50;
TimoutMaxInterface:=7;
AvecInitAiguillages:=true;
AvecDemandeInterfaceUSB:=true;
AvecDemandeInterfaceEth:=true;
Tempo_Aig:=100;
Tempo_feu:=100;
ServeurInterfaceCDM:=1;
@@ -2379,6 +2417,9 @@ begin
if not(trouve_Algo_Uni) then s:=Algo_unisemaf_ch;
if not(trouve_Nb_cantons_Sig) then s:=Nb_cantons_Sig_ch;
if not(trouve_dem_aig) then s:=Init_dem_aig_ch;
if not(trouve_demcnxCOMUSB) then s:=Init_dem_interfaceUSBCOM_ch;
if not(trouve_demcnxEth) then s:=Init_dem_interfaceEth_ch;
if not(trouve_tempo_feu) then
begin
s:=tempo_feu_ch;
@@ -2392,6 +2433,7 @@ begin
if s<>'' then
begin
affiche('Manque variables dans '+NomConfig+' : '+s,clOrange);
Affiche('Elles seront régénérées automatiquement',clOrange);
confasauver:=true;
end;
if not(trouve_section_aig) then Affiche('Manque section '+section_aig_ch,clred);
@@ -2557,6 +2599,9 @@ begin
Raz_Acc_signaux:=CheckBoxRazSignaux.checked;
AvecInitAiguillages:=CheckBoxInitAig.Checked;
AvecDemandeAiguillages:=checkPosAig.checked;
AvecDemandeInterfaceUSB:=CheckBoxDemarUSB.checked;
AvecDemandeInterfaceEth:=CheckBoxDemarEth.checked;
end;
if change_srv then services_CDM;
verifie_panneau_config:=ok;
@@ -2703,6 +2748,9 @@ begin
CheckBoxRazSignaux.checked:=Raz_Acc_signaux;
CheckBoxInitAig.checked:=AvecInitAiguillages;
CheckPosAig.checked:=AvecDemandeAiguillages;
CheckBoxDemarUSB.checked:=AvecDemandeInterfaceUSB;
CheckBoxDemarEth.checked:=AvecDemandeInterfaceEth;
clicListe:=true; // empeche le traitement de l'evt text
EditDroit_BD.Text:='';
@@ -3129,7 +3177,7 @@ begin
positionne;
CheckRaz.Visible:=false;
GroupBoxAct.Caption:='Actionneur de fonction F de locomotive';
GroupBoxAct.Caption:='Action pour fonction F de locomotive';
LabelTempo.Visible:=true; EditTempo.visible:=true; editEtatFoncSortie.visible:=false;LabelA.Visible:=false;
LabelFonction.visible:=true;
LabelFonction.caption:='Action : Fonction';
@@ -3154,7 +3202,7 @@ begin
begin
positionne;
GroupBoxAct.Caption:='Actionneur d''accessoire';
GroupBoxAct.Caption:='Action pour accessoire';
CheckRaz.Visible:=true;
LabelTempo.Visible:=false; EditTempo.visible:=false;editEtatFoncSortie.visible:=true;LabelA.Visible:=true;
LabelFonction.visible:=true;
@@ -3179,7 +3227,7 @@ begin
with formconfig do
begin
Positionne;
GroupBoxAct.Caption:='Actionneur d''accessoire';
GroupBoxAct.Caption:='Action pour son';
CheckRaz.Visible:=true;
LabelTempo.Visible:=false; EditTempo.visible:=false;
@@ -3223,10 +3271,11 @@ end;
// mise à jour des champs du signal d'après le tableau feux
Procedure aff_champs_sig_feux(index : integer);
var i,j,l,d,k,nc,condCarre : integer;
var i,j,l,d,p,k,nc,condCarre : integer;
s : string;
begin
if Affevt then affiche('Aff_champs_sig_feux('+intToSTR(index)+')',clyellow);
clicListe:=true;
i:=index;
FormConfig.EditAdrSig.text:=InttoSTr(feux[i].adresse);
@@ -3343,13 +3392,13 @@ begin
// conditions d'affichage du signal directionnel
L:=feux[i].aspect-10; //nombre de feux du signal directionnel
for j:=1 to L+1 do
for p:=1 to L+1 do
begin
s:='';
nc:=Length(feux[i].AigDirection[j])-1;
nc:=Length(feux[i].AigDirection[p])-1;
for k:=1 to nc do
begin
s:=s+'A'+IntToSTR(feux[i].AigDirection[j][k].adresse) + feux[i].AigDirection[j][k].posaig;
s:=s+'A'+IntToSTR(feux[i].AigDirection[p][k].adresse) + feux[i].AigDirection[p][k].posaig;
if k<nc then s:=s+',';
end;
MemoCarre.Lines.Add(s);
@@ -3359,6 +3408,7 @@ begin
MemoCarre.Perform(EM_SCROLLCARET,0,0);
end;
end;
clicListe:=false;
end;
@@ -8261,6 +8311,8 @@ begin
end;
begin
end.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+14 -16
View File
@@ -114,11 +114,11 @@ begin
7 : dessine_feu7(VCanvas,0,0,1,1,EtatFeupilote,1);
9 : dessine_feu9(VCanvas,0,0,1,1,EtatFeupilote,1);
// indicateurs de direction
12 : dessine_dir2(VCanvas,EtatFeupilote);
13 : dessine_dir3(VCanvas,EtatFeupilote);
14 : dessine_dir4(VCanvas,EtatFeupilote);
15 : dessine_dir5(VCanvas,EtatFeupilote);
16 : dessine_dir6(VCanvas,EtatFeupilote);
12 : dessine_dirN(VCanvas,0,0,1,1,EtatFeupilote,1,2);
13 : dessine_dirN(VCanvas,0,0,1,1,EtatFeupilote,1,3);
14 : dessine_dirN(VCanvas,0,0,1,1,EtatFeupilote,1,4);
15 : dessine_dirN(VCanvas,0,0,1,1,EtatFeupilote,1,5);
16 : dessine_dirN(VCanvas,0,0,1,1,EtatFeupilote,1,6);
end;
end;
@@ -221,19 +221,17 @@ begin
end;
procedure TFormPilote.ButtonPiloteClick(Sender: TObject);
var i,e : integer;
var i,index,e : integer;
begin
i:=index_feu(AdrPilote);
if feux[i].aspect<10 then
index:=index_feu(AdrPilote);
if feux[index].aspect>10 then
begin
feux[i].EtatSignal:=feux[0].EtatSignal;
envoi_signal(AdrPilote);
end
else
begin
val(EditNbreFeux.Text,i,e);
pilote_direction(AdrPilote,i);
end;
val(EditNbreFeux.Text,i,e);
feux[0].EtatSignal:=i;
pilote_direction(AdrPilote,i);
end;
feux[index].EtatSignal:=feux[0].EtatSignal;
envoi_signal(AdrPilote);
end;
procedure TFormPilote.EditNbreFeuxKeyPress(Sender: TObject; var Key: Char);
BIN
View File
Binary file not shown.
+28 -16
View File
@@ -1,8 +1,8 @@
object FormPrinc: TFormPrinc
Left = 6
Top = 246
Top = 203
Width = 1213
Height = 664
Height = 670
Caption = 'Client TCP-IP CDM Rail ou USB - syst'#232'me LENZ'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
@@ -19,7 +19,7 @@ object FormPrinc: TFormPrinc
OnCreate = FormCreate
DesignSize = (
1197
606)
612)
PixelsPerInch = 96
TextHeight = 13
object LabelTitre: TLabel
@@ -1203,9 +1203,9 @@ object FormPrinc: TFormPrinc
end
object ScrollBox1: TScrollBox
Left = 632
Top = 176
Top = 192
Width = 546
Height = 385
Height = 391
HorzScrollBar.Smooth = True
HorzScrollBar.Tracking = True
VertScrollBar.Smooth = True
@@ -1232,7 +1232,7 @@ object FormPrinc: TFormPrinc
end
object EditAdresse: TEdit
Left = 72
Top = 24
Top = 20
Width = 49
Height = 21
Hint = 'Adresse accessoire'
@@ -1264,7 +1264,7 @@ object FormPrinc: TFormPrinc
end
object StatusBar1: TStatusBar
Left = 0
Top = 584
Top = 590
Width = 1197
Height = 22
Panels = <>
@@ -1293,8 +1293,8 @@ object FormPrinc: TFormPrinc
Width = 89
Height = 33
Hint =
'Mise '#224' jour des feux suivant les zones occup'#233'es et les aiguillag' +
'es'
'Mise '#224' jour des signaux suivant les zones occup'#233'es et les aiguil' +
'lages'
Caption = 'Rafraichissement'
TabOrder = 0
OnClick = BoutonRafClick
@@ -1383,7 +1383,7 @@ object FormPrinc: TFormPrinc
end
object StaticText: TStaticText
Left = 16
Top = 565
Top = 571
Width = 14
Height = 17
Anchors = [akLeft, akRight, akBottom]
@@ -1394,7 +1394,7 @@ object FormPrinc: TFormPrinc
Left = 8
Top = 32
Width = 601
Height = 529
Height = 535
Anchors = [akLeft, akTop, akRight, akBottom]
Color = clBlack
Font.Charset = DEFAULT_CHARSET
@@ -1477,7 +1477,7 @@ object FormPrinc: TFormPrinc
Left = 632
Top = 64
Width = 265
Height = 105
Height = 129
Anchors = [akTop, akRight]
Caption = 'Commande aux trains'
TabOrder = 9
@@ -1511,7 +1511,7 @@ object FormPrinc: TFormPrinc
end
object loco: TButton
Left = 6
Top = 64
Top = 88
Width = 83
Height = 33
Caption = 'Envoi vitesse '#224' loco'
@@ -1533,6 +1533,7 @@ object FormPrinc: TFormPrinc
Height = 21
TabOrder = 2
Text = '30'
OnChange = EditVitesseChange
end
object ComboTrains: TComboBox
Left = 112
@@ -1553,7 +1554,7 @@ object FormPrinc: TFormPrinc
end
object ButtonFonction: TButton
Left = 176
Top = 64
Top = 88
Width = 81
Height = 33
Caption = 'Envoi fonction '#224' loco'
@@ -1568,6 +1569,18 @@ object FormPrinc: TFormPrinc
Height = 21
TabOrder = 5
end
object TrackBarVit: TTrackBar
Left = 16
Top = 64
Width = 233
Height = 21
Hint = 'Vitesse loco en %'
Ctl3D = False
Max = 100
ParentCtl3D = False
TabOrder = 7
OnChange = TrackBarVitChange
end
end
object Timer1: TTimer
Interval = 100
@@ -1768,8 +1781,7 @@ object FormPrinc: TFormPrinc
end
end
object PopupMenuFeu: TPopupMenu
Left = 800
Top = 144
Left = 896
object Proprits1: TMenuItem
Caption = 'Propri'#233't'#233's'
OnClick = Proprits1Click
+215 -259
View File
@@ -1,10 +1,10 @@
Unit UnitPrinc;
(********************************************
programme signaux complexes Graphique Lenz
delphi 7 + activeX Tmscomm + clientSocket
Delphi 7 + activeX Tmscomm + clientSocket
ou RadStudio
********************************************
19/6/2022 21h
note sur le pilotage des accessoires:
Pilotage des accessoires:
raquette octet sortie
+ 2 = aiguillage droit = sortie 2 de l'adresse d'accessoire
- 1 = aiguillage dévié = sortie 1 de l'adresse d'accessoire
@@ -127,6 +127,7 @@ type
BoutonRazTrains: TButton;
Demandetataccessoires1: TMenuItem;
LancerCDMrail1: TMenuItem;
TrackBarVit: TTrackBar;
procedure FormCreate(Sender: TObject);
procedure MSCommUSBLenzComm(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
@@ -192,6 +193,8 @@ type
procedure BoutonRazTrainsClick(Sender: TObject);
procedure Demandetataccessoires1Click(Sender: TObject);
procedure LancerCDMrail1Click(Sender: TObject);
procedure TrackBarVitChange(Sender: TObject);
procedure EditVitesseChange(Sender: TObject);
private
{ Déclarations privées }
procedure DoHint(Sender : Tobject);
@@ -337,7 +340,8 @@ var
Srvc_PosTrain,Srvc_Sig,debugtrames,LayParParam,
Hors_tension2,traceSign,TraceZone,Ferme,parSocketLenz,ackCdm,PremierFD,doubleclic,
NackCDM,MsgSim,succes,recu_cv,AffAigDet,Option_demarrage,AffTiers,AvecDemandeAiguillages,
TraceListe,clignotant,nack,Maj_feux_cours,configNulle,LanceCDM,AvecInitAiguillages : boolean;
TraceListe,clignotant,nack,Maj_feux_cours,configNulle,LanceCDM,AvecInitAiguillages,
AvecDemandeInterfaceUSB,AvecDemandeInterfaceEth : boolean;
tick,Premier_tick : longint;
@@ -353,9 +357,9 @@ var
Ancien_detecteur : array[0..NbMemZone] of boolean; // anciens état des détecteurs et adresses des détecteurs et leur état
detecteur : array[0..NbMemZone] of
record
etat : boolean;
tempo : integer;
train : string;
etat : boolean; // état 0/1 du détecteur
tempo : integer; // temporisation de passage de 1 à 0 pour retarder le démarrage train au feu non rouge
train : string; // nom du train ayant enclenché le détecteur (CDM - pas fiable)
end;
TypeGen : TEquipement;
@@ -464,11 +468,7 @@ procedure dessine_feu4(Acanvas : Tcanvas;x,y : integer;frX,frY : real;EtatSignal
procedure dessine_feu5(Acanvas : Tcanvas;x,y : integer;frX,frY : real;EtatSignal : word;orientation : integer);
procedure dessine_feu7(Acanvas : Tcanvas;x,y : integer;frX,frY : real;EtatSignal : word;orientation : integer);
procedure dessine_feu9(Acanvas : Tcanvas;x,y : integer;frX,frY : real;etatsignal : word;orientation : integer);
procedure dessine_dir2(Acanvas : Tcanvas;EtatSignal : word);
procedure dessine_dir3(Acanvas : Tcanvas;EtatSignal : word);
procedure dessine_dir4(Acanvas : Tcanvas;EtatSignal : word);
procedure dessine_dir5(Acanvas : Tcanvas;EtatSignal : word);
procedure dessine_dir6(Acanvas : Tcanvas;EtatSignal : word);
procedure dessine_dirN(Acanvas : Tcanvas;x,y : integer;frX,frY : real;EtatSignal : word;orientation,N : integer);
procedure Maj_Etat_Signal(adresse,aspect : integer);
procedure Affiche(s : string;lacouleur : TColor);
procedure envoi_signal(Adr : integer);
@@ -615,7 +615,11 @@ end;
// dessine les feux sur une cible à 2 feux dans le canvas spécifié
// x,y : offset en pixels du coin supérieur gauche du feu
// Acanvas : canvas de destination
// x,y : point d'origine de destination
// frX, frY : facteurs de réduction (pour agrandissement)
// EtatSignal : état du signal
// orientation à donner au signal : 1= vertical 2=90° à gauche 3=90° à droite
procedure dessine_feu2(Acanvas : Tcanvas;x,y : integer;frX,frY : real;EtatSignal : word;orientation : integer);
var Temp,rayon,xViolet,YViolet,xBlanc,yBlanc,
LgImage,HtImage : integer;
@@ -953,7 +957,7 @@ begin
if (orientation=2) then
begin
//rotation 90° vers la gauche des feux
//rotation 90° vers la gauche des feux : échange des coordonnées X et Y et translation sur HtImage
ech:=frY;frY:=frX;FrX:=ech;
Temp:=HtImage-yjaune;YJaune:=XJaune;Xjaune:=Temp;
Temp:=HtImage-yBlanc;YBlanc:=XBlanc;XBlanc:=Temp;
@@ -968,7 +972,7 @@ begin
if (orientation=3) then
begin
//rotation 90° vers la droite des feux
//rotation 90° vers la droite des feux : échange des coordonnées X et Y et translation sur LgImage
ech:=frY;frY:=frX;FrX:=ech;
Temp:=LgImage-Xjaune;XJaune:=YJaune;Yjaune:=Temp;
Temp:=LgImage-XSem;XSem:=YSem;YSem:=Temp;
@@ -1032,220 +1036,138 @@ begin
end;
// dessine les feux sur une cible directionnelle à 2 feux
procedure dessine_dir3(Acanvas : Tcanvas;EtatSignal : word);
// dessine les feux sur une cible directionnelle à N feux
procedure dessine_dirN(Acanvas : Tcanvas;x,y : integer;frX,frY : real;EtatSignal : word;orientation,N : integer);
var rayon,x1,x2,x3,y1,y2,y3,x4,y4,x5,y5,x6,y6,LgImage,HtImage,temp : integer;
ech : real;
begin
rayon:=round(6*frX);
if n=2 then x2:=25 else x2:=22;
x1:=11;x3:=33;x4:=43;x5:=53;x6:=63;
y1:=13;y2:=13;y3:=13;y4:=13;y5:=13;y6:=13;
case N of
2 : with Formprinc.Image2Dir.Picture.Bitmap do
begin
LgImage:=Width;
HtImage:=Height;
end;
3 : with Formprinc.Image3Dir.Picture.Bitmap do
begin
LgImage:=Width;
HtImage:=Height;
end;
4 : with Formprinc.Image4Dir.Picture.Bitmap do
begin
LgImage:=Width;
HtImage:=Height;
end;
5 : with Formprinc.Image5Dir.Picture.Bitmap do
begin
LgImage:=Width;
HtImage:=Height;
end;
6 : with Formprinc.Image6Dir.Picture.Bitmap do
begin
LgImage:=Width;
HtImage:=Height;
end;
end;
if (orientation=2) then
begin
//rotation 90° vers la gauche des feux : échange des coordonnées X et Y et translation sur HtImage
ech:=frY;frY:=frX;FrX:=ech;
Temp:=HtImage-y1;y1:=X1;X1:=Temp;
Temp:=HtImage-y2;y2:=X2;X2:=Temp;
Temp:=HtImage-y3;y3:=X3;X3:=Temp;
Temp:=HtImage-y4;y4:=X4;X4:=Temp;
Temp:=HtImage-y5;y5:=X5;X5:=Temp;
Temp:=HtImage-y6;y6:=X6;X6:=Temp;
end;
if (orientation=3) then
begin
//rotation 90° vers la droite des feux : échange des coordonnées X et Y et translation sur LgImage
ech:=frY;frY:=frX;FrX:=ech;
Temp:=LgImage-X1;X1:=Y1;Y1:=Temp;
Temp:=LgImage-X2;X2:=Y2;Y2:=Temp;
Temp:=LgImage-X3;X3:=Y3;Y3:=Temp;
Temp:=LgImage-X4;X4:=Y4;Y4:=Temp;
Temp:=LgImage-X5;X5:=Y5;Y5:=Temp;
Temp:=LgImage-X6;X6:=Y6;Y6:=Temp;
end;
X1:=round(X1*Frx)+x; Y1:=round(Y1*Fry)+Y;
X2:=round(X2*FrX)+x; Y2:=round(Y2*FrY)+Y;
X3:=round(X3*FrX)+x; Y3:=round(Y3*FrY)+Y;
X4:=round(X4*Frx)+x; Y4:=round(Y4*Fry)+Y;
X5:=round(X5*FrX)+x; Y5:=round(Y5*FrY)+Y;
X6:=round(X6*FrX)+x; Y6:=round(Y6*FrY)+Y;
if EtatSignal=0 then
begin
cercle(ACanvas,11,13,6,GrisF);
cercle(ACanvas,22,13,6,GrisF);
cercle(ACanvas,33,13,6,GrisF);
cercle(ACanvas,x1,y1,rayon,GrisF);
cercle(ACanvas,x2,y2,rayon,GrisF);
if N>2 then cercle(ACanvas,x3,y3,rayon,GrisF);
if N>3 then cercle(ACanvas,x4,y4,rayon,GrisF);
if N>4 then cercle(ACanvas,x5,y5,rayon,GrisF);
if N>5 then cercle(ACanvas,x6,y6,rayon,GrisF);
end;
if EtatSignal=1 then
begin
cercle(ACanvas,11,13,6,clWhite);
cercle(ACanvas,22,13,6,GrisF);
cercle(ACanvas,33,13,6,grisF);
cercle(ACanvas,x1,y1,rayon,clWhite);
cercle(ACanvas,x2,y2,rayon,GrisF);
if N>2 then cercle(ACanvas,x3,y3,rayon,GrisF);
if N>3 then cercle(ACanvas,x4,y4,rayon,GrisF);
if N>4 then cercle(ACanvas,x5,y5,rayon,GrisF);
if N>5 then cercle(ACanvas,x6,y6,rayon,GrisF);
end;
if EtatSignal=2 then
begin
cercle(ACanvas,11,13,6,clWhite);
cercle(ACanvas,22,13,6,clWhite);
cercle(ACanvas,33,13,6,grisF);
end;
cercle(ACanvas,x1,y1,rayon,clWhite);
cercle(ACanvas,x2,y2,rayon,clWhite);
if N>2 then cercle(ACanvas,x3,y3,rayon,GrisF);
if N>3 then cercle(ACanvas,x4,y4,rayon,GrisF);
if N>4 then cercle(ACanvas,x5,y5,rayon,GrisF);
if N>5 then cercle(ACanvas,x6,y6,rayon,GrisF);
end;
if EtatSignal=3 then
begin
cercle(ACanvas,11,13,6,clWhite);
cercle(ACanvas,22,13,6,clWhite);
cercle(ACanvas,33,13,6,clWhite);
end;
end;
// dessine les feux sur une cible directionnelle à 4 feux
procedure dessine_dir4(Acanvas : Tcanvas;EtatSignal : word);
begin
if EtatSignal=0 then
begin
cercle(ACanvas,11,13,6,GrisF);
cercle(ACanvas,22,13,6,GrisF);
cercle(ACanvas,33,13,6,GrisF);
cercle(ACanvas,43,13,6,GrisF);
end;
if EtatSignal=1 then
begin
cercle(ACanvas,11,13,6,clWhite);
cercle(ACanvas,22,13,6,GrisF);
cercle(ACanvas,33,13,6,grisF);
cercle(ACanvas,43,13,6,GrisF);
end;
if EtatSignal=2 then
begin
cercle(ACanvas,11,13,6,clWhite);
cercle(ACanvas,22,13,6,clWhite);
cercle(ACanvas,33,13,6,grisF);
cercle(ACanvas,43,13,6,GrisF);
end;
if EtatSignal=3 then
begin
cercle(ACanvas,11,13,6,clWhite);
cercle(ACanvas,22,13,6,clWhite);
cercle(ACanvas,33,13,6,clWhite);
cercle(ACanvas,43,13,6,GrisF);
end;
if EtatSignal=4 then
begin
cercle(ACanvas,11,13,6,clWhite);
cercle(ACanvas,22,13,6,clWhite);
cercle(ACanvas,33,13,6,clWhite);
cercle(ACanvas,43,13,6,clWhite);
end;
if EtatSignal=5 then
begin
cercle(ACanvas,11,13,6,clWhite);
cercle(ACanvas,22,13,6,clWhite);
cercle(ACanvas,33,13,6,clWhite);
cercle(ACanvas,43,13,6,clWhite);
cercle(ACanvas,53,13,6,clWhite);
end;
end;
procedure dessine_dir5(Acanvas : Tcanvas;EtatSignal : word);
begin
if EtatSignal=0 then
begin
cercle(ACanvas,11,13,6,GrisF);
cercle(ACanvas,22,13,6,GrisF);
cercle(ACanvas,33,13,6,GrisF);
cercle(ACanvas,43,13,6,GrisF);
cercle(ACanvas,53,13,6,GrisF);
end;
if EtatSignal=1 then
begin
cercle(ACanvas,11,13,6,clWhite);
cercle(ACanvas,22,13,6,GrisF);
cercle(ACanvas,33,13,6,grisF);
cercle(ACanvas,43,13,6,GrisF);
cercle(ACanvas,53,13,6,GrisF);
end;
if EtatSignal=2 then
begin
cercle(ACanvas,11,13,6,clWhite);
cercle(ACanvas,22,13,6,clWhite);
cercle(ACanvas,33,13,6,grisF);
cercle(ACanvas,43,13,6,GrisF);
cercle(ACanvas,53,13,6,GrisF);
end;
if EtatSignal=3 then
begin
cercle(ACanvas,11,13,6,clWhite);
cercle(ACanvas,22,13,6,clWhite);
cercle(ACanvas,33,13,6,clWhite);
cercle(ACanvas,43,13,6,GrisF);
cercle(ACanvas,53,13,6,GrisF);
end;
if EtatSignal=4 then
begin
cercle(ACanvas,11,13,6,clWhite);
cercle(ACanvas,22,13,6,clWhite);
cercle(ACanvas,33,13,6,clWhite);
cercle(ACanvas,43,13,6,clWhite);
cercle(ACanvas,53,13,6,GrisF);
end;
if EtatSignal=5 then
begin
cercle(ACanvas,11,13,6,clWhite);
cercle(ACanvas,22,13,6,clWhite);
cercle(ACanvas,33,13,6,clWhite);
cercle(ACanvas,43,13,6,clWhite);
cercle(ACanvas,53,13,6,clWhite);
end;
end;
procedure dessine_dir6(Acanvas : Tcanvas;EtatSignal : word);
begin
if EtatSignal=0 then
begin
cercle(ACanvas,11,13,6,GrisF);
cercle(ACanvas,22,13,6,GrisF);
cercle(ACanvas,33,13,6,GrisF);
cercle(ACanvas,43,13,6,GrisF);
cercle(ACanvas,53,13,6,GrisF);
cercle(ACanvas,63,13,6,GrisF);
end;
if EtatSignal=1 then
begin
cercle(ACanvas,11,13,6,clWhite);
cercle(ACanvas,22,13,6,GrisF);
cercle(ACanvas,33,13,6,grisF);
cercle(ACanvas,43,13,6,GrisF);
cercle(ACanvas,53,13,6,GrisF);
cercle(ACanvas,63,13,6,GrisF);
end;
if EtatSignal=2 then
begin
cercle(ACanvas,11,13,6,clWhite);
cercle(ACanvas,22,13,6,clWhite);
cercle(ACanvas,33,13,6,grisF);
cercle(ACanvas,43,13,6,GrisF);
cercle(ACanvas,53,13,6,GrisF);
cercle(ACanvas,63,13,6,GrisF);
end;
if EtatSignal=3 then
begin
cercle(ACanvas,11,13,6,clWhite);
cercle(ACanvas,22,13,6,clWhite);
cercle(ACanvas,33,13,6,clWhite);
cercle(ACanvas,43,13,6,GrisF);
cercle(ACanvas,53,13,6,GrisF);
cercle(ACanvas,63,13,6,GrisF);
cercle(ACanvas,x1,y1,rayon,clWhite);
cercle(ACanvas,x2,y2,rayon,clWhite);
if N>2 then cercle(ACanvas,x3,y3,rayon,clWhite);
if N>3 then cercle(ACanvas,x4,y4,rayon,GrisF);
if N>4 then cercle(ACanvas,x5,y5,rayon,GrisF);
if N>5 then cercle(ACanvas,x6,y6,rayon,GrisF);
end;
if EtatSignal=4 then
begin
cercle(ACanvas,11,13,6,clWhite);
cercle(ACanvas,22,13,6,clWhite);
cercle(ACanvas,33,13,6,clWhite);
cercle(ACanvas,43,13,6,clWhite);
cercle(ACanvas,53,13,6,GrisF);
cercle(ACanvas,63,13,6,GrisF);
cercle(ACanvas,x1,y1,rayon,clWhite);
cercle(ACanvas,x2,y2,rayon,clWhite);
if N>2 then cercle(ACanvas,x3,y3,rayon,clWhite);
if N>3 then cercle(ACanvas,x4,y4,rayon,clWhite);
if N>4 then cercle(ACanvas,x5,y5,rayon,GrisF);
if N>5 then cercle(ACanvas,x6,y6,rayon,GrisF);
end;
if EtatSignal=5 then
if EtatSignal=5 then
begin
cercle(ACanvas,11,13,6,clWhite);
cercle(ACanvas,22,13,6,clWhite);
cercle(ACanvas,33,13,6,clWhite);
cercle(ACanvas,43,13,6,clWhite);
cercle(ACanvas,53,13,6,clWhite);
cercle(ACanvas,63,13,6,GrisF);
cercle(ACanvas,x1,y1,rayon,clWhite);
cercle(ACanvas,x2,y2,rayon,clWhite);
if N>2 then cercle(ACanvas,x3,y3,rayon,clWhite);
if N>3 then cercle(ACanvas,x4,y4,rayon,clWhite);
if N>4 then cercle(ACanvas,x5,y5,rayon,clWhite);
if N>5 then cercle(ACanvas,x6,y6,rayon,GrisF);
end;
if EtatSignal=6 then
if EtatSignal=6 then
begin
cercle(ACanvas,11,13,6,clWhite);
cercle(ACanvas,22,13,6,clWhite);
cercle(ACanvas,33,13,6,clWhite);
cercle(ACanvas,43,13,6,clWhite);
cercle(ACanvas,53,13,6,clWhite);
cercle(ACanvas,63,13,6,clWhite);
end;
end;
// dessine les feux sur une cible directionnelle à 2 feux
procedure dessine_dir2(Acanvas : Tcanvas;EtatSignal : word);
begin
if EtatSignal=0 then
begin
cercle(ACanvas,12,13,6,GrisF);
cercle(ACanvas,25,13,6,GrisF);
end;
if EtatSignal=1 then
begin
cercle(ACanvas,12,13,6,clWhite);
cercle(ACanvas,25,13,6,GrisF);
end;
if EtatSignal=2 then
begin
cercle(ACanvas,12,13,6,clWhite);
cercle(ACanvas,25,13,6,clWhite);
cercle(ACanvas,x1,y1,rayon,clWhite);
cercle(ACanvas,x2,y2,rayon,clWhite);
if N>2 then cercle(ACanvas,x3,y3,rayon,clWhite);
if N>3 then cercle(ACanvas,x4,y4,rayon,clWhite);
if N>4 then cercle(ACanvas,x5,y5,rayon,clWhite);
if N>5 then cercle(ACanvas,x6,y6,rayon,clWhite);
end;
end;
@@ -1307,25 +1229,24 @@ end;
// dessine l'aspect du feu en fonction de son adresse dans la partie droite de droite
procedure Dessine_feu_mx(CanvasDest : Tcanvas;x,y : integer;FrX,frY : real;adresse : integer;orientation : integer);
var i : integer;
var i,aspect : integer;
begin
i:=Index_feu(adresse);
if i<>0 then
case feux[i].aspect of
// feux de signalisation
2 : dessine_feu2(CanvasDest,x,y,frx,fry,feux[i].EtatSignal,orientation);
3 : dessine_feu3(CanvasDest,x,y,frx,fry,feux[i].EtatSignal,orientation);
4 : dessine_feu4(CanvasDest,x,y,frx,fry,feux[i].EtatSignal,orientation);
5 : dessine_feu5(CanvasDest,x,y,frx,fry,feux[i].EtatSignal,orientation);
7 : dessine_feu7(CanvasDest,x,y,frx,fry,feux[i].EtatSignal,orientation);
9 : dessine_feu9(CanvasDest,x,y,frx,fry,feux[i].EtatSignal,orientation);
// indicateurs de direction
12 : dessine_dir2(CanvasDest,feux[i].EtatSignal);
13 : dessine_dir3(CanvasDest,feux[i].EtatSignal);
14 : dessine_dir4(CanvasDest,feux[i].EtatSignal);
15 : dessine_dir5(CanvasDest,feux[i].EtatSignal);
16 : dessine_dir6(CanvasDest,feux[i].EtatSignal);
end;
begin
aspect:=feux[i].aspect ;
case aspect of
// feux de signalisation
2 : dessine_feu2(CanvasDest,x,y,frx,fry,feux[i].EtatSignal,orientation);
3 : dessine_feu3(CanvasDest,x,y,frx,fry,feux[i].EtatSignal,orientation);
4 : dessine_feu4(CanvasDest,x,y,frx,fry,feux[i].EtatSignal,orientation);
5 : dessine_feu5(CanvasDest,x,y,frx,fry,feux[i].EtatSignal,orientation);
7 : dessine_feu7(CanvasDest,x,y,frx,fry,feux[i].EtatSignal,orientation);
9 : dessine_feu9(CanvasDest,x,y,frx,fry,feux[i].EtatSignal,orientation);
// indicateurs de direction
12..16 : dessine_dirN(CanvasDest,x,y,frx,fry,feux[i].EtatSignal,orientation,aspect-10);
end;
end;
end;
// procédure activée quand on clique gauche sur l'image d'un feu
@@ -1334,8 +1255,8 @@ var s : string;
P_image_pilote : Timage;
i,erreur : integer;
begin
P_image_pilote:=Sender as TImage; // récupérer l'objet image de la forme pilote
s:=P_Image_pilote.Hint;
P_image_pilote:=Sender as TImage; // récupérer l'objet image du feu qu'on a cliqué de la forme pilote
s:=P_Image_pilote.Hint; // récupérer son hint qui contient l'adresse du feu cliqué
//Affiche(s,clyellow);
i:=pos('@',s); if i<>0 then delete(s,1,i);
i:=pos('=',s); if i<>0 then delete(s,i,1);
@@ -1977,7 +1898,7 @@ begin
end;
end;
feux[i].EtatSignal:=code;
Dessine_feu_mx(Feux[Index_Feu(adr)].Img.Canvas,0,0,1,1,adr,1);
Dessine_feu_mx(Feux[Index_Feu(adr)].Img.Canvas,0,0,1,1,adr,1);
end;
end;
@@ -2956,7 +2877,15 @@ begin
end;
end;
end;
end
else
begin
pilote_direction(Adr,feux[i].etatSignal)
end;
feux[i].AncienEtat:=feux[i].EtatSignal;
// allume les signaux du feu dans la fenêtre de droite
@@ -2979,6 +2908,11 @@ begin
5 : ImageFeu:=Formprinc.Image5feux;
7 : ImageFeu:=Formprinc.Image7feux;
9 : ImageFeu:=Formprinc.Image9feux;
12 : ImageFeu:=Formprinc.Image2Dir;
13 : ImageFeu:=Formprinc.Image3Dir;
14 : ImageFeu:=Formprinc.Image4Dir;
15 : ImageFeu:=Formprinc.Image5Dir;
16 : ImageFeu:=Formprinc.Image6Dir;
else ImageFeu:=Formprinc.Image3feux;
end;
x0:=(tco[x,y].x-1)*LargeurCell; // coordonnées XY du feu
@@ -3006,7 +2940,6 @@ begin
end;
end;
end;
end;
// pilotage des signaux
procedure envoi_signauxCplx;
@@ -4173,7 +4106,7 @@ var suiv1,indexBranche_det1,indexBranche_det2,branche_det2,branche_det1,
type_tmp : char;
trouve,afdeb : boolean;
// donne le suivant au point de connection de l'aiguillage
// donne le suivant au point de connexion de l'aiguillage
// prec=det ou aig ; suiv=aig
// aig_suiv(527,7) : renvoie 520 dans suiv_2
// procédure récursive
@@ -4469,8 +4402,8 @@ end;
// renvoie le détecteur suivant aux détecteurs 1 et 2
// les aiguillages n'ont pas besoin d'être ouverts entre 1 et 2.
// par contre pour le suivant au det2, les aiguillages doivent être ouverts
// les aiguillages n'ont pas besoin d'être positionnés entre 1 et 2.
// par contre pour le suivant au det2, les aiguillages doivent être positionnés
// si on ne trouve pas le suivant, renvoie 9999
function det_suiv_cont(det1,det2 : integer) : integer;
var dernier: integer;
@@ -5897,6 +5830,7 @@ end;
// calcul des zones depuis le tableau des fronts descendants des évènements détecteurs
// transmis dans le tableau Event_det
// rattache le nouveau détecteur à un train
procedure calcul_zones;
var AdrFeu,AdrDetFeu,Nbre,i,j,n,det1,det2,det3,det4,AdrSuiv,AdrPrec,Prev,det_suiv,nc : integer ;
TypeSuiv : tEquipement;
@@ -5907,8 +5841,7 @@ begin
s:='Le nouveau détecteur est '+IntToSTR(det3);
FormDebug.MemoEvtDet.lines.add(s) ;
if TraceListe or dupliqueEvt then AfficheDebug(s,clyellow) ;
for i:=1 to N_trains do
begin
Nbre:=event_det_train[i].NbEl ; // Nombre d'éléments du tableau courant exploré
@@ -7297,7 +7230,7 @@ end;
// Lance et connecte CDM rail. en sortie si CDM est lancé Lance_CDM=true,
function Lance_CDM : boolean;
var i : integer;
var i,retour,retour2 : integer;
s : string;
cdm_lanceLoc : boolean;
begin
@@ -7317,25 +7250,28 @@ begin
cdm_lanceLoc:=false;
// lancement depuis le répertoire 32 bits d'un OS64
if ShellExecute(Formprinc.Handle,'open',PChar('C:\Program Files (x86)\CDM-Rail\cdr.exe'),
retour:=ShellExecute(Formprinc.Handle,'open',PChar('C:\Program Files (x86)\CDM-Rail\cdr.exe'),
Pchar(s), // paramètre
PChar('C:\Program Files (x86)\CDM-Rail\') // répertoire
,SW_SHOWNORMAL)>32 then
begin
cdm_lanceLoc:=true;
Affiche('Lancement de CDM 64 '+lay,clyellow);
end;
,SW_SHOWNORMAL);
if retour>32 then
begin
cdm_lanceLoc:=true;
Affiche('Lancement de CDM 64 '+lay,clyellow);
end;
if not(cdm_lanceLoc) then
begin
// si çà marche pas essayer depuis le répertoire de base sur un OS32
if ShellExecute(Formprinc.Handle,
retour2:=ShellExecute(Formprinc.Handle,
'open',PChar('C:\Program Files\CDM-Rail\cdr.exe'),
Pchar(s), // paramètre
PChar('C:\Program Files\CDM-Rail\') // répertoire
,SW_SHOWNORMAL)<=32 then
,SW_SHOWNORMAL);
if retour2<=32 then
begin
ShowMessage('répertoire CDM rail introuvable');
ShowMessage('CDM rail introuvable : '+#13#10+'Erreur 32='+intToSTR(retour)+' Erreur 64='+inttoStr(retour2));
lance_CDM:=false;exit;
end;
cdm_lanceLoc:=true;
@@ -7542,9 +7478,8 @@ begin
if not(CDM_connecte) then
begin
// ouverture par USB
connecte_USB;
if not(portCommOuvert) then
if AvecDemandeInterfaceUSB then connecte_USB;
if not(portCommOuvert) and AvecDemandeInterfaceEth then
begin
// sinon ouvrir socket vers la centrale
// Initialisation de la comm socket LENZ
@@ -7554,7 +7489,7 @@ begin
ClientSocketLenz.port:=port;
ClientSocketLenz.Address:=AdresseIP;
ClientSocketLenz.Open;
end
end;
end;
end;
@@ -7590,11 +7525,13 @@ begin
N_Event_tick:=0 ; // dernier index
NombreImages:=0;
// box2=CV
GroupBox2.Left:=633;
GroupBox2.Top:=64;
GroupBox2.Top:=60;
GroupBox2.Visible:=false;
// box3=vitesses et fonctions F
GroupBox3.Left:=633;
GroupBox3.Top:=64;
GroupBox3.Top:=60;
GroupBox3.visible:=true;
// TCO
@@ -8389,10 +8326,16 @@ begin
posERR:=pos('_ERR',commandeCDM);
if posErr<>0 then
begin
if pos('ERR=200',commandeCDM)<>0 then s:='Erreur CDM : réseau non chargé ';
if pos('ERR=500',commandeCDM)<>0 then s:='Erreur CDM : serveur DCC non lancé ';
if pos('ERR=300',commandeCDM)<>0 then s:='Erreur CDM : train non trouvé ';
j:=pos('MSG CDM : ',commandeCDM);if j<>0 then s:=s+copy(commandeCDM,j,i-j);
if pos('ERR=200',commandeCDM)<>0 then s:='Erreur CDM : réseau non chargé '
else
if pos('ERR=500',commandeCDM)<>0 then s:='Erreur CDM : serveur DCC non lancé '
else
if pos('ERR=300',commandeCDM)<>0 then s:='Erreur CDM : train non trouvé '
else
begin
j:=pos('MSG=',commandeCDM);
if j<>0 then s:='CDM: '+copy(commandeCDM,j,i-j);
end;
Affiche(s,clred);
delete(commandeCDM,1,i);
end;
@@ -8984,7 +8927,7 @@ procedure TFormPrinc.CodificationdessignauxClick(Sender: TObject);
var i,j,k,l,NfeuxDir,nc : integer;
s,s2 : string;
begin
Affiche('Codification interne des feux:',ClYellow);
Affiche('Codification interne des signaux:',ClYellow);
for i:=1 to NbreFeux do
begin
@@ -9352,11 +9295,10 @@ begin
s:=editVitesse.Text;
val(s,vit,erreur);
if (erreur<>0) or (vit<0) then exit;
Affiche('Commande vitesse train '+s+ ' à '+IntToSTR(vit)+'%',cllime);
s:=trains[combotrains.itemindex+1].nom_train;
vitesse_loco(s,adr,vit,true);
if s='' then s:=intToSTR(adr);
Affiche('Commande vitesse train '+s+ ' à '+IntToSTR(vit)+'%',cllime);
end;
// pour déplacer l'ascenseur de l'affichage automatiquement en bas
@@ -9380,7 +9322,7 @@ begin
begin
Adr:=Feux[i].Adresse;
Etat:=Feux[i].EtatSignal;
s:='Feu '+IntToSTR(Adr)+' Etat=';
s:='Signal '+IntToSTR(Adr)+' Etat=';
code_to_aspect(Etat,aspect,combine);
s:=s+IntToSTR(etat)+'='+EtatSign[aspect]+' '+EtatSign[combine];
Affiche(s,clYellow);
@@ -9591,4 +9533,18 @@ begin
Lance_CDM ;
end;
procedure TFormPrinc.TrackBarVitChange(Sender: TObject);
begin
EditVitesse.Text:=intToSTR(TrackBarVit.position);
end;
procedure TFormPrinc.EditVitesseChange(Sender: TObject);
var i,e : integer;
begin
val(EditVitesse.Text,i,e);
if (e=0) and (i>=0) and (i<=100) then TrackBarVit.position:=i;
end;
end.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+54 -41
View File
@@ -629,51 +629,40 @@ begin
delete(s,1,m-1);
end;
if s[1]=')' then
if s[1]=',' then delete(s,1,1);
val(s,j,erreur);
tco[x,y].repr:=j;
delete(s,1,erreur-1);
if s[1]=',' then
begin
// ici on est dans l'ancien format
Delete(s,1,1);
tco[x,y].repr:=2; // en haut
tco[x,y].Couleur:=fond;
end
else
begin
if s[1]=',' then delete(s,1,1);
val(s,j,erreur);
tco[x,y].repr:=j;
delete(s,1,erreur-1);
if s[1]=',' then // on pointe sur ( en ancien format
// fonte
delete(s,1,1);
i:=pos(',',s);
tco[x,y].fonte:=copy(s,1,i-1);
//Affiche(fonte,clyellow);
Delete(s,1,i);
Val(s,taillefont,erreur);
tco[x,y].TailleFonte:=taillefont;
delete(s,1,erreur);
i:=pos(',',s);
val('$'+s,coulFonte,erreur);
tco[x,y].coulFonte:=coulFonte;
delete(s,1,i);
if s[1]<>')' then
begin
// fonte
delete(s,1,1);
i:=pos(',',s);
tco[x,y].fonte:=copy(s,1,i-1);
//Affiche(fonte,clyellow);
Delete(s,1,i);
Val(s,taillefont,erreur);
tco[x,y].TailleFonte:=taillefont;
delete(s,1,erreur);
i:=pos(',',s);
val('$'+s,coulFonte,erreur);
tco[x,y].coulFonte:=coulFonte;
delete(s,1,i);
if s[1]<>')' then
begin
// style GISB
i:=pos(')',s);
tco[x,y].fontstyle:=copy(s,1,i-1);
end;
// style GISB
i:=pos(')',s);
//Affiche(IntToHEX(coulFonte,6),clred);
delete(s,1,i);
tco[x,y].fontstyle:=copy(s,1,i-1);
end;
end
else delete(s,1,1); // ancien format
i:=pos(')',s);
//Affiche(IntToHEX(coulFonte,6),clred);
delete(s,1,i);
end;
inc(x);
until s='';
end;
@@ -2576,7 +2565,7 @@ begin
end;
end;
// Dessine un feu dans le canvasDest en x,y , dont l'adresse se trouve à la cellule x,y
// Dessine un signal dans le canvasDest en x,y , dont l'adresse se trouve à la cellule x,y
procedure dessin_feu(CanvasDest : Tcanvas;x,y : integer );
var x0,y0,xp,yp,orientation,adresse,aspect,PiedFeu,TailleX,TailleY : integer;
ImageFeu : Timage;
@@ -2592,7 +2581,7 @@ begin
aspect:=feux[index_feu(adresse)].aspect;
if aspect=0 then aspect:=9;
if aspect>9 then exit;
//if aspect>9 then exit;
// Affiche(IntToSTR(i)+' '+intToSTR(aspect),clred);
case aspect of
@@ -2602,6 +2591,12 @@ begin
5 : ImageFeu:=Formprinc.Image5feux;
7 : ImageFeu:=Formprinc.Image7feux;
9 : ImageFeu:=Formprinc.Image9feux;
12 : ImageFeu:=Formprinc.Image2Dir;
13 : ImageFeu:=Formprinc.Image3Dir;
14 : ImageFeu:=Formprinc.Image4Dir;
15 : ImageFeu:=Formprinc.Image5Dir;
16 : ImageFeu:=Formprinc.Image6Dir;
else ImageFeu:=Formprinc.Image9feux;
end;
@@ -4961,6 +4956,24 @@ begin
GroupBox2.Visible:=true;
efface_entoure;
SelectionAffichee:=false;
if feux[i].aspect>10 then
begin
GroupBox1.Visible:=false;
GroupBox2.Visible:=false;
LabelNbFeux.Visible:=true;
EditNbreFeux.Visible:=true;
EditNbreFeux.Text:='1';
end
else
begin
LabelNbFeux.Visible:=False;
EditNbreFeux.Visible:=false;
GroupBox1.Visible:=true;
GroupBox2.Visible:=true;
end;
sourisclic:=false; // évite de générer un cadre de sélection
end;
end;
+1
View File
@@ -117,6 +117,7 @@ version 4.4 : Possibilit
Code source modifié pour être compilable avec Rad Studio 11.
version 4.5 : Correction champ "déclencheur" pour son.
version 4.6 : Correction TJD 2/4 états dans le changement de sélection.
Gestion des panneaux directionnels dans le TCO.