V2.2
This commit is contained in:
f1iwq2
2020-11-29 11:04:24 +01:00
parent 9fba9f6a97
commit a1839decfa
21 changed files with 11131 additions and 441 deletions
+2 -2
View File
@@ -31,5 +31,5 @@
-M -M
-$M16384,1048576 -$M16384,1048576
-K$00400000 -K$00400000
-LE"c:\program files (x86)\borland\delphi7\Projects\Bpl" -LE"c:\program files\borland\delphi7\Projects\Bpl"
-LN"c:\program files (x86)\borland\delphi7\Projects\Bpl" -LN"c:\program files\borland\delphi7\Projects\Bpl"
Binary file not shown.
BIN
View File
Binary file not shown.
+3 -3
View File
@@ -1,6 +1,6 @@
object FormConfig: TFormConfig object FormConfig: TFormConfig
Left = 267 Left = 266
Top = 246 Top = 160
Hint = Hint =
'Modifie les fichiers de configuration selon les s'#233'lections chois' + 'Modifie les fichiers de configuration selon les s'#233'lections chois' +
'ies' 'ies'
@@ -1776,7 +1776,7 @@ object FormConfig: TFormConfig
Top = 8 Top = 8
Width = 585 Width = 585
Height = 441 Height = 441
ActivePage = TabSheetCDM ActivePage = TabSheetSig
Font.Charset = DEFAULT_CHARSET Font.Charset = DEFAULT_CHARSET
Font.Color = clBackground Font.Color = clBackground
Font.Height = -11 Font.Height = -11
+23 -17
View File
@@ -486,8 +486,8 @@ begin
aspect:=feux[i].aspect; aspect:=feux[i].aspect;
if aspect<10 then s:=s+IntToSTR(aspect)+',' else s:=s+'D'+intToSTR(aspect-10)+','; if aspect<10 then s:=s+IntToSTR(aspect)+',' else s:=s+'D'+intToSTR(aspect-10)+',';
// bouton feu blanc // bouton feu blanc, n'existe pas pour un feu directionnel (aspect>10)
if feux[i].feublanc then s:=s+'1,' else s:=s+'0,'; if aspect<10 then begin if feux[i].feublanc then s:=s+'1,' else s:=s+'0,';end;
// décodeur // décodeur
s:=s+IntToSTR(feux[i].decodeur)+','; s:=s+IntToSTR(feux[i].decodeur)+',';
@@ -697,27 +697,33 @@ begin
writeln(fichierN,s); writeln(fichierN,s);
continue:=s[1]<>'0'; continue:=s[1]<>'0';
until not(continue); until not(continue);
copie_commentaire;
writeln(fichierN,s); // copie tous les commentaires de la branche feux
// modélisation des signaux
if s[1]<>'0' then
repeat repeat
readln(fichier,s); readln(fichier,s);
writeln(fichierN,s); continue:=true;
continue:=s[1]<>'0'; if length(s)>0 then
until not(continue); begin
copie_commentaire; if s[1]='/' then writeln(fichierN,s);
continue:=s[1]<>'0';
end;
until not(continue) or eof(fichier);
writeln(fichierN,s); for i:=1 to NbreFeux do
// Fonctions Fx begin
if s[1]<>'0' then s:=encode_sig(i);
feux[i].modifie:=false; // sauvegarde en cours, on démarque
writeln(fichierN,s);
end;
writeln(fichierN,'0');
// Fonctions Fx généré du fichier d'origine, pas encore fait
repeat repeat
continue:=true;
readln(fichier,s); readln(fichier,s);
writeln(fichierN,s); writeln(fichierN,s);
continue:=s[1]<>'0'; if length(s)>0 then continue:=s[1]<>'0';
until not(continue); until not(continue) or eof(fichier);
copie_commentaire;
closefile(fichier); closefile(fichier);
closefile(fichierN); closefile(fichierN);
@@ -1285,7 +1291,7 @@ begin
EditDet1.Visible:=true;EditDet2.Visible:=true;EditDet3.Visible:=true;EditDet4.Visible:=true; EditDet1.Visible:=true;EditDet2.Visible:=true;EditDet3.Visible:=true;EditDet4.Visible:=true;
EditSuiv1.Visible:=true;EditSuiv2.Visible:=true;EditSuiv3.Visible:=true;EditSuiv4.Visible:=true; EditSuiv1.Visible:=true;EditSuiv2.Visible:=true;EditSuiv3.Visible:=true;EditSuiv4.Visible:=true;
Label24.Visible:=true; Label25.Visible:=true;Label26.Visible:=true;Label27.Visible:=true; Label24.Visible:=true; Label25.Visible:=true;Label26.Visible:=true;Label27.Visible:=true;
CheckVerrouCarre.Visible:=false; CheckVerrouCarre.Visible:=true;
EditDet1.Text:=IntToSTR(feux[i].Adr_det1); EditDet1.Text:=IntToSTR(feux[i].Adr_det1);
EditSuiv1.Text:=TypeEl_To_char(feux[i].Btype_suiv1)+IntToSTR(feux[i].Adr_el_suiv1); EditSuiv1.Text:=TypeEl_To_char(feux[i].Btype_suiv1)+IntToSTR(feux[i].Adr_el_suiv1);
j:=feux[i].Adr_det2; j:=feux[i].Adr_det2;
BIN
View File
Binary file not shown.
+169 -123
View File
@@ -1,8 +1,8 @@
object FormDebug: TFormDebug object FormDebug: TFormDebug
Left = 186 Left = 342
Top = 143 Top = 80
Width = 809 Width = 842
Height = 773 Height = 762
Caption = 'Fen'#234'tre de d'#233'bug' Caption = 'Fen'#234'tre de d'#233'bug'
Color = clWindow Color = clWindow
TransparentColorValue = clTeal TransparentColorValue = clTeal
@@ -16,12 +16,12 @@ object FormDebug: TFormDebug
OnClose = FormClose OnClose = FormClose
OnCreate = FormCreate OnCreate = FormCreate
DesignSize = ( DesignSize = (
793 826
735) 724)
PixelsPerInch = 96 PixelsPerInch = 96
TextHeight = 13 TextHeight = 13
object Label1: TLabel object Label1: TLabel
Left = 609 Left = 642
Top = 7 Top = 7
Width = 108 Width = 108
Height = 13 Height = 13
@@ -37,7 +37,7 @@ object FormDebug: TFormDebug
ParentFont = False ParentFont = False
end end
object Label2: TLabel object Label2: TLabel
Left = 441 Left = 474
Top = 4 Top = 4
Width = 131 Width = 131
Height = 18 Height = 18
@@ -51,10 +51,10 @@ object FormDebug: TFormDebug
ParentFont = False ParentFont = False
end end
object Label3: TLabel object Label3: TLabel
Left = 441 Left = 472
Top = 168 Top = 168
Width = 97 Width = 99
Height = 193 Height = 185
Anchors = [akTop, akRight] Anchors = [akTop, akRight]
AutoSize = False AutoSize = False
Caption = 'Label3' Caption = 'Label3'
@@ -69,7 +69,7 @@ object FormDebug: TFormDebug
WordWrap = True WordWrap = True
end end
object EditNivDebug: TEdit object EditNivDebug: TEdit
Left = 721 Left = 754
Top = 4 Top = 4
Width = 49 Width = 49
Height = 21 Height = 21
@@ -85,10 +85,10 @@ object FormDebug: TFormDebug
OnKeyPress = EditNivDebugKeyPress OnKeyPress = EditNivDebugKeyPress
end end
object MemoEvtDet: TMemo object MemoEvtDet: TMemo
Left = 545 Left = 578
Top = 408 Top = 360
Width = 233 Width = 239
Height = 221 Height = 225
Anchors = [akTop, akRight] Anchors = [akTop, akRight]
Color = clBlack Color = clBlack
Font.Charset = ANSI_CHARSET Font.Charset = ANSI_CHARSET
@@ -104,8 +104,8 @@ object FormDebug: TFormDebug
TabOrder = 1 TabOrder = 1
end end
object ButtonEcrLog: TButton object ButtonEcrLog: TButton
Left = 441 Left = 474
Top = 504 Top = 480
Width = 97 Width = 97
Height = 29 Height = 29
Anchors = [akTop, akRight] Anchors = [akTop, akRight]
@@ -115,9 +115,9 @@ object FormDebug: TFormDebug
end end
object MemoDebug: TMemo object MemoDebug: TMemo
Left = 0 Left = 0
Top = 8 Top = 0
Width = 426 Width = 465
Height = 722 Height = 721
Anchors = [akLeft, akTop, akRight, akBottom] Anchors = [akLeft, akTop, akRight, akBottom]
Lines.Strings = ( Lines.Strings = (
'MemoDebug') 'MemoDebug')
@@ -126,8 +126,8 @@ object FormDebug: TFormDebug
WordWrap = False WordWrap = False
end end
object ButtonRazTampon: TButton object ButtonRazTampon: TButton
Left = 441 Left = 474
Top = 584 Top = 552
Width = 97 Width = 97
Height = 33 Height = 33
Anchors = [akTop, akRight] Anchors = [akTop, akRight]
@@ -137,18 +137,18 @@ object FormDebug: TFormDebug
OnClick = ButtonRazTamponClick OnClick = ButtonRazTamponClick
end end
object ButtonCherche: TButton object ButtonCherche: TButton
Left = 441 Left = 474
Top = 464 Top = 448
Width = 97 Width = 97
Height = 33 Height = 25
Anchors = [akTop, akRight] Anchors = [akTop, akRight]
Caption = 'Chercher erreurs' Caption = 'Chercher erreurs'
TabOrder = 5 TabOrder = 5
OnClick = ButtonChercheClick OnClick = ButtonChercheClick
end end
object ButtonAffEvtChrono: TButton object ButtonAffEvtChrono: TButton
Left = 441 Left = 474
Top = 424 Top = 408
Width = 97 Width = 97
Height = 33 Height = 33
Anchors = [akTop, akRight] Anchors = [akTop, akRight]
@@ -158,21 +158,27 @@ object FormDebug: TFormDebug
OnClick = ButtonAffEvtChronoClick OnClick = ButtonAffEvtChronoClick
end end
object ButtonCop: TButton object ButtonCop: TButton
Left = 441 Left = 474
Top = 368 Top = 360
Width = 97 Width = 97
Height = 49 Height = 41
Anchors = [akTop, akRight] Anchors = [akTop, akRight]
Caption = 'Copie fen'#234'te principale dans debug' Caption = 'Copie fen'#234'te principale dans debug'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWhite
Font.Height = -9
Font.Name = 'MS Sans Serif'
Font.Style = []
ParentFont = False
TabOrder = 7 TabOrder = 7
WordWrap = True WordWrap = True
OnClick = ButtonCopClick OnClick = ButtonCopClick
end end
object RichEdit: TRichEdit object RichEdit: TRichEdit
Left = 545 Left = 578
Top = 168 Top = 168
Width = 233 Width = 239
Height = 233 Height = 185
Anchors = [akTop, akRight] Anchors = [akTop, akRight]
HideScrollBars = False HideScrollBars = False
PopupMenu = PopupMenuRE PopupMenu = PopupMenuRE
@@ -180,8 +186,8 @@ object FormDebug: TFormDebug
TabOrder = 8 TabOrder = 8
end end
object ButtonRazLog: TButton object ButtonRazLog: TButton
Left = 441 Left = 474
Top = 544 Top = 512
Width = 97 Width = 97
Height = 33 Height = 33
Anchors = [akTop, akRight] Anchors = [akTop, akRight]
@@ -191,11 +197,11 @@ object FormDebug: TFormDebug
OnClick = ButtonRazLogClick OnClick = ButtonRazLogClick
end end
object GroupBox1: TGroupBox object GroupBox1: TGroupBox
Left = 433 Left = 474
Top = 633 Top = 592
Width = 353 Width = 343
Height = 97 Height = 132
Anchors = [akRight, akBottom] Anchors = [akTop, akRight]
Caption = 'Fonctions primitives' Caption = 'Fonctions primitives'
Color = cl3DLight Color = cl3DLight
Font.Charset = DEFAULT_CHARSET Font.Charset = DEFAULT_CHARSET
@@ -206,78 +212,118 @@ object FormDebug: TFormDebug
ParentColor = False ParentColor = False
ParentFont = False ParentFont = False
TabOrder = 10 TabOrder = 10
object ButtonSigSuiv: TButton object GroupBox3: TGroupBox
Left = 16 Left = 8
Top = 24
Width = 97
Height = 25
Hint = 'Etat du signal suivant'
Caption = 'Etat signal suivant'
ParentShowHint = False
ShowHint = True
TabOrder = 0
OnClick = ButtonSigSuivClick
end
object EditSigSuiv: TEdit
Left = 280
Top = 24
Width = 49
Height = 21
Hint = 'Indiquer l'#39'adresse du signal '
ParentShowHint = False
ShowHint = True
TabOrder = 1
end
object EditPrec: TEdit
Left = 224
Top = 58
Width = 49
Height = 21
Hint = 'Element pr'#233'c'#233'dent'
ParentShowHint = False
ShowHint = True
TabOrder = 2
end
object EditActuel: TEdit
Left = 288
Top = 58
Width = 49
Height = 21
Hint = 'Element actuel'
ParentShowHint = False
ShowHint = True
TabOrder = 3
end
object ButtonDetSuiv: TButton
Left = 16
Top = 56
Width = 201
Height = 25
Hint =
'Renvoie l'#39#233'l'#233'ment suivant aux deux '#233'l'#233'ments (d'#233'tecteurs ou aigui' +
'llages) '
Caption = 'D'#233'tecteur suivant aux '#233'l'#233'ments'
ParentShowHint = False
ShowHint = True
TabOrder = 4
OnClick = ButtonDetSuivClick
end
object ButtonCanSuivSig: TButton
Left = 128
Top = 16 Top = 16
Width = 105 Width = 329
Height = 33 Height = 57
Hint = 'Renvoie l'#39'occupation du canton suivant le signal' Caption = 'Signal'
Caption = 'Etat canton suivant signal occup'#233 TabOrder = 0
ParentShowHint = False object Label4: TLabel
ShowHint = True Left = 241
TabOrder = 5 Top = 26
WordWrap = True Width = 32
OnClick = ButtonCanSuivSigClick Height = 13
Caption = 'Signal:'
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
ParentFont = False
end
object ButtonSigSuiv: TButton
Left = 8
Top = 16
Width = 65
Height = 33
Hint = 'Etat du signal suivant'
Caption = 'Etat signal suivant'
ParentShowHint = False
ShowHint = True
TabOrder = 0
WordWrap = True
OnClick = ButtonSigSuivClick
end
object ButtonCanSuivSig: TButton
Left = 72
Top = 8
Width = 81
Height = 41
Hint = 'Renvoie l'#39'occupation du canton suivant le signal'
Caption = 'Etat canton suivant signal'
ParentShowHint = False
ShowHint = True
TabOrder = 1
WordWrap = True
OnClick = ButtonCanSuivSigClick
end
object EditSigSuiv: TEdit
Left = 272
Top = 24
Width = 41
Height = 21
Hint = 'Indiquer l'#39'adresse du signal '
ParentShowHint = False
ShowHint = True
TabOrder = 2
end
object Button1: TButton
Left = 152
Top = 8
Width = 81
Height = 41
Caption = 'Etat 3 cantons pr'#233'c'#233'dents signal'
TabOrder = 3
WordWrap = True
OnClick = Button1Click
end
end
object GroupBox4: TGroupBox
Left = 8
Top = 72
Width = 329
Height = 49
Caption = 'D'#233'tecteur suivant'
TabOrder = 1
object ButtonDetSuiv: TButton
Left = 16
Top = 16
Width = 185
Height = 25
Hint =
'Renvoie l'#39#233'l'#233'ment suivant aux deux '#233'l'#233'ments (d'#233'tecteurs ou aigui' +
'llages) '
Caption = 'D'#233'tecteur suivant aux '#233'l'#233'ments'
ParentShowHint = False
ShowHint = True
TabOrder = 0
OnClick = ButtonDetSuivClick
end
object EditPrec: TEdit
Left = 216
Top = 18
Width = 49
Height = 21
Hint = 'Element pr'#233'c'#233'dent'
ParentShowHint = False
ShowHint = True
TabOrder = 1
end
object EditActuel: TEdit
Left = 272
Top = 18
Width = 49
Height = 21
Hint = 'Element actuel'
ParentShowHint = False
ShowHint = True
TabOrder = 2
end
end end
end end
object GroupBox2: TGroupBox object GroupBox2: TGroupBox
Left = 433 Left = 472
Top = 24 Top = 24
Width = 345 Width = 345
Height = 137 Height = 137
@@ -293,9 +339,9 @@ object FormDebug: TFormDebug
ParentFont = False ParentFont = False
TabOrder = 11 TabOrder = 11
object CheckAffSig: TCheckBox object CheckAffSig: TCheckBox
Left = 24 Left = 8
Top = 16 Top = 16
Width = 297 Width = 161
Height = 17 Height = 17
Caption = 'Fonctionnement des signaux' Caption = 'Fonctionnement des signaux'
Font.Charset = DEFAULT_CHARSET Font.Charset = DEFAULT_CHARSET
@@ -308,9 +354,9 @@ object FormDebug: TFormDebug
OnClick = CheckAffSigClick OnClick = CheckAffSigClick
end end
object CheckBoxEvtDetAig: TCheckBox object CheckBoxEvtDetAig: TCheckBox
Left = 24 Left = 8
Top = 32 Top = 32
Width = 281 Width = 201
Height = 17 Height = 17
Caption = 'Ev'#232'nements d'#233'tecteurs et aiguillages' Caption = 'Ev'#232'nements d'#233'tecteurs et aiguillages'
Font.Charset = DEFAULT_CHARSET Font.Charset = DEFAULT_CHARSET
@@ -323,9 +369,9 @@ object FormDebug: TFormDebug
OnClick = CheckBoxEvtDetAigClick OnClick = CheckBoxEvtDetAigClick
end end
object CheckBoxTraceLIste: TCheckBox object CheckBoxTraceLIste: TCheckBox
Left = 24 Left = 8
Top = 112 Top = 112
Width = 289 Width = 185
Height = 17 Height = 17
Caption = 'Evaluations des routes des trains' Caption = 'Evaluations des routes des trains'
Font.Charset = DEFAULT_CHARSET Font.Charset = DEFAULT_CHARSET
@@ -338,9 +384,9 @@ object FormDebug: TFormDebug
OnClick = CheckBoxTraceLIsteClick OnClick = CheckBoxTraceLIsteClick
end end
object CheckTrame: TCheckBox object CheckTrame: TCheckBox
Left = 24 Left = 8
Top = 80 Top = 80
Width = 305 Width = 233
Height = 17 Height = 17
Caption = 'Trames '#233'chang'#233'es avec l'#39'interface ou CDM' Caption = 'Trames '#233'chang'#233'es avec l'#39'interface ou CDM'
Font.Charset = DEFAULT_CHARSET Font.Charset = DEFAULT_CHARSET
@@ -353,9 +399,9 @@ object FormDebug: TFormDebug
OnClick = CheckTrameClick OnClick = CheckTrameClick
end end
object CheckBoxAct: TCheckBox object CheckBoxAct: TCheckBox
Left = 24 Left = 8
Top = 48 Top = 48
Width = 257 Width = 153
Height = 17 Height = 17
Caption = 'Ev'#232'vements actionneurs' Caption = 'Ev'#232'vements actionneurs'
Font.Charset = DEFAULT_CHARSET Font.Charset = DEFAULT_CHARSET
@@ -368,9 +414,9 @@ object FormDebug: TFormDebug
OnClick = CheckBoxActClick OnClick = CheckBoxActClick
end end
object CheckBoxAffFD: TCheckBox object CheckBoxAffFD: TCheckBox
Left = 24 Left = 8
Top = 96 Top = 96
Width = 297 Width = 193
Height = 17 Height = 17
Caption = 'Fronts descendants des d'#233'tecteurs' Caption = 'Fronts descendants des d'#233'tecteurs'
Color = cl3DLight Color = cl3DLight
@@ -385,9 +431,9 @@ object FormDebug: TFormDebug
OnClick = CheckBoxAffFDClick OnClick = CheckBoxAffFDClick
end end
object CheckBoxAffDebDecSig: TCheckBox object CheckBoxAffDebDecSig: TCheckBox
Left = 24 Left = 8
Top = 64 Top = 64
Width = 265 Width = 193
Height = 17 Height = 17
Caption = 'Pilotage des d'#233'codeurs de signaux' Caption = 'Pilotage des d'#233'codeurs de signaux'
Font.Charset = DEFAULT_CHARSET Font.Charset = DEFAULT_CHARSET
+20 -5
View File
@@ -25,11 +25,6 @@ type
copier1: TMenuItem; copier1: TMenuItem;
ButtonRazLog: TButton; ButtonRazLog: TButton;
GroupBox1: TGroupBox; GroupBox1: TGroupBox;
ButtonSigSuiv: TButton;
EditSigSuiv: TEdit;
EditPrec: TEdit;
EditActuel: TEdit;
ButtonDetSuiv: TButton;
GroupBox2: TGroupBox; GroupBox2: TGroupBox;
CheckAffSig: TCheckBox; CheckAffSig: TCheckBox;
CheckBoxEvtDetAig: TCheckBox; CheckBoxEvtDetAig: TCheckBox;
@@ -38,7 +33,16 @@ type
CheckBoxAct: TCheckBox; CheckBoxAct: TCheckBox;
CheckBoxAffFD: TCheckBox; CheckBoxAffFD: TCheckBox;
CheckBoxAffDebDecSig: TCheckBox; CheckBoxAffDebDecSig: TCheckBox;
GroupBox3: TGroupBox;
ButtonSigSuiv: TButton;
ButtonCanSuivSig: TButton; ButtonCanSuivSig: TButton;
EditSigSuiv: TEdit;
Label4: TLabel;
GroupBox4: TGroupBox;
ButtonDetSuiv: TButton;
EditPrec: TEdit;
EditActuel: TEdit;
Button1: TButton;
procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormCreate(Sender: TObject); procedure FormCreate(Sender: TObject);
procedure ButtonEcrLogClick(Sender: TObject); procedure ButtonEcrLogClick(Sender: TObject);
@@ -59,6 +63,7 @@ type
procedure ButtonSigSuivClick(Sender: TObject); procedure ButtonSigSuivClick(Sender: TObject);
procedure ButtonDetSuivClick(Sender: TObject); procedure ButtonDetSuivClick(Sender: TObject);
procedure ButtonCanSuivSigClick(Sender: TObject); procedure ButtonCanSuivSigClick(Sender: TObject);
procedure Button1Click(Sender: TObject);
private private
{ Déclarations privées } { Déclarations privées }
public public
@@ -356,4 +361,14 @@ end;
procedure TFormDebug.Button1Click(Sender: TObject);
var Adr,erreur,ancdebug : integer ;
begin
Val(EditSigSuiv.Text,Adr,erreur); if erreur<>0 then exit;
ancdebug:=NivDebug;
NivDebug:=3;
PresTrainPrec(Adr);
NivDebug:=AncDebug;
end;
end. end.
BIN
View File
Binary file not shown.
+324 -208
View File
@@ -228,7 +228,7 @@ var ancien_tablo_signalCplx,EtatsignalCplx : array[0..MaxAcc] of word;
ServeurRetroCDM,TailleFonte : integer; ServeurRetroCDM,TailleFonte : integer;
Hors_tension2,traceSign,TraceZone,Ferme,parSocket,ackCdm,PremierFD, Hors_tension2,traceSign,TraceZone,Ferme,parSocket,ackCdm,PremierFD,
NackCDM,MsgSim,succes,recu_cv,AffActionneur,AffAigDet, NackCDM,MsgSim,succes,recu_cv,AffActionneur,AffAigDet,Option_demarrage,
TraceListe,clignotant,nack,Maj_feux_cours,configNulle,LanceCDM : boolean; TraceListe,clignotant,nack,Maj_feux_cours,configNulle,LanceCDM : boolean;
CDMhd : THandle; CDMhd : THandle;
@@ -244,7 +244,14 @@ var ancien_tablo_signalCplx,EtatsignalCplx : array[0..MaxAcc] of word;
maxaiguillage,detecteur_chgt,Temps,Tempo_init,Suivant,TypeGen, maxaiguillage,detecteur_chgt,Temps,Tempo_init,Suivant,TypeGen,
NbreImagePligne,NbreBranches,Index2_det,Index2_aig,branche_det,Index_det, NbreImagePligne,NbreBranches,Index2_det,Index2_aig,branche_det,Index_det,
I_simule,maxTablo_act,NbreVoies,AdresseFeuSuivant,El_suivant : integer; I_simule,maxTablo_act,NbreVoies,AdresseFeuSuivant,El_suivant : integer;
Ancien_detecteur,detecteur : array[0..1024] of boolean; // anciens état des détecteurs et adresses des détecteurs et leur état Ancien_detecteur : array[0..1024] of boolean; // anciens état des détecteurs et adresses des détecteurs et leur état
detecteur : array[0..1024] of
record
etat : boolean;
tempo : integer;
train : string;
end;
Adresse_detecteur : array[0..60] of integer; // adresses des détecteurs par index Adresse_detecteur : array[0..60] of integer; // adresses des détecteurs par index
mem : array[0..1024] of boolean ; // mémoire des états des détecteurs mem : array[0..1024] of boolean ; // mémoire des états des détecteurs
MemZone : array[0..1024,0..1024] of boolean ; // mémoires de zones MemZone : array[0..1024,0..1024] of boolean ; // mémoires de zones
@@ -346,6 +353,7 @@ function etat_signal_suivant(Adresse,rang : integer) : integer;
function suivant_alg3(prec : integer;typeELprec : integer;var actuel : integer;typeElActuel : integer;alg : integer) : integer; function suivant_alg3(prec : integer;typeELprec : integer;var actuel : integer;typeElActuel : integer;alg : integer) : integer;
function detecteur_suivant_El(el1: integer;TypeDet1 : integer;el2 : integer;TypeDet2 : integer) : integer ; function detecteur_suivant_El(el1: integer;TypeDet1 : integer;el2 : integer;TypeDet2 : integer) : integer ;
function test_memoire_zones(adresse : integer) : boolean; function test_memoire_zones(adresse : integer) : boolean;
function PresTrainPrec(AdrFeu : integer) : boolean;
implementation implementation
@@ -1383,6 +1391,20 @@ begin
chaine_CDM_Func:=so+s; chaine_CDM_Func:=so+s;
end; end;
// chaîne pour vitesse train
function chaine_CDM_vitesse(vitesse:integer;train:string) : string;
var s,so,sx: string;
begin
{ C-C-00-0002-CMDTRN-SPEED|0xx|02|NAME=nomdutrain;UREQ=vitesse; }
so:=place_id('C-C-01-0004-CMDTRN-SPEED');
s:=s+'NAME='+train+';';
s:=s+'UREQ='+intToSTR(vitesse)+';';
sx:=format('%.*d',[2,2])+'|'; // 2 paramètres
so:=so+ '|'+format('%.*d',[3,length(s)+length(sx)])+'|'+sx;
chaine_CDM_vitesse:=so+s;
end;
// prépare la chaîne de commande pour un accessoire via CDM // prépare la chaîne de commande pour un accessoire via CDM
Function chaine_CDM_Acc(adresse,etat1 : integer) : string; Function chaine_CDM_Acc(adresse,etat1 : integer) : string;
var so,sx,s : string; var so,sx,s : string;
@@ -1477,7 +1499,7 @@ begin
s:=chaine_CDM_Acc(adresse,octet); s:=chaine_CDM_Acc(adresse,octet);
envoi_CDM(s); envoi_CDM(s);
if (acc=feu) and not(Raz_Acc_signaux) then exit; if (acc=feu) and not(Raz_Acc_signaux) then exit;
if debug_dec_sig and (acc=feu) then AfficheDebug('Tick='+IntToSTR(Tick)+' signal '+intToSTR(adresse)+' '+intToSTR(octet),clorange); if debug_dec_sig and (acc=feu) then AfficheDebug('Tick='+IntToSTR(Tick)+' signal '+intToSTR(adresse)+' 0',clorange);
s:=chaine_CDM_Acc(adresse,0); s:=chaine_CDM_Acc(adresse,0);
envoi_CDM(s); envoi_CDM(s);
exit; exit;
@@ -1557,10 +1579,19 @@ end;
procedure vitesse_loco(loco : integer;vitesse : integer;sens : boolean); procedure vitesse_loco(loco : integer;vitesse : integer;sens : boolean);
var s : string; var s : string;
begin begin
if sens then vitesse:=vitesse or 128; if portCommOuvert or parSocket then
s:=#$e4+#$13+#$0+char(loco)+char(vitesse); begin
s:=checksum(s); if sens then vitesse:=vitesse or 128;
envoi(s); s:=#$e4+#$13+#$0+char(loco)+char(vitesse);
s:=checksum(s);
envoi(s);
end;
if cdm_connecte then
begin
//s:=chaine_CDM_vitesse(0,'BB25531');
s:=chaine_CDM_vitesse(1,'CC406526'); // 0 n'arrete pas le train
envoi_CDM(s);
end;
end; end;
// fonctions sur les bits // fonctions sur les bits
@@ -1603,6 +1634,8 @@ end;
procedure Maj_Etat_Signal(adresse,aspect : integer); procedure Maj_Etat_Signal(adresse,aspect : integer);
var i : integer; var i : integer;
begin begin
// ('0carré','1sémaphore','2sémaphore cli','3vert','4vert cli','5violet',
// '6blanc','7blanc cli','8jaune','9jaune cli','10ral 30','11ral 60','12rappel 30','13rappel 60');
if testBit((EtatSignalCplx[adresse]),aspect)=false then // si le bit dans l'état du signal n'est pas allumé, procéder. if testBit((EtatSignalCplx[adresse]),aspect)=false then // si le bit dans l'état du signal n'est pas allumé, procéder.
begin begin
// effacement du motif de bits en fonction du nouvel état demandé suivant la règle des signaux complexes // effacement du motif de bits en fonction du nouvel état demandé suivant la règle des signaux complexes
@@ -1769,9 +1802,9 @@ var index : integer;
code,aspect,combine : word; code,aspect,combine : word;
s : string; s : string;
begin begin
if (ancien_tablo_signalCplx[adresse]<>EtatSignalCplx[adresse]) then //; && (stop_cmd==FALSE)) //***if (ancien_tablo_signalCplx[adresse]<>EtatSignalCplx[adresse]) then //; && (stop_cmd==FALSE))
begin begin
ancien_tablo_signalCplx[adresse]:=EtatSignalCplx[adresse]; //***ancien_tablo_signalCplx[adresse]:=EtatSignalCplx[adresse];
code:=EtatSignalCplx[adresse]; code:=EtatSignalCplx[adresse];
code_to_aspect(code,aspect,combine); code_to_aspect(code,aspect,combine);
s:='Signal CDF: ad'+IntToSTR(adresse)+'='+chaine_signal(code); s:='Signal CDF: ad'+IntToSTR(adresse)+'='+chaine_signal(code);
@@ -1814,9 +1847,9 @@ var code,aspect,combine : word;
end; end;
begin begin
if (ancien_tablo_signalCplx[adresse]<>EtatSignalCplx[adresse]) then //; && (stop_cmd==FALSE)) //***if (ancien_tablo_signalCplx[adresse]<>EtatSignalCplx[adresse]) then //; && (stop_cmd==FALSE))
begin begin
ancien_tablo_signalCplx[adresse]:=EtatSignalCplx[adresse]; //***ancien_tablo_signalCplx[adresse]:=EtatSignalCplx[adresse];
code:=EtatSignalCplx[adresse]; code:=EtatSignalCplx[adresse];
code_to_aspect(code,aspect,combine); code_to_aspect(code,aspect,combine);
s:='Signal LEB: ad'+IntToSTR(adresse)+'='+chaine_signal(code); s:='Signal LEB: ad'+IntToSTR(adresse)+'='+chaine_signal(code);
@@ -1891,9 +1924,9 @@ begin
//index:=Index_feu(adresse); // tranforme l'adresse du feu en index tableau //index:=Index_feu(adresse); // tranforme l'adresse du feu en index tableau
//code:=feux[index].aspect; // aspect du feu; //code:=feux[index].aspect; // aspect du feu;
if (ancien_tablo_signalCplx[adresse]<>EtatSignalCplx[adresse]) then //***if (ancien_tablo_signalCplx[adresse]<>EtatSignalCplx[adresse]) then
begin begin
ancien_tablo_signalCplx[adresse]:=EtatSignalCplx[adresse]; //***ancien_tablo_signalCplx[adresse]:=EtatSignalCplx[adresse];
code:=EtatSignalCplx[adresse]; code:=EtatSignalCplx[adresse];
code_to_aspect(code,aspect,combine); code_to_aspect(code,aspect,combine);
s:='Signal NMRA: ad'+IntToSTR(adresse)+'='+chaine_signal(code); s:='Signal NMRA: ad'+IntToSTR(adresse)+'='+chaine_signal(code);
@@ -1937,9 +1970,9 @@ var modele,index: integer ;
begin begin
index:=Index_feu(adresse); // tranforme l'adresse du feu en index tableau index:=Index_feu(adresse); // tranforme l'adresse du feu en index tableau
if (ancien_tablo_signalCplx[adresse]<>EtatSignalCplx[adresse]) then //***if (ancien_tablo_signalCplx[adresse]<>EtatSignalCplx[adresse]) then
begin begin
ancien_tablo_signalCplx[adresse]:=EtatSignalCplx[adresse]; //***ancien_tablo_signalCplx[adresse]:=EtatSignalCplx[adresse];
code:=EtatSignalCplx[adresse]; code:=EtatSignalCplx[adresse];
code_to_aspect(code,aspect,combine); code_to_aspect(code,aspect,combine);
s:='Signal Unisemaf: ad'+IntToSTR(adresse)+'='+chaine_signal(code); s:='Signal Unisemaf: ad'+IntToSTR(adresse)+'='+chaine_signal(code);
@@ -2230,9 +2263,9 @@ procedure envoi_LDT(adresse : integer);
var code,aspect,combine,mode : word; var code,aspect,combine,mode : word;
s : string; s : string;
begin begin
if (ancien_tablo_signalCplx[adresse]<>EtatSignalCplx[adresse]) then //; && (stop_cmd==FALSE)) //***if (ancien_tablo_signalCplx[adresse]<>EtatSignalCplx[adresse]) then //; && (stop_cmd==FALSE))
begin begin
ancien_tablo_signalCplx[adresse]:=EtatSignalCplx[adresse]; //***ancien_tablo_signalCplx[adresse]:=EtatSignalCplx[adresse];
code:=EtatSignalCplx[adresse]; code:=EtatSignalCplx[adresse];
code_to_aspect(code,aspect,combine); code_to_aspect(code,aspect,combine);
s:='Signal LDT: ad'+IntToSTR(adresse)+'='+chaine_signal(code); s:='Signal LDT: ad'+IntToSTR(adresse)+'='+chaine_signal(code);
@@ -2305,7 +2338,7 @@ var aspect,code,combine : word;
ralrap, jau ,Ancralrap,Ancjau : boolean; ralrap, jau ,Ancralrap,Ancjau : boolean;
s : string; s : string;
begin begin
if (ancien_tablo_signalCplx[adresse]<>EtatSignalCplx[adresse]) then //; && (stop_cmd==FALSE)) //***if (ancien_tablo_signalCplx[adresse]<>EtatSignalCplx[adresse]) then //; && (stop_cmd==FALSE))
begin begin
code:=EtatSignalCplx[adresse]; code:=EtatSignalCplx[adresse];
@@ -2322,7 +2355,8 @@ begin
(TestBit(ancien_tablo_signalCplx[adresse],rappel_30)) or (TestBit(ancien_tablo_signalCplx[adresse],rappel_60)) ; (TestBit(ancien_tablo_signalCplx[adresse],rappel_30)) or (TestBit(ancien_tablo_signalCplx[adresse],rappel_60)) ;
// si ancien état du signal=jaune ou jaune cli // si ancien état du signal=jaune ou jaune cli
Ancjau:=(TestBit(ancien_tablo_signalCplx[adresse],jaune)) or (TestBit(ancien_tablo_signalCplx[adresse],jaune_cli)) ; Ancjau:=(TestBit(ancien_tablo_signalCplx[adresse],jaune)) or (TestBit(ancien_tablo_signalCplx[adresse],jaune_cli)) ;
ancien_tablo_signalCplx[adresse]:=EtatSignalCplx[adresse];
//***ancien_tablo_signalCplx[adresse]:=EtatSignalCplx[adresse];
// si état demandé du signal=ralentissement ou rappel // si état demandé du signal=ralentissement ou rappel
ralrap:=(TestBit(code,ral_30)) or (TestBit(code,ral_60)) or ralrap:=(TestBit(code,ral_30)) or (TestBit(code,ral_60)) or
@@ -2518,7 +2552,7 @@ else
signalCplx:=232; signalCplx:=232;
if ((aiguillage[1].position<>2) and (aiguillage[3].position=2) and (aiguillage[4].position=2) and (aiguillage[6].position<>0)) then if ((aiguillage[1].position<>2) and (aiguillage[3].position=2) and (aiguillage[4].position=2) and (aiguillage[6].position<>0)) then
begin begin
if detecteur[516] then Maj_Etat_Signal(signalCplx,blanc) if detecteur[516].etat then Maj_Etat_Signal(signalCplx,blanc)
else Maj_Etat_Signal(signalCplx,blanc_cli) else Maj_Etat_Signal(signalCplx,blanc_cli)
end end
else Maj_Etat_Signal(signalCplx,violet); else Maj_Etat_Signal(signalCplx,violet);
@@ -2715,7 +2749,7 @@ signalCplx:=316;
if ( (aiguillage[5].position=2) and (aiguillage[3].position<>2) and (aiguillage[1].position<>2) ) or if ( (aiguillage[5].position=2) and (aiguillage[3].position<>2) and (aiguillage[1].position<>2) ) or
( feux[index_feu(signalCplx)].check.checked) then ( feux[index_feu(signalCplx)].check.checked) then
begin begin
if detecteur[518] then Maj_Etat_Signal(signalCplx,blanc_cli) else Maj_Etat_Signal(signalCplx,blanc) ; if detecteur[518].etat then Maj_Etat_Signal(signalCplx,blanc_cli) else Maj_Etat_Signal(signalCplx,blanc) ;
end end
else else
begin begin
@@ -3207,69 +3241,102 @@ end; // de la proc
// pilotage d'un signal // pilotage d'un signal
procedure envoi_signal(Adr : integer); procedure envoi_signal(Adr : integer);
var i,adresse,a,aspect,x,y,x0,y0,TailleX,TailleY,Orientation : integer; var i,adresse,det,a,b,aspect,x,y,x0,y0,TailleX,TailleY,Orientation : integer;
ImageFeu : TImage; ImageFeu : TImage;
frX,frY : real; frX,frY : real;
s : string;
begin begin
i:=index_feu(Adr); i:=index_feu(Adr);
if feux[i].aspect<10 then if (ancien_tablo_signalCplx[adr]<>EtatSignalCplx[adr]) then //***
begin begin
// envoie la commande au décodeur if feux[i].aspect<10 then // si signal non directionnel
case feux[i].decodeur of
0 : envoi_virtuel(Adr);
1 : envoi_signalBahn(Adr);
2 : envoi_CDF(Adr);
3 : envoi_LDT(Adr);
4 : envoi_LEB(Adr);
5 : envoi_NMRA(Adr);
6 : envoi_UniSemaf(Adr);
end;
// allume les signaux du feu dans la fenêtre de droite
Dessine_feu_mx(Feux[i].Img.Canvas,0,0,1,1,adr,1);
// allume les signaux du feu dans le TCO
if AvecTCO then
begin begin
for y:=1 to NbreCellY do // envoie la commande au décodeur
for x:=1 to NbreCellX do case feux[i].decodeur of
begin 0 : envoi_virtuel(Adr);
if TCO[x,y].Bimage=30 then 1 : envoi_signalBahn(Adr);
begin 2 : envoi_CDF(Adr);
adresse:=TCO[x,y].adresse; // vérifie si le feu existe dans le TCO 3 : envoi_LDT(Adr);
a:=EtatsignalCplx[adresse]; // a = état binaire du feu 4 : envoi_LEB(Adr);
aspect:=TCO[x,y].aspect; 5 : envoi_NMRA(Adr);
case aspect of 6 : envoi_UniSemaf(Adr);
2 : ImageFeu:=Formprinc.Image2feux; end;
3 : ImageFeu:=Formprinc.Image3feux;
4 : ImageFeu:=Formprinc.Image4feux;
5 : ImageFeu:=Formprinc.Image5feux;
7 : ImageFeu:=Formprinc.Image7feux;
9 : ImageFeu:=Formprinc.Image9feux;
else ImageFeu:=Formprinc.Image3feux;
end;
x0:=(tco[x,y].x-1)*LargeurCell; // coordonnées XY du feu
y0:=(tco[x,y].y-1)*HauteurCell;
TailleY:=ImageFeu.picture.BitMap.Height; // taille du feu d'origine (verticale)
TailleX:=ImageFeu.picture.BitMap.Width;
Orientation:=TCO[x,y].FeuOriente;
// réduction variable en fonction de la taille des cellules
calcul_reduction(frx,fry,round(TailleX*LargeurCell/ZoomMax),round(tailleY*HauteurCell/ZoomMax),TailleX,TailleY);
// décalage en X pour mettre la tete du feu alignée sur le bord droit de la cellule pour les feux tournés à 90G // vérifier si on quitte le rouge
if orientation=2 then if Option_demarrage then
begin
a:=ancien_tablo_signalCplx[adr];
b:=EtatSignalCplx[adr];
if ((a=semaphore_F) or (a=carre_F) or (a=violet_F)) and ((b<>semaphore_F) and (b<>carre_F) and (b<>violet_F)) then
if not(Diffusion) then Affiche('On quitte le rouge du signal '+intToSTR(adr),clyellow);
// y a t il un train en face du signal
if cdm_connecte then
begin
det:=feux[i].Adr_det1;
if det<>0 then
begin
// test si train sur le détecteur det
if detecteur[det].etat then
begin begin
if aspect=9 then x0:=x0+round(10*frX); detecteur[det].tempo:=20; // armer la tempo à 2s
if aspect=7 then x0:=x0+round(10*frX); // arreter le train
if aspect=5 then begin x0:=x0+round(10*frX);y0:=y0+HauteurCell-round(tailleX*frY); end; s:=detecteur[det].train;
if aspect=4 then begin x0:=x0+round(10*frX);y0:=y0+HauteurCell-round(tailleX*frY); end; Affiche('et son détecteur '+IntToSTR(det)+'=1 tempo démarrage '+s,clYellow);
if aspect=3 then begin x0:=x0+round(10*frX);y0:=y0+HauteurCell-round(tailleX*frY); end; s:=chaine_CDM_vitesse(1,s); // 0%
if aspect=2 then begin x0:=x0+round(10*frX);y0:=y0+HauteurCell-round(tailleX*frY); end; envoi_cdm(s);
end; end;
// Dessine_feu_mx(PCanvasTCO,x0,y0,frx,fry,adresse,orientation);
Dessine_feu_mx(PCanvasTCO,tco[x,y].x,tco[x,y].y,frx,fry,adresse,orientation);
end; end;
end; end;
end;
ancien_tablo_signalCplx[adr]:=EtatSignalCplx[adr]; //***
// allume les signaux du feu dans la fenêtre de droite
Dessine_feu_mx(Feux[i].Img.Canvas,0,0,1,1,adr,1);
// allume les signaux du feu dans le TCO
if AvecTCO then
begin
for y:=1 to NbreCellY do
for x:=1 to NbreCellX do
begin
if TCO[x,y].Bimage=30 then
begin
adresse:=TCO[x,y].adresse; // vérifie si le feu existe dans le TCO
a:=EtatsignalCplx[adresse]; // a = état binaire du feu
aspect:=TCO[x,y].aspect;
case aspect of
2 : ImageFeu:=Formprinc.Image2feux;
3 : ImageFeu:=Formprinc.Image3feux;
4 : ImageFeu:=Formprinc.Image4feux;
5 : ImageFeu:=Formprinc.Image5feux;
7 : ImageFeu:=Formprinc.Image7feux;
9 : ImageFeu:=Formprinc.Image9feux;
else ImageFeu:=Formprinc.Image3feux;
end;
x0:=(tco[x,y].x-1)*LargeurCell; // coordonnées XY du feu
y0:=(tco[x,y].y-1)*HauteurCell;
TailleY:=ImageFeu.picture.BitMap.Height; // taille du feu d'origine (verticale)
TailleX:=ImageFeu.picture.BitMap.Width;
Orientation:=TCO[x,y].FeuOriente;
// réduction variable en fonction de la taille des cellules
calcul_reduction(frx,fry,round(TailleX*LargeurCell/ZoomMax),round(tailleY*HauteurCell/ZoomMax),TailleX,TailleY);
// décalage en X pour mettre la tete du feu alignée sur le bord droit de la cellule pour les feux tournés à 90G
if orientation=2 then
begin
if aspect=9 then x0:=x0+round(10*frX);
if aspect=7 then x0:=x0+round(10*frX);
if aspect=5 then begin x0:=x0+round(10*frX);y0:=y0+HauteurCell-round(tailleX*frY); end;
if aspect=4 then begin x0:=x0+round(10*frX);y0:=y0+HauteurCell-round(tailleX*frY); end;
if aspect=3 then begin x0:=x0+round(10*frX);y0:=y0+HauteurCell-round(tailleX*frY); end;
if aspect=2 then begin x0:=x0+round(10*frX);y0:=y0+HauteurCell-round(tailleX*frY); end;
end;
// Dessine_feu_mx(PCanvasTCO,x0,y0,frx,fry,adresse,orientation);
Dessine_feu_mx(PCanvasTCO,tco[x,y].x,tco[x,y].y,frx,fry,adresse,orientation);
end;
end;
end;
end; end;
end; end;
end; end;
@@ -3469,7 +3536,8 @@ begin
end; end;
for i:=1 to 1024 do for i:=1 to 1024 do
begin begin
Detecteur[i]:=false; Detecteur[i].etat:=false;
Detecteur[i].train:='0';
Ancien_detecteur[i]:=false; Ancien_detecteur[i]:=false;
end; end;
//ChDir(s); //ChDir(s);
@@ -4032,7 +4100,7 @@ begin
repeat repeat
//Affiche('Boucle de direction',clyellow); //Affiche('Boucle de direction',clyellow);
//Affiche(s,clOrange); //Affiche(s,clOrange);
if s[1]<>'A' then begin Affiche('Erreur a la ligne',clred);exit;end; if s[1]<>'A' then begin Affiche('Erreur a la ligne '+s,clred);exit;end;
delete(s,1,1); delete(s,1,1);
val(s,adr,erreur); // adresse val(s,adr,erreur); // adresse
c:=s[erreur]; // type c:=s[erreur]; // type
@@ -4459,14 +4527,14 @@ end;
// front descendant sur un détecteur // front descendant sur un détecteur
function detecteur_0(adresse : integer) : boolean; function detecteur_0(adresse : integer) : boolean;
begin begin
detecteur_0:=(Ancien_detecteur[adresse]=true) and ((detecteur[adresse])=false); detecteur_0:=(Ancien_detecteur[adresse]=true) and ((detecteur[adresse].etat)=false);
Ancien_detecteur[adresse]:=detecteur[adresse]; Ancien_detecteur[adresse]:=detecteur[adresse].etat;
end; end;
function detecteur_1(adresse : integer) : boolean; function detecteur_1(adresse : integer) : boolean;
begin begin
detecteur_1:=(Ancien_detecteur[adresse]=false) and ((detecteur[adresse])=true); detecteur_1:=(Ancien_detecteur[adresse]=false) and ((detecteur[adresse].etat)=true);
Ancien_detecteur[adresse]:=detecteur[adresse]; Ancien_detecteur[adresse]:=detecteur[adresse].etat;
end; end;
function virgule_prec(sl : string;o : integer) : integer; function virgule_prec(sl : string;o : integer) : integer;
@@ -5126,12 +5194,12 @@ end;
// renvoie l'adresse du détecteur suivant des deux éléments contigus // renvoie l'adresse du détecteur suivant des deux éléments contigus
// TypeElprec/actuel: 1= détecteur 2= aiguillage 3=bis 4=Buttoir // TypeElprec/actuel: 1= détecteur 2= aiguillage 4=Buttoir
function detecteur_suivant(prec : integer;TypeElPrec : integer;actuel : integer;TypeElActuel : integer) : integer ; function detecteur_suivant(prec : integer;TypeElPrec : integer;actuel : integer;TypeElActuel : integer) : integer ;
var actuelCalc,PrecCalc,etat,i,j,AdrSuiv , var actuelCalc,PrecCalc,etat,i,j,AdrSuiv ,
TypeprecCalc,TypeActuelCalc : integer; TypeprecCalc,TypeActuelCalc : integer;
begin begin
if NivDebug>=2 then AfficheDebug('cherche détecteur suivant aux '+IntToSTR(prec)+'/'+IntToSTR(typeElPrec)+' - '+intToSTR(actuel)+'/'+intToSTR(TypeElActuel),clyellow); if NivDebug>=2 then AfficheDebug('Proc Detecteur_suivant '+IntToSTR(prec)+','+IntToSTR(typeElPrec)+'/'+intToSTR(actuel)+','+intToSTR(TypeElActuel),clyellow);
j:=0; j:=0;
PrecCalc:=prec; PrecCalc:=prec;
@@ -5226,12 +5294,12 @@ begin
end; end;
// renvoie l'adresse du détecteur suivant des deux éléments // renvoie l'adresse du détecteur suivant des deux éléments
// El1 et El2 peuvent être séparés par des aiguillages // El1 et El2 peuvent être séparés par des aiguillages, mais de pas plus de 3 détecteurs
// en sortie : 9999= det1 ou det2 non trouvé // en sortie : 9999= det1 ou det2 non trouvé
// 9996 : non trouvé // 9996 : non trouvé
function detecteur_suivant_El(el1: integer;TypeDet1 : integer;el2 : integer;TypeDet2 : integer) : integer ; function detecteur_suivant_El(el1: integer;TypeDet1 : integer;el2 : integer;TypeDet2 : integer) : integer ;
var IndexBranche_det1,IndexBranche_det2,branche_trouve_det1,branche_trouve_det2,i, var IndexBranche_det1,IndexBranche_det2,branche_trouve_det1,branche_trouve_det2,i,
j,AdrPrec,Adr,AdrFonc,TypePrec,TypeFonc,i1,i2,index : integer; j,AdrPrec,Adr,AdrFonc,TypePrec,TypeFonc,i1,i2,index,N_det : integer;
Sortie : boolean; Sortie : boolean;
s : string; s : string;
label reprise; label reprise;
@@ -5295,29 +5363,34 @@ begin
typeFonc:=BrancheN[branche_trouve_det1,i1].Btype ; typeFonc:=BrancheN[branche_trouve_det1,i1].Btype ;
i:=0; i:=0;N_Det:=0;
if AdrFonc<>El2 then // si pas déja trouvé le sens de progression if AdrFonc<>El2 then // si pas déja trouvé le sens de progression
repeat begin
//AfficheDebug('Engage '+IntToSTR(AdrPrec)+','+IntToSTR(typePrec)+'/'+IntToSTR(AdrFonc)+','+IntToSTR(typeFonc),clyellow); repeat
Adr:=suivant_alg3(AdrPrec,TypePrec,AdrFonc,TypeFonc,1); //AfficheDebug('Engage '+IntToSTR(AdrPrec)+','+IntToSTR(typePrec)+'/'+IntToSTR(AdrFonc)+','+IntToSTR(typeFonc),clyellow);
//AfficheDebug('Sortie Alg3: '+IntToSTR(Adr)+'/'+intToSTR(typeGen),clyellow); if nivDebug=3 then AfficheDebug('i='+IntToSTR(i)+' NDet='+IntToSTR(N_det),clyellow);
Adr:=suivant_alg3(AdrPrec,TypePrec,AdrFonc,TypeFonc,1);
//AfficheDebug('Sortie Alg3: '+IntToSTR(Adr)+'/'+intToSTR(typeGen),clyellow);
if TypeGen=1 then inc(N_Det);
if NivDebug=3 then
begin
s:='613 : trouvé='+intToSTR(Adr);
case typeGen of
1 : s:=s+' detecteur';
2 : s:=s+' aiguillage';
3 : s:=s+' aiguillage bis';
end;
AfficheDebug(s,clorange);
end;
if NivDebug=3 then AdrPrec:=AdrFonc;TypePrec:=TypeFonc;
begin AdrFonc:=Adr;TypeFonc:=typeGen;
s:='613 : trouvé='+intToSTR(Adr); inc(i);
case typeGen of sortie:=((typeDet2=TypeGen) and (Adr=el2)) or (Adr=0) or (Adr>=9996) or (i=15) or (N_Det=3);
1 : s:=s+' detecteur'; until sortie ;
2 : s:=s+' aiguillage'; if (i=15) and (Nivdebug=3) then afficheDebug('Pas trouvé',clyellow);
3 : s:=s+' aiguillage bis'; if (N_det=3) and (Nivdebug=3) then afficheDebug('Détecteurs trop distants',clyellow);
end; end
AfficheDebug(s,clorange);
end;
AdrPrec:=AdrFonc;TypePrec:=TypeFonc;
AdrFonc:=Adr;TypeFonc:=typeGen;
inc(i);
sortie:=((typeDet2=TypeGen) and (Adr=el2)) or (Adr=0) or (Adr>=9996) or (i=20);
until sortie
else else
begin begin
@@ -5340,7 +5413,6 @@ begin
case typeGen of case typeGen of
1 : s:=s+' detecteur'; 1 : s:=s+' detecteur';
2 : s:=s+' aiguillage'; 2 : s:=s+' aiguillage';
3 : s:=s+' aiguillage bis';
end; end;
AfficheDebug(s,clorange); AfficheDebug(s,clorange);
end; end;
@@ -5348,7 +5420,7 @@ begin
AdrPrec:=AdrFonc;TypePrec:=TypeFonc; AdrPrec:=AdrFonc;TypePrec:=TypeFonc;
AdrFonc:=Adr;TypeFonc:=typeGen; AdrFonc:=Adr;TypeFonc:=typeGen;
inc(i); inc(i);
sortie:=(TypeGen=1) or (Adr=0) or (Adr>=9996) or (i=20); sortie:=(TypeGen=1) or (Adr=0) or (Adr>=9996) or (i=10);
until sortie; until sortie;
if TypeGen=1 then if TypeGen=1 then
begin begin
@@ -5361,7 +5433,7 @@ begin
exit; exit;
end; end;
end; end;
if (i=20) then if NivDebug=3 then AfficheDebug('201 : Itération trop longue',clred); if (i=10) then if NivDebug=3 then AfficheDebug('201 : Itération trop longue',clred);
inc(j); inc(j);
//AfficheDebug('j='+intToSTR(j),clyellow); //AfficheDebug('j='+intToSTR(j),clyellow);
until j=3; until j=3;
@@ -5370,6 +5442,7 @@ begin
end; end;
// renvoie vrai si les aiguillages déclarés dans la définition du signal sont mal positionnés
function cond_carre(adresse : integer) : boolean; function cond_carre(adresse : integer) : boolean;
var i,l,k,NCondCarre,adrAig : integer; var i,l,k,NCondCarre,adrAig : integer;
resultatET,resultatOU: boolean; resultatET,resultatOU: boolean;
@@ -5967,10 +6040,89 @@ begin
test_route_valide:=10 ; test_route_valide:=10 ;
end; end;
// présence train 3 détecteurs avant le feu
function PresTrainPrec(AdrFeu : integer) : boolean;
var PresTrain : boolean;
j,i,Det_initial,Adr_El_Suiv,Btype_el_suivant,DetPrec1,DetPrec2,DetPrec3,DetPrec4 : integer;
begin
if (AffSignal) or (NivDebug=3) then AfficheDebug('Le feu '+intToSTR(AdrFeu)+' est verrouillable au carré',clyellow);
// **** un feu peut être associé à 4 détecteurs (pour 4 voies convergentes) *****
// il faut donc explorer les 4 détecteurs probables
PresTrain:=FALSE;
j:=1;
i:=index_feu(Adrfeu);
repeat
if NivDebug=3 then afficheDebug('Séquence '+IntToSTR(j)+' de recherche des 4 détecteurs précédents-----',clOrange);
if (j=1) then
begin
det_initial:=feux[i].Adr_det1;Adr_El_Suiv:=feux[i].Adr_el_suiv1;
if feux[i].Btype_suiv1=1 then Btype_el_suivant:=1;
if feux[i].Btype_suiv1=2 then Btype_el_suivant:=2;
if feux[i].Btype_suiv1=4 then Btype_el_suivant:=2; // BType_suiv: 1=détecteur 2=aig ou TJD ou TJS 4=tri
end; // Btye_el_suivant: 1= détecteur 2= aiguillage 4=Buttoir
if (j=2) then
begin
det_initial:=feux[i].Adr_det2;Adr_El_Suiv:=feux[i].Adr_el_suiv2;
if feux[i].Btype_suiv1=1 then Btype_el_suivant:=1;
if feux[i].Btype_suiv1=2 then Btype_el_suivant:=2;
if feux[i].Btype_suiv1=4 then Btype_el_suivant:=2;
end;
if (j=3) then
begin
det_initial:=feux[i].Adr_det3;Adr_El_Suiv:=feux[i].Adr_el_suiv3;
if feux[i].Btype_suiv1=1 then Btype_el_suivant:=1;
if feux[i].Btype_suiv1=2 then Btype_el_suivant:=2;
if feux[i].Btype_suiv1=4 then Btype_el_suivant:=2;
end;
if (j=4) then
begin
det_initial:=feux[i].Adr_det4;Adr_El_Suiv:=feux[i].Adr_el_suiv4;
if feux[i].Btype_suiv1=1 then Btype_el_suivant:=1;
if feux[i].Btype_suiv1=2 then Btype_el_suivant:=2;
if feux[i].Btype_suiv1=4 then Btype_el_suivant:=2;
end;
if (det_initial<>0) then
begin
DetPrec1:=detecteur_suivant(Adr_El_Suiv,Btype_el_suivant,det_initial,1);
if DetPrec1<9996 then // route bloquée par aiguillage mal positionné
begin
DetPrec2:=detecteur_suivant_El(det_initial,1,DetPrec1,1);
if DetPrec2<9996 then
begin
DetPrec3:=detecteur_suivant_El(DetPrec1,1,DetPrec2,1);
if DetPrec3<9996 then
begin
DetPrec4:=detecteur_suivant_El(DetPrec2,1,DetPrec3,1);
if AffSignal or (NivDebug=3) then AfficheDebug('les détecteurs précédents au feu '+IntToSTR(Adrfeu)+' sont:'+intToSTR(Det_initial)+' '+intToSTR(DetPrec1)+' '+intToSTR(DetPrec2)+' '+intToSTR(DetPrec3)+' '+intToSTR(DetPrec4),clyellow);
PresTrain:=MemZone[DetPrec4,detPrec3] or
MemZone[DetPrec3,detPrec2] or MemZone[DetPrec2,detPrec1] or MemZone[DetPrec1,Det_initial] or presTrain ;
if AffSignal or (NivDebug=3) then
begin
if MemZone[DetPrec4,detPrec3] then AfficheDebug('0.présence train '+IntToSTR(DetPrec4)+' '+IntToSTR(detPrec3),clyellow);
if MemZone[DetPrec3,detPrec2] then AfficheDebug('1.présence train '+IntToSTR(DetPrec3)+' '+IntToSTR(detPrec2),clyellow);
if MemZone[DetPrec2,detPrec1] then AfficheDebug('2.présence train '+IntToSTR(DetPrec2)+' '+IntToSTR(detPrec1),clyellow);
if MemZone[DetPrec1,det_initial] then AfficheDebug('3.présence train '+IntToSTR(DetPrec1)+' '+IntToSTR(det_Initial),clyellow);
//if PresTrain then AfficheDebug('présence train',clyellow) else afficheDebug('abscence train',clyellow);
end;
//if AffSignal then AfficheDebug('MemZone'+intToSTR(DetPrec3)+' '+IntToSTR(detPrec2) = '+MemZone[DetPrec3,detPrec2]
end;
end;
end;
end;
inc(j);
until (j>=5);
if presTrain or (NivDebug=3) then
begin
if AffSignal Then afficheDebug('présence train feu '+intToSTR(AdrFeu),clorange)
else AfficheDebug('Absence train feu '+intToSTR(AdrFeu),clorange);
end;
PresTrainPrec:=presTrain;
end;
// mise à jour de l'état d'un feu en fontion de son environnement et affiche le feu // mise à jour de l'état d'un feu en fontion de son environnement et affiche le feu
procedure Maj_Feu(Adrfeu : integer); procedure Maj_Feu(Adrfeu : integer);
var i,j,k1,k2,BtypeSuiv,Adr_det,etat,Adr,Aig,DetPrec1,DetPrec2,Detprec3,Detprec4,Adr_El_Suiv, var i,j,k1,k2,BtypeSuiv,Adr_det,etat,Adr,Aig,Adr_El_Suiv,
Btype_el_suivant,det_initial,bt,el_suiv,modele : integer ; Btype_el_suivant,det_initial,bt,el_suiv,modele : integer ;
PresTrain,Aff_semaphore,car : boolean; PresTrain,Aff_semaphore,car : boolean;
code,combine : word; code,combine : word;
@@ -6049,74 +6201,7 @@ begin
if (Feux[i].aspect>=3) and (EtatSignalCplx[AdrFeu]<>violet_F) then if (Feux[i].aspect>=3) and (EtatSignalCplx[AdrFeu]<>violet_F) then
begin begin
// détecteurs précédent le feu , pour déterminer si leurs mémoires de zones sont à 1 pour libérer le carré // détecteurs précédent le feu , pour déterminer si leurs mémoires de zones sont à 1 pour libérer le carré
if (Feux[i].VerrouCarre) and (Feux[i].aspect>=4) then if (Feux[i].VerrouCarre) and (Feux[i].aspect>=4) then presTrain:=PresTrainPrec(AdrFeu);
begin
if AffSignal then AfficheDebug('Le feu est verrouillable au carré',clyellow);
// **** un feu peut être associé à 4 détecteurs (pour 4 voies convergentes) *****
// il faut donc explorer les 4 détecteurs probables
PresTrain:=FALSE;
j:=1;
repeat
if NivDebug=3 then afficheDebug('Séquence '+IntToSTR(j)+' de recherche des 4 détecteurs précédents-----',clOrange);
if (j=1) then
begin det_initial:=feux[i].Adr_det1;Adr_El_Suiv:=feux[i].Adr_el_suiv1;
if feux[i].Btype_suiv1=1 then Btype_el_suivant:=1;
if feux[i].Btype_suiv1=2 then Btype_el_suivant:=2;
if feux[i].Btype_suiv1=5 then Btype_el_suivant:=3; // 1=détécteur 2=aig 5=bis
end;
if (j=2) then
begin
det_initial:=feux[i].Adr_det2;Adr_El_Suiv:=feux[i].Adr_el_suiv2;
if feux[i].Btype_suiv1=1 then Btype_el_suivant:=1;
if feux[i].Btype_suiv1=2 then Btype_el_suivant:=2;
if feux[i].Btype_suiv1=5 then Btype_el_suivant:=3; // 1=détécteur 2=aig 5=bis
end;
if (j=3) then
begin det_initial:=feux[i].Adr_det3;Adr_El_Suiv:=feux[i].Adr_el_suiv3;
if feux[i].Btype_suiv1=1 then Btype_el_suivant:=1;
if feux[i].Btype_suiv1=2 then Btype_el_suivant:=2;
if feux[i].Btype_suiv1=5 then Btype_el_suivant:=3; // 1=détécteur 2=aig 5=bis
end;
if (j=4) then
begin
det_initial:=feux[i].Adr_det4;Adr_El_Suiv:=feux[i].Adr_el_suiv4;
if feux[i].Btype_suiv1=1 then Btype_el_suivant:=1;
if feux[i].Btype_suiv1=2 then Btype_el_suivant:=2;
if feux[i].Btype_suiv1=5 then Btype_el_suivant:=3; // le type du feu 1=détécteur 2=aig 5=bis
end;
if (det_initial<>0) then
begin
DetPrec1:=detecteur_suivant(Adr_El_Suiv,Btype_el_suivant,det_initial,1);
if DetPrec1<9996 then // route bloquée par aiguillage mal positionné
begin
DetPrec2:=detecteur_suivant_El(det_initial,1,DetPrec1,1);
if DetPrec2<9996 then
begin
DetPrec3:=detecteur_suivant_El(DetPrec1,1,DetPrec2,1);
if DetPrec3<9996 then
begin
//DetPrec4:=detecteur_suivant_det(DetPrec2,DetPrec3);
if AffSignal then AfficheDebug('les détecteurs précédents au feu '+IntToSTR(Adrfeu)+' sont:'+intToSTR(Det_initial)+' '+intToSTR(DetPrec1)+' '+intToSTR(DetPrec2)+' '+intToSTR(DetPrec3)+' ',clyellow);
PresTrain:=//MemZone[DetPrec4,detPrec3] or
MemZone[DetPrec3,detPrec2] or MemZone[DetPrec2,detPrec1] or MemZone[DetPrec1,Det_initial] or presTrain ;
if AffSignal then
begin
if MemZone[DetPrec3,detPrec2] then AfficheDebug('1.présence train '+IntToSTR(DetPrec3)+' '+IntToSTR(detPrec2),clyellow);
if MemZone[DetPrec2,detPrec1] then AfficheDebug('2.présence train '+IntToSTR(DetPrec2)+' '+IntToSTR(detPrec1),clyellow);
if MemZone[DetPrec1,det_initial] then AfficheDebug('3.présence train '+IntToSTR(DetPrec1)+' '+IntToSTR(det_Initial),clyellow);
//if PresTrain then AfficheDebug('présence train',clyellow) else afficheDebug('abscence train',clyellow);
end;
//if AffSignal then AfficheDebug('MemZone'+intToSTR(DetPrec3)+' '+IntToSTR(detPrec2) = '+MemZone[DetPrec3,detPrec2]
end;
end;
end;
end;
inc(j);
until (j>=5);
if presTrain and AffSignal Then afficheDebug('présence train feu '+intToSTR(AdrFeu),clorange);
end;
if AffSignal then afficheDebug('Fin de la recherche des 4 détecteurs précédents-----',clOrange); if AffSignal then afficheDebug('Fin de la recherche des 4 détecteurs précédents-----',clOrange);
// si le signal peut afficher un carré et les aiguillages après le signal sont mal positionnées ou que pas présence train avant signal et signal // si le signal peut afficher un carré et les aiguillages après le signal sont mal positionnées ou que pas présence train avant signal et signal
@@ -6524,7 +6609,7 @@ begin
end; end;
// traitement sur les évènements détecteurs // traitement sur les évènements détecteurs
procedure Event_Detecteur(Adresse : integer;etat : boolean); procedure Event_Detecteur(Adresse : integer;etat : boolean;train : string);
var i,AdrSuiv,AdrFeu,AdrDetfeu,TrainActuel,Etat01,typeSuiv,AdrPrec : integer; var i,AdrSuiv,AdrFeu,AdrDetfeu,TrainActuel,Etat01,typeSuiv,AdrPrec : integer;
s : string; s : string;
begin begin
@@ -6546,7 +6631,7 @@ begin
if AffAigDet then if AffAigDet then
begin begin
//s:='Evt Det '+intToSTR(adresse)+'='+intToSTR(etat01); //s:='Evt Det '+intToSTR(adresse)+'='+intToSTR(etat01);
s:='Tick='+IntToSTR(tick)+' Det='+IntToSTR(adresse)+'='+intToSTR(etat01); s:='Tick='+IntToSTR(tick)+' Evt Det='+IntToSTR(adresse)+'='+intToSTR(etat01);
Affiche(s,clyellow); Affiche(s,clyellow);
if not(TraceListe) then AfficheDebug(s,clyellow); if not(TraceListe) then AfficheDebug(s,clyellow);
@@ -6554,8 +6639,9 @@ begin
//if etat then Mem[Adresse]:=true; // mémoriser l'état à 1 //if etat then Mem[Adresse]:=true; // mémoriser l'état à 1
ancien_detecteur[Adresse]:=detecteur[Adresse]; ancien_detecteur[Adresse]:=detecteur[Adresse].etat;
detecteur[Adresse]:=etat; detecteur[Adresse].etat:=etat;
detecteur[Adresse].train:=train;
detecteur_chgt:=Adresse; detecteur_chgt:=Adresse;
// stocke les changements d'état des détecteurs dans le tableau chronologique // stocke les changements d'état des détecteurs dans le tableau chronologique
@@ -6573,7 +6659,7 @@ begin
// détection front montant // détection front montant
if not(ancien_detecteur[Adresse]) and detecteur[Adresse] then if not(ancien_detecteur[Adresse]) and detecteur[Adresse].etat then
begin begin
// explorer les feux pour déverrouiller les feux dont le trajets viennent d'un buttoir pour changer le feu qd un train se présente // explorer les feux pour déverrouiller les feux dont le trajets viennent d'un buttoir pour changer le feu qd un train se présente
// sur le détecteur // sur le détecteur
@@ -6603,7 +6689,7 @@ begin
end; end;
// détection fronts descendants // détection fronts descendants
if ancien_detecteur[Adresse] and not(detecteur[Adresse]) and (N_Event_det<Max_event_det) then if ancien_detecteur[Adresse] and not(detecteur[Adresse].etat) and (N_Event_det<Max_event_det) then
begin begin
// si le FD du détecteur a déjà été stocké à l'index précédent ne pas en tenir compte // si le FD du détecteur a déjà été stocké à l'index précédent ne pas en tenir compte
//if event_det[N_event_det]<>Adresse then //if event_det[N_event_det]<>Adresse then
@@ -6668,7 +6754,7 @@ begin
N_Event_tick:=0; N_Event_tick:=0;
Affiche('Raz Evts détecteurs',clLime); Affiche('Raz Evts détecteurs',clLime);
end; end;
s:='Evt Aig '+intToSTR(adresse)+'='+intToSTR(pos); s:='Tick='+IntToSTR(tick)+' Evt Aig '+intToSTR(adresse)+'='+intToSTR(pos);
if pos=const_droit then s:=s+' droit' else s:=s+' dévié'; if pos=const_droit then s:=s+' droit' else s:=s+' dévié';
if AffAigDet then if AffAigDet then
begin begin
@@ -6689,7 +6775,7 @@ begin
begin begin
formTCO.Maj_TCO(Adresse); formTCO.Maj_TCO(Adresse);
end; end;
Maj_feux;
end; end;
@@ -6712,27 +6798,27 @@ begin
begin begin
// affecter l'état des détecteurs // affecter l'état des détecteurs
i:=adresse*8+8; i:=adresse*8+8;
if detecteur[i]<>((valeur and $8) = $8) then // si changement de l'état du détecteur bit 7 if detecteur[i].etat<>((valeur and $8) = $8) then // si changement de l'état du détecteur bit 7
begin begin
Event_detecteur(i,(valeur and $8) = $8); Event_detecteur(i,(valeur and $8) = $8,''); // pas de train affecté sur le décodage de la rétrosignalisation
end; end;
i:=adresse*8+7; i:=adresse*8+7;
if detecteur[i]<>((valeur and $4) = $4) then // si changement de l'état du détecteur bit 6 if detecteur[i].etat<>((valeur and $4) = $4) then // si changement de l'état du détecteur bit 6
begin begin
Event_detecteur(i,(valeur and $4) = $4); Event_detecteur(i,(valeur and $4) = $4,'');
end; end;
i:=adresse*8+6; i:=adresse*8+6;
if detecteur[i]<>((valeur and $2) = $2) then // si changement de l'état du détecteur bit 5 if detecteur[i].etat<>((valeur and $2) = $2) then // si changement de l'état du détecteur bit 5
begin begin
Event_detecteur(i,(valeur and $2) = $2); Event_detecteur(i,(valeur and $2) = $2,'');
end; end;
i:=adresse*8+5; i:=adresse*8+5;
if detecteur[i]<>((valeur and $1) = $1) then // si changement de l'état du détecteur bit 4 if detecteur[i].etat<>((valeur and $1) = $1) then // si changement de l'état du détecteur bit 4
begin begin
Event_detecteur(i,(valeur and $1) = $1); Event_detecteur(i,(valeur and $1) = $1,'');
end; end;
end; end;
@@ -6770,26 +6856,26 @@ begin
begin begin
// affecter l'état des détecteurs // affecter l'état des détecteurs
i:=adresse*8+4; i:=adresse*8+4;
if detecteur[i]<>((valeur and $8) = $8) then // si changement de l'état du détecteur bit 7 if detecteur[i].etat<>((valeur and $8) = $8) then // si changement de l'état du détecteur bit 7
begin begin
Event_detecteur(i,(valeur and $8) = $8); Event_detecteur(i,(valeur and $8) = $8,'');
end; end;
i:=adresse*8+3; i:=adresse*8+3;
if detecteur[i]<>((valeur and $4) = $4) then // si changement de l'état du détecteur bit 6 if detecteur[i].etat<>((valeur and $4) = $4) then // si changement de l'état du détecteur bit 6
begin begin
Event_detecteur(i,(valeur and $4) = $4); Event_detecteur(i,(valeur and $4) = $4,'');
end; end;
i:=adresse*8+2; i:=adresse*8+2;
if detecteur[i]<>((valeur and $2) = $2) then // si changement de l'état du détecteur bit 5 if detecteur[i].etat<>((valeur and $2) = $2) then // si changement de l'état du détecteur bit 5
begin begin
Event_detecteur(i,(valeur and $2) = $2); Event_detecteur(i,(valeur and $2) = $2,'');
end; end;
i:=adresse*8+1; i:=adresse*8+1;
if detecteur[i]<>((valeur and $1) = $1) then // si changement de l'état du détecteur bit 4 if detecteur[i].etat<>((valeur and $1) = $1) then // si changement de l'état du détecteur bit 4
begin begin
Event_detecteur(i,(valeur and $1) = $1); Event_detecteur(i,(valeur and $1) = $1,'');
end; end;
end; end;
@@ -7405,6 +7491,7 @@ begin
DebugOuv:=True; DebugOuv:=True;
AvecInit:=true; //&&&& AvecInit:=true; //&&&&
Option_demarrage:=false;
Diffusion:=AvecInit; Diffusion:=AvecInit;
Application.processMessages; Application.processMessages;
@@ -7619,7 +7706,7 @@ begin
if tempsCli>0 then dec(tempsCli); if tempsCli>0 then dec(tempsCli);
if tempsCli=0 then if tempsCli=0 then
begin begin
tempsCli:=5; tempsCli:=4;
clignotant:=not(clignotant); // inversion du clignotant clignotant:=not(clignotant); // inversion du clignotant
//tester chaque feu pour voir s'il y a un code de clignotement //tester chaque feu pour voir s'il y a un code de clignotement
for i:=1 to NbreFeux do for i:=1 to NbreFeux do
@@ -7726,7 +7813,7 @@ begin
if Tablo_simule[i_simule].detecteur<>0 then if Tablo_simule[i_simule].detecteur<>0 then
begin begin
s:='Simulation '+intToSTR(I_simule)+' Tick='+IntToSTR(tick)+' det='+intToSTR(Tablo_simule[i_simule].detecteur)+'='+IntToSTR(Tablo_simule[i_simule].etat); s:='Simulation '+intToSTR(I_simule)+' Tick='+IntToSTR(tick)+' det='+intToSTR(Tablo_simule[i_simule].detecteur)+'='+IntToSTR(Tablo_simule[i_simule].etat);
Event_Detecteur(Tablo_simule[i_simule].detecteur, Tablo_simule[i_simule].etat=1); // créer évt détecteur Event_Detecteur(Tablo_simule[i_simule].detecteur, Tablo_simule[i_simule].etat=1,''); // créer évt détecteur
StaticText.caption:=s; StaticText.caption:=s;
end; end;
@@ -7749,6 +7836,28 @@ begin
StaticText.caption:=''; StaticText.caption:='';
end; end;
end; end;
// temporisations de démarrage des trains au feux
if Option_demarrage then
for i:=1 to 1024 do
begin
if detecteur[i].tempo<>0 then
begin
dec(detecteur[i].tempo);
if detecteur[i].tempo=0 then
begin
//Affiche('tempo 0 Detecteur '+intToSTR(i),clyellow);
s:=detecteur[i].train;
Affiche('Tempo 0 timer train '+s,clOrange);
s:=chaine_CDM_vitesse(100,s); // 100%
envoi(s);
end;
end;
end;
end; end;
// bouton version centrale Lenz // bouton version centrale Lenz
@@ -7949,8 +8058,10 @@ var j,adr,NBranche : integer;
begin begin
for j:=1 to NDetecteurs do for j:=1 to NDetecteurs do
begin begin
s:='Dét '+intToSTR(Adresse_detecteur[j])+'='; adr:=Adresse_detecteur[j];
if Detecteur[adresse_detecteur[j]] then s:=s+'1' else s:=s+'0'; s:='Dét '+intToSTR(adr)+'=';
if Detecteur[adr].etat then s:=s+'1' else s:=s+'0';
s:=s+' '+Detecteur[Adr].train;
//s:=s+' Mem='; //s:=s+' Mem=';
//if Mem[adresse_detecteur[j]] then s:=s+'1' else s:=s+'0'; //if Mem[adresse_detecteur[j]] then s:=s+'1' else s:=s+'0';
Affiche(s,clYellow); Affiche(s,clYellow);
@@ -8049,7 +8160,7 @@ begin
end; end;
procedure Interprete_trameCDM(recuCDM : string); procedure Interprete_trameCDM(recuCDM : string);
var i,objet,posST,posAC,posDT,posSG,posXY,k,l,erreur, adr,adr2,etat,etataig, var i,j,objet,posST,posAC,posDT,posSG,posXY,k,l,erreur, adr,adr2,etat,etataig,
vitesse,etatAig2,name,prv : integer ; vitesse,etatAig2,name,prv : integer ;
x,y,x2,y2 : longint ; x,y,x2,y2 : longint ;
s,ss,train : string; s,ss,train : string;
@@ -8154,10 +8265,15 @@ begin
begin begin
i:=posEx('AD=',recuCDM,posDT);ss:=copy(recuCDM,i+3,10); i:=posEx('AD=',recuCDM,posDT);ss:=copy(recuCDM,i+3,10);
val(ss,adr,erreur); val(ss,adr,erreur);
i:=posEx('TRAIN=',recuCDM,posDT);
j:=PosEx(';',recuCDM,i);
train:=copy(recuCDM,i+6,j-i-6);
//Affiche('Train=*'+Train+'*',clOrange);
i:=posEx('STATE=',recuCDM,posDT);ss:=copy(recuCDM,i+6,10); i:=posEx('STATE=',recuCDM,posDT);ss:=copy(recuCDM,i+6,10);
Delete(recuCDM,posDT,i+5-posDT);
val(ss,etat,erreur); val(ss,etat,erreur);
Event_detecteur(Adr,etat=1); Delete(recuCDM,posDT,i+5-posDT);
if (train='_NONE') then train:=detecteur[Adr].train;
Event_detecteur(Adr,etat=1,train);
//Affiche(IntToSTR(adr)+' '+IntToSTR(etat),clyellow); //Affiche(IntToSTR(adr)+' '+IntToSTR(etat),clyellow);
if AfficheDet then Affiche('Rétro Détecteur '+intToSTR(adr)+'='+IntToStr(etat),clYellow); if AfficheDet then Affiche('Rétro Détecteur '+intToSTR(adr)+'='+IntToStr(etat),clYellow);
end ; end ;
+1609
View File
File diff suppressed because it is too large Load Diff
+8649
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+6 -6
View File
@@ -552,7 +552,7 @@ begin
Adr:=TCO[x,y].adresse; Adr:=TCO[x,y].adresse;
if Adr<>0 then if Adr<>0 then
begin begin
if detecteur[Adr] then if detecteur[Adr].etat then
begin begin
Brush.Color:=clAllume; Brush.Color:=clAllume;
pen.color:=clAllume; pen.color:=clAllume;
@@ -1066,7 +1066,7 @@ begin
Adr:=TCO[x,y].adresse; Adr:=TCO[x,y].adresse;
if Adr<>0 then if Adr<>0 then
begin begin
if detecteur[Adr] then if detecteur[Adr].etat then
begin begin
Brush.Color:=clAllume; Brush.Color:=clAllume;
pen.color:=clAllume; pen.color:=clAllume;
@@ -1114,7 +1114,7 @@ begin
Adr:=TCO[x,y].adresse; Adr:=TCO[x,y].adresse;
if Adr<>0 then if Adr<>0 then
begin begin
if detecteur[Adr] then if detecteur[Adr].etat then
begin begin
Brush.Color:=clAllume; Brush.Color:=clAllume;
pen.color:=clAllume; pen.color:=clAllume;
@@ -1652,7 +1652,7 @@ begin
Adr:=TCO[x,y].adresse; Adr:=TCO[x,y].adresse;
if Adr<>0 then if Adr<>0 then
begin begin
if detecteur[Adr] then if detecteur[Adr].etat then
begin begin
Brush.Color:=clAllume; Brush.Color:=clAllume;
pen.color:=clAllume; pen.color:=clAllume;
@@ -4028,14 +4028,14 @@ end;
procedure TFormTCO.Button1Click(Sender: TObject); procedure TFormTCO.Button1Click(Sender: TObject);
begin begin
Detecteur[569]:=true; Detecteur[569].etat:=true;
Maj_tco(569); Maj_tco(569);
end; end;
procedure TFormTCO.Button2Click(Sender: TObject); procedure TFormTCO.Button2Click(Sender: TObject);
begin begin
Detecteur[569]:=false; Detecteur[569].etat:=false;
Maj_tco(569); Maj_tco(569);
end; end;
+16 -16
View File
@@ -77,7 +77,7 @@
<script type="text/javascript" src="./styles/prosilver/template/forum_fn.js"></script> <script type="text/javascript" src="./styles/prosilver/template/forum_fn.js"></script>
<link href="./styles/prosilver/theme/print.css" rel="stylesheet" type="text/css" media="print" title="printonly" /> <link href="./styles/prosilver/theme/print.css" rel="stylesheet" type="text/css" media="print" title="printonly" />
<link href="./style.php?sid=c81070447515d84d3437afdf98a89d47&amp;id=1&amp;lang=en" rel="stylesheet" type="text/css" media="screen, projection" /> <link href="./style.php?sid=e0537f4fdbc9ba2c100f5b9ba31c8e17&amp;id=1&amp;lang=en" rel="stylesheet" type="text/css" media="screen, projection" />
<link href="./styles/prosilver/theme/normal.css" rel="stylesheet" type="text/css" title="A" /> <link href="./styles/prosilver/theme/normal.css" rel="stylesheet" type="text/css" title="A" />
<link href="./styles/prosilver/theme/medium.css" rel="alternate stylesheet" type="text/css" title="A+" /> <link href="./styles/prosilver/theme/medium.css" rel="alternate stylesheet" type="text/css" title="A+" />
@@ -167,7 +167,7 @@
</div> </div>
<div class="clear"></div> <div class="clear"></div>
<div id="p50499" class="post bg2 online"> <div id="p50499" class="post bg2">
<div class="inner"><span class="corners-top"><span></span></span> <div class="inner"><span class="corners-top"><span></span></span>
<div class="postbody"> <div class="postbody">
@@ -176,11 +176,11 @@
<p class="author"><a href="./viewtopic.php?p=50499#p50499"><img src="./styles/prosilver/imageset/icon_post_target.gif" width="11" height="9" alt="Message" title="Message" /></a>par <strong><a href="./memberlist.php?mode=viewprofile&amp;u=13164" style="color: #008800;" class="username-coloured">gily</a></strong> &raquo; 20 Janvier 2020, 21:25 </p> <p class="author"><a href="./viewtopic.php?p=50499#p50499"><img src="./styles/prosilver/imageset/icon_post_target.gif" width="11" height="9" alt="Message" title="Message" /></a>par <strong><a href="./memberlist.php?mode=viewprofile&amp;u=13164" style="color: #008800;" class="username-coloured">gily</a></strong> &raquo; 20 Janvier 2020, 21:25 </p>
<div class="content">Bonjour<br /><br />attention <span style="font-weight: bold">ne gère plus les aiguillages BIS qui sont problématiques</span>.<br />attention <span style="font-weight: bold">nécessite de nommer les variables du fichier config-gl.cfg - voir le fichier</span><br />attention <span style="font-weight: bold">changement de paramétrage des TJD</span><br /><br />Version 2.1 du 22/10/2020<br />Vous trouverez ici la version graphique du programme signaux_complexes_GL, client de CDM rail mais qui fonctionne aussi de façon autonome si vous disposez d'une centrale LENZ ou compatible. Il permet également de piloter des fonctions F de locomotives et des passages à niveaux à plusieurs voies d'après des actionneurs. Il gère un TCO et peut lancer CDM rail automatiquement avec votre LAY et l'interface choisie. <img src="./images/smilies/icon_mrgreen.gif" alt=":mrgreen:" title="M. Vert" /> <br /><br />Ce logiciel nécessite une installation : faire clic droit en sélectionnant &quot;exécuter en tant qu'administrateur&quot; sur installeur.exe.<br />Vous pouvez voir les nouveautés de chaque version dans le fichier versions.txt.<br /><br />Pour une mise à jour n'oubliez pas de sauvegarder vos deux fichiers de config (.cfg) avant de copier la nouvelle version ; vous pouvez ne copier que le fichier signaux_complexes_GL.exe.<br /><br />Elle est téléchargeable depuis ce lien (droits en contrôle total)<br /><div class="inline-attachment"> <dl class="file"> <div class="content">Bonjour<br /><br />attention <span style="font-weight: bold">ne gère plus les aiguillages BIS qui sont problématiques</span>.<br />attention <span style="font-weight: bold">nécessite de nommer les variables du fichier config-gl.cfg - voir le fichier</span><br />attention <span style="font-weight: bold">changement de paramétrage des TJD</span><br /><br />Version 2.11 du 15/11/2020<br />Vous trouverez ici la version graphique du programme signaux_complexes_GL, client de CDM rail mais qui fonctionne aussi de façon autonome si vous disposez d'une centrale LENZ ou compatible. Il permet également de piloter des fonctions F de locomotives et des passages à niveaux à plusieurs voies d'après des actionneurs. Il gère un TCO et peut lancer CDM rail automatiquement avec votre LAY et l'interface choisie. <img src="./images/smilies/icon_mrgreen.gif" alt=":mrgreen:" title="M. Vert" /> <br /><br />Ce logiciel nécessite une installation : faire clic droit en sélectionnant &quot;exécuter en tant qu'administrateur&quot; sur installeur.exe.<br />Vous pouvez voir les nouveautés de chaque version dans le fichier versions.txt.<br /><br />Pour une mise à jour n'oubliez pas de sauvegarder vos deux fichiers de config (.cfg) avant de copier la nouvelle version ; vous pouvez ne copier que le fichier signaux_complexes_GL.exe.<br /><br />Elle est téléchargeable depuis ce lien (droits en contrôle total)<br /><div class="inline-attachment"> <dl class="file">
<dt><img src="./styles/prosilver/imageset/icon_topic_attach.gif" width="7" height="10" alt="" title="" /> <a class="postlink" href="./download/file.php?id=12891">signaux_complexes_V2.1.zip</a></dt> <dt><img src="./styles/prosilver/imageset/icon_topic_attach.gif" width="7" height="10" alt="" title="" /> <a class="postlink" href="./download/file.php?id=12992">signaux_complexes_V2.11.zip</a></dt>
<dd>(737.11 Kio) Téléchargé 11 fois</dd> <dd>(728.73 Kio) Jamais téléchargé</dd>
</dl> </dl>
</div><br /><br />Notice: (cliquer dessus lance le téléchargement automatiquement)<br /><a href="https://github.com/f1iwq2/Signaux_complexes_GL/raw/master/Notice%20d'utilisation%20des%20signaux_complexes_GL_V2.1.pdf" class="postlink">https://github.com/f1iwq2/Signaux_complexes_GL/raw/master/Notice%20d'utilisation%20des%20signaux_complexes_GL_V2.1.pdf</a><br /><br />Pour les programmeurs, le zip suivant contient les fichiers source en Delphi, une notice avancée et l'installeur.<br /><a href="https://github.com/f1iwq2/Signaux_complexes_GL/archive/master.zip" class="postlink">https://github.com/f1iwq2/Signaux_complexes_GL/archive/master.zip</a><br /><br />A bientot<br /><br /><div class="inline-attachment"> <dl class="thumbnail"> </div><br /><br />Notice: (cliquer dessus lance le téléchargement automatiquement)<br /><a href="https://github.com/f1iwq2/Signaux_complexes_GL/raw/master/Notice%20d'utilisation%20des%20signaux_complexes_GL_V2.11.pdf" class="postlink">https://github.com/f1iwq2/Signaux_complexes_GL/raw/master/Notice%20d'utilisation%20des%20signaux_complexes_GL_V2.11.pdf</a><br /><br />Pour les programmeurs, le zip suivant contient les fichiers source en Delphi, une notice avancée et l'installeur.<br /><a href="https://github.com/f1iwq2/Signaux_complexes_GL/archive/master.zip" class="postlink">https://github.com/f1iwq2/Signaux_complexes_GL/archive/master.zip</a><br /><br />A bientot<br /><br /><div class="inline-attachment"> <dl class="thumbnail">
<dt><a href="./download/file.php?id=12085&amp;mode=view"><img src="./download/file.php?id=12085&amp;t=1" alt="scgl.jpg" title="scgl.jpg (274.24 Kio) Consulté 45 fois" /></a></dt> <dt><a href="./download/file.php?id=12085&amp;mode=view"><img src="./download/file.php?id=12085&amp;t=1" alt="scgl.jpg" title="scgl.jpg (274.24 Kio) Consulté 45 fois" /></a></dt>
</dl> </dl>
</div><br /><br /><div class="inline-attachment"> <dl class="thumbnail"> </div><br /><br /><div class="inline-attachment"> <dl class="thumbnail">
@@ -188,7 +188,7 @@
</dl> </dl>
</div></div> </div></div>
<div class="notice">Dernière édition par <a href="./memberlist.php?mode=viewprofile&amp;u=13164" style="color: #008800;" class="username-coloured">gily</a> le 05 Novembre 2020, 18:51, édité 104 fois au total. </div> <div class="notice">Dernière édition par <a href="./memberlist.php?mode=viewprofile&amp;u=13164" style="color: #008800;" class="username-coloured">gily</a> le 15 Novembre 2020, 10:46, édité 105 fois au total. </div>
</div> </div>
@@ -199,7 +199,7 @@
<dd>&nbsp;</dd> <dd>&nbsp;</dd>
<dd><strong>Messages:</strong> 754</dd><dd><strong>Inscrit le:</strong> 25 Juillet 2014, 14:32</dd><dd><strong>Localisation:</strong> nord</dd> <dd><strong>Messages:</strong> 755</dd><dd><strong>Inscrit le:</strong> 25 Juillet 2014, 14:32</dd><dd><strong>Localisation:</strong> nord</dd>
</dl> </dl>
<div class="back2top"><a href="#wrap" class="top" title="Haut">Haut</a></div> <div class="back2top"><a href="#wrap" class="top" title="Haut">Haut</a></div>
@@ -238,7 +238,7 @@
</div> </div>
<hr class="divider" /> <hr class="divider" />
<div id="p50510" class="post bg2 online"> <div id="p50510" class="post bg2">
<div class="inner"><span class="corners-top"><span></span></span> <div class="inner"><span class="corners-top"><span></span></span>
<div class="postbody"> <div class="postbody">
@@ -259,7 +259,7 @@
<dd>&nbsp;</dd> <dd>&nbsp;</dd>
<dd><strong>Messages:</strong> 754</dd><dd><strong>Inscrit le:</strong> 25 Juillet 2014, 14:32</dd><dd><strong>Localisation:</strong> nord</dd> <dd><strong>Messages:</strong> 755</dd><dd><strong>Inscrit le:</strong> 25 Juillet 2014, 14:32</dd><dd><strong>Localisation:</strong> nord</dd>
</dl> </dl>
<div class="back2top"><a href="#wrap" class="top" title="Haut">Haut</a></div> <div class="back2top"><a href="#wrap" class="top" title="Haut">Haut</a></div>
@@ -349,7 +349,7 @@
<dd>&nbsp;</dd> <dd>&nbsp;</dd>
<dd><strong>Messages:</strong> 592</dd><dd><strong>Inscrit le:</strong> 10 Avril 2017, 22:34</dd> <dd><strong>Messages:</strong> 593</dd><dd><strong>Inscrit le:</strong> 10 Avril 2017, 22:34</dd>
</dl> </dl>
<div class="back2top"><a href="#wrap" class="top" title="Haut">Haut</a></div> <div class="back2top"><a href="#wrap" class="top" title="Haut">Haut</a></div>
@@ -358,7 +358,7 @@
</div> </div>
<hr class="divider" /> <hr class="divider" />
<div id="p50529" class="post bg2 online"> <div id="p50529" class="post bg2">
<div class="inner"><span class="corners-top"><span></span></span> <div class="inner"><span class="corners-top"><span></span></span>
<div class="postbody"> <div class="postbody">
@@ -379,7 +379,7 @@
<dd>&nbsp;</dd> <dd>&nbsp;</dd>
<dd><strong>Messages:</strong> 754</dd><dd><strong>Inscrit le:</strong> 25 Juillet 2014, 14:32</dd><dd><strong>Localisation:</strong> nord</dd> <dd><strong>Messages:</strong> 755</dd><dd><strong>Inscrit le:</strong> 25 Juillet 2014, 14:32</dd><dd><strong>Localisation:</strong> nord</dd>
</dl> </dl>
<div class="back2top"><a href="#wrap" class="top" title="Haut">Haut</a></div> <div class="back2top"><a href="#wrap" class="top" title="Haut">Haut</a></div>
@@ -448,7 +448,7 @@
</div> </div>
<hr class="divider" /> <hr class="divider" />
<div id="p50532" class="post bg1 online"> <div id="p50532" class="post bg1">
<div class="inner"><span class="corners-top"><span></span></span> <div class="inner"><span class="corners-top"><span></span></span>
<div class="postbody"> <div class="postbody">
@@ -469,7 +469,7 @@
<dd>&nbsp;</dd> <dd>&nbsp;</dd>
<dd><strong>Messages:</strong> 754</dd><dd><strong>Inscrit le:</strong> 25 Juillet 2014, 14:32</dd><dd><strong>Localisation:</strong> nord</dd> <dd><strong>Messages:</strong> 755</dd><dd><strong>Inscrit le:</strong> 25 Juillet 2014, 14:32</dd><dd><strong>Localisation:</strong> nord</dd>
</dl> </dl>
<div class="back2top"><a href="#wrap" class="top" title="Haut">Haut</a></div> <div class="back2top"><a href="#wrap" class="top" title="Haut">Haut</a></div>
@@ -508,7 +508,7 @@
<option value="6">Informations générales</option> <option value="6">Informations générales</option>
<option value="117">&nbsp; &nbsp;Evènements divers</option> <option value="117">&nbsp; &nbsp;Evènements divers</option>
<option value="9">&nbsp; &nbsp;Objet du forum CDM-Rail</option> <option value="9">&nbsp; &nbsp;Objet du forum CDM-Rail</option>
<option value="23">&nbsp; &nbsp;Présentation des membres: bienvenue à zio, Fabricemene, Dizom, toundra670, Laurent c., PATRICK42, evariste, sebcool4, jeanmarckiloris</option> <option value="23">&nbsp; &nbsp;Présentation des membres: bienvenue à Jean Louis</option>
<option value="82">CDM-Rail: notes d'utilisation</option> <option value="82">CDM-Rail: notes d'utilisation</option>
<option value="108">&nbsp; &nbsp;COMMENT DEMARRER</option> <option value="108">&nbsp; &nbsp;COMMENT DEMARRER</option>
<option value="85">&nbsp; &nbsp;Notes d'application pour CDM-Rail</option> <option value="85">&nbsp; &nbsp;Notes d'application pour CDM-Rail</option>
BIN
View File
Binary file not shown.
+1 -1
View File
@@ -23,7 +23,7 @@ var
Lance_verif : integer; Lance_verif : integer;
verifVersion,notificationVersion : boolean; verifVersion,notificationVersion : boolean;
Const Version='2.11'; // sert à la comparaison de la version publiée Const Version='2.2'; // sert à la comparaison de la version publiée
implementation implementation
+35
View File
@@ -0,0 +1,35 @@
object FormVersion: TFormVersion
Left = 500
Top = 341
Width = 468
Height = 194
Caption = 'V'#233'rification de version'
Color = clBtnFace
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -16
Font.Name = 'Arial Narrow'
Font.Style = []
OldCreateOrder = False
Position = poScreenCenter
OnCreate = FormCreate
PixelsPerInch = 96
TextHeight = 20
object Memo1: TMemo
Left = 16
Top = 32
Width = 425
Height = 105
Font.Charset = ANSI_CHARSET
Font.Color = clBlack
Font.Height = -13
Font.Name = 'Arial Narrow'
Font.Style = []
ParentFont = False
ScrollBars = ssVertical
TabOrder = 0
end
object TimerVerif: TTimer
OnTimer = TimerVerifTimer
end
end
+210
View File
@@ -0,0 +1,210 @@
unit verif_version;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls , ComCtrls ,WinInet, ExtCtrls;
type
TFormVersion = class(TForm)
TimerVerif: TTimer;
Memo1: TMemo;
procedure FormCreate(Sender: TObject);
procedure TimerVerifTimer(Sender: TObject);
private
{ Déclarations privées }
public
{ Déclarations publiques }
end;
var
FormVersion: TFormVersion;
Lance_verif : integer;
verifVersion,notificationVersion : boolean;
Const Version='2.11'; // sert à la comparaison de la version publiée
implementation
uses UnitPrinc;
{$R *.dfm}
Procedure Aff(s : string);
begin
FormVersion.Memo1.lines.add(s);
end;
function GetCurrentProcessEnvVar(const VariableName: string): string;
var
nSize: DWord;
begin
nSize:=0;
nSize:=GetEnvironmentVariable(PChar(VariableName), nil, nSize);
if nSize=0 then
begin
result:='';
end
else
begin
SetLength(result,nSize-1);
if GetEnvironmentVariable(PChar(VariableName), PChar(result), nSize) <> nSize - 1 then
raise Exception.Create(SysErrorMessage(GetlastError))
end;
end;
// téléchargement d'une page internet sans cache dans un fichier
function DownloadURL_NOCache(aUrl: string;s : string): Boolean;
var
hSession: HINTERNET;
hService: HINTERNET;
Fs:TFileStream;
lpBuffer: array[0..1024 + 1] of byte;
dwBytesRead: DWORD;
dwTimeout : integer;
begin
Result:=False;
DeleteFile(s);
Try Fs:=TFileStream.Create(s,fmCreate,fmShareDenyNone);
hSession:=InternetOpen('MyApp',INTERNET_OPEN_TYPE_PRECONFIG, nil, nil, 0);
try
if Assigned(hSession) then
begin
// fonction longue
dwTimeout:=2000; //2s
InternetSetOption(hSession,INTERNET_OPTION_CONNECT_TIMEOUT,@dwTimeOut, SizeOf(dwTimeOut));
hService:=InternetOpenUrl(hSession, PChar(aUrl), nil, 0, INTERNET_FLAG_RELOAD, 0);
if Assigned(hService) then
try
while True do
begin
dwBytesRead:=1024;
InternetReadFile(hService,@lpBuffer,1024,dwBytesRead);
fs.WriteBuffer(lpBuffer,dwBytesRead);
if dwBytesRead=0 then break;
end;
Result:=True;
finally
InternetCloseHandle(hService);
end;
end;
finally
InternetCloseHandle(hSession);
end;
finally
fs.Free;
end;
end;
procedure verifie_version;
var s,s2,s3,Version_p,Url,LocalFile : string;
trouve_version,trouve_zip : boolean;
fichier : text;
i,j,erreur : integer;
V_publie,V_utile : real;
begin
//Affiche('vérifie version',clLime);
if not(AvecInit) then exit ;
if not(verifVersion) then exit;
Url:='http://cdmrail.free.fr/ForumCDR/viewtopic.php?f=77&t=3906#p50499';
LocalFile:='page.txt';
trouve_version:=false;
trouve_zip:=false;
if DownloadURL_NOCache(Url,localFile) then
begin
AssignFile(fichier,LocalFile);
reset(fichier);
while not(eof(fichier)) and (not(trouve_version) or not(trouve_zip)) do
begin
readln(fichier,s);
s:=LowerCase(s);
if not(trouve_version) then
begin
i:=pos('version ',s);
trouve_version:=i<>0;
if trouve_version then s2:=s;
end;
if not(trouve_zip) then
begin
i:=pos('.zip',s);
trouve_zip:=i<>0;
if trouve_zip then s3:=s;
end;
// Aff(s)
end;
closefile(fichier);
if trouve_version then
begin
// isoler le champ version
i:=pos('version ',s2);
delete(s2,1,i+7);
j:=pos(' ',s2);
Version_p:=copy(s2,1,j-1); // version dans version_p
// isoler l'url du zip
i:=pos('href="',s3);
delete(s3,1,i+5);
j:=pos('"',s3);
s3:=copy(s3,1,j-1);
i:=pos('.',s3);
if i<>0 then delete(s3,i,1); // supprimer le .
s3:='http://cdmrail.free.fr/ForumCDR'+s3 ;
aff(s3); // lien dans s3
// changer le . en ,
s:=Version_p;
// i:=pos('.',s);if i<>0 then s[i]:=',';
s2:=version;
// i:=pos('.',s2);if i<>0 then s2[i]:=',';
val(s,V_publie,erreur); if erreur<>0 then exit;
val(s2,V_utile,erreur); if erreur<>0 then exit;
if V_utile<V_publie then
begin
FormVersion.show;
s:='Vous utilisez la version '+version+' mais il existe la version '+Version_p;
Aff(s);
if MessageDlg(s+'. Voulez-vous la télécharger?',mtConfirmation,[mbYes,mbNo],0)=mrYes then
begin
// récupérer depuis la variable d'environnement windows USERPROFILE le repertoire de la session ouverte
s:=GetCurrentProcessEnvVar('USERPROFILE')+'\Downloads\Signaux_Complexes_GL.Zip';
Aff('Téléchargement de '+s3+' dans ');
Aff(s);
if DownloadURL_NOCache(s3,s) then
//if true then
begin
Aff('Téléchargement réussi');
Aff('Vous pouvez ouvrir le dossier de téléchargement, décomprimer le zip et l''installer');
end
else Aff('Echec de téléchargement');
end
else formVersion.Free;
end;
if (V_utile=V_publie) and notificationVersion then Affiche('Votre version '+Version_p+' est à jour',clLime);
end;
end
else
begin
if notificationVersion then Affiche('Pas d''accès au site CDM rail',clorange);
end;
end;
procedure TFormVersion.FormCreate(Sender: TObject);
begin
Timerverif.Interval:=1000; // timer à 1 seconde
Lance_verif:=2; // lancer la vérification de version dans 1s
end;
procedure TFormVersion.TimerVerifTimer(Sender: TObject);
begin
if lance_verif>0 then dec(lance_verif);
if lance_verif=1 then verifie_version;
end;
end.
+4
View File
@@ -38,6 +38,10 @@ version 2.1 : Possibilit
Correction d'un bug sur l'écriture du fichier config-gl.cfg lors de la modification de la configuration. Correction d'un bug sur l'écriture du fichier config-gl.cfg lors de la modification de la configuration.
version 2.11 : Suppression du message d'erreur "Element 9999 non trouvé" version 2.11 : Suppression du message d'erreur "Element 9999 non trouvé"
Ajout de l'option fenêtre étendue dans le panneau de configuration Ajout de l'option fenêtre étendue dans le panneau de configuration
Version 2.2 : Correction d'un bug sur le verrouillage des signaux au carré sur les trains en approche.
Mise à jour du fichier de config.cfg si modification des signaux dans la configuration.