diff --git a/Notice d'utilisation des signaux_complexes_GL_V4.8.pdf b/Notice d'utilisation des signaux_complexes_GL_V5.1.pdf similarity index 70% rename from Notice d'utilisation des signaux_complexes_GL_V4.8.pdf rename to Notice d'utilisation des signaux_complexes_GL_V5.1.pdf index 0431e4f..431ca3f 100644 Binary files a/Notice d'utilisation des signaux_complexes_GL_V4.8.pdf and b/Notice d'utilisation des signaux_complexes_GL_V5.1.pdf differ diff --git a/Signaux_complexes_GL.dpr b/Signaux_complexes_GL.dpr index 68c324d..bbd3ed7 100644 --- a/Signaux_complexes_GL.dpr +++ b/Signaux_complexes_GL.dpr @@ -12,7 +12,9 @@ uses UnitConfigTCO in 'UnitConfigTCO.pas' {FormConfigTCO}, UnitSR in 'UnitSR.pas' {FormSR}, Unit_Pilote_aig in 'Unit_Pilote_aig.pas' {FormAig}, - UnitConfigCellTCO in 'UnitConfigCellTCO.pas' {FormConfCellTCO}; + UnitConfigCellTCO in 'UnitConfigCellTCO.pas' {FormConfCellTCO}, + UnitDigikeijs in 'UnitDigikeijs.pas' {FormDigikeijs}, + UnitCDF in 'UnitCDF.pas' {FormCDF}; {$R *.res} @@ -28,5 +30,7 @@ begin Application.CreateForm(TFormSR, FormSR); Application.CreateForm(TFormAig, FormAig); Application.CreateForm(TFormConfCellTCO, FormConfCellTCO); + Application.CreateForm(TFormDigikeijs, FormDigikeijs); + Application.CreateForm(TFormCDF, FormCDF); Application.Run; end. diff --git a/Signaux_complexes_GL.exe b/Signaux_complexes_GL.exe new file mode 100644 index 0000000..21cace5 Binary files /dev/null and b/Signaux_complexes_GL.exe differ diff --git a/UnitCDF.dcu b/UnitCDF.dcu new file mode 100644 index 0000000..c2e4a03 Binary files /dev/null and b/UnitCDF.dcu differ diff --git a/UnitCDF.dfm b/UnitCDF.dfm new file mode 100644 index 0000000..860606b --- /dev/null +++ b/UnitCDF.dfm @@ -0,0 +1,396 @@ +object FormCDF: TFormCDF + Left = 368 + Top = 141 + BorderStyle = bsDialog + Caption = 'Configuration du d'#233'codeur CDF' + ClientHeight = 466 + ClientWidth = 341 + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + OldCreateOrder = False + OnActivate = FormActivate + PixelsPerInch = 96 + TextHeight = 13 + object Label20: TLabel + Left = 16 + Top = 48 + Width = 184 + Height = 26 + Caption = + 'Tables d'#39'aspects du signal en fonction du motif envoy'#233' au d'#233'code' + + 'ur CDF' + WordWrap = True + end + object Label1: TLabel + Left = 8 + Top = 176 + Width = 32 + Height = 13 + Caption = 'Label1' + end + object Label2: TLabel + Left = 8 + Top = 200 + Width = 32 + Height = 13 + Caption = 'Label2' + end + object Label3: TLabel + Left = 8 + Top = 224 + Width = 32 + Height = 13 + Caption = 'Label3' + end + object Label4: TLabel + Left = 8 + Top = 248 + Width = 32 + Height = 13 + Caption = 'Label4' + end + object Label5: TLabel + Left = 8 + Top = 272 + Width = 32 + Height = 13 + Caption = 'Label5' + end + object Label6: TLabel + Left = 8 + Top = 296 + Width = 32 + Height = 13 + Caption = 'Label6' + end + object Label7: TLabel + Left = 8 + Top = 320 + Width = 32 + Height = 13 + Caption = 'Label7' + end + object Label8: TLabel + Left = 8 + Top = 344 + Width = 32 + Height = 13 + Caption = 'Label8' + end + object Label9: TLabel + Left = 8 + Top = 368 + Width = 32 + Height = 13 + Caption = 'Label9' + end + object Label10: TLabel + Left = 8 + Top = 392 + Width = 38 + Height = 13 + Caption = 'Label10' + end + object Label11: TLabel + Left = 184 + Top = 200 + Width = 38 + Height = 13 + Caption = 'Label11' + end + object Label12: TLabel + Left = 184 + Top = 224 + Width = 38 + Height = 13 + Caption = 'Label12' + end + object Label13: TLabel + Left = 184 + Top = 248 + Width = 38 + Height = 13 + Caption = 'Label13' + end + object Label14: TLabel + Left = 184 + Top = 272 + Width = 38 + Height = 13 + Caption = 'Label14' + end + object Label15: TLabel + Left = 184 + Top = 296 + Width = 38 + Height = 13 + Caption = 'Label15' + end + object Label16: TLabel + Left = 184 + Top = 320 + Width = 38 + Height = 13 + Caption = 'Label16' + end + object Label17: TLabel + Left = 184 + Top = 344 + Width = 38 + Height = 13 + Caption = 'Label17' + end + object Label18: TLabel + Left = 184 + Top = 368 + Width = 38 + Height = 13 + Caption = 'Label18' + end + object Label19: TLabel + Left = 184 + Top = 392 + Width = 38 + Height = 13 + Caption = 'Label19' + end + object ImageDigi: TImage + Left = 240 + Top = 16 + Width = 57 + Height = 97 + end + object Shape1: TShape + Left = 168 + Top = 152 + Width = 2 + Height = 273 + end + object Label21: TLabel + Left = 120 + Top = 152 + Width = 29 + Height = 13 + Caption = 'Motif' + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [fsBold] + ParentFont = False + end + object Label22: TLabel + Left = 296 + Top = 176 + Width = 29 + Height = 13 + Caption = 'Motif' + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [fsBold] + ParentFont = False + end + object Label23: TLabel + Left = 16 + Top = 104 + Width = 205 + Height = 13 + Caption = 'Nombre d'#39'adresses occup'#233'es par le signal :' + end + object LabelTitre: TLabel + Left = 16 + Top = 8 + Width = 63 + Height = 19 + Caption = 'Adresse' + Font.Charset = ANSI_CHARSET + Font.Color = clWindowText + Font.Height = -16 + Font.Name = 'Arial' + Font.Style = [fsBold] + ParentFont = False + end + object Label24: TLabel + Left = 56 + Top = 124 + Width = 24 + Height = 13 + Caption = '1 '#224' 4' + end + object Button1: TButton + Left = 128 + Top = 432 + Width = 75 + Height = 25 + Caption = 'Ok' + TabOrder = 0 + OnClick = Button1Click + end + object Edit1: TEdit + Left = 120 + Top = 176 + Width = 25 + Height = 21 + TabOrder = 1 + OnChange = Edit1Change + end + object Edit2: TEdit + Left = 120 + Top = 200 + Width = 25 + Height = 21 + TabOrder = 2 + OnChange = Edit2Change + end + object Edit3: TEdit + Left = 120 + Top = 224 + Width = 25 + Height = 21 + TabOrder = 3 + OnChange = Edit3Change + end + object Edit4: TEdit + Left = 120 + Top = 248 + Width = 25 + Height = 21 + TabOrder = 4 + OnChange = Edit4Change + end + object Edit5: TEdit + Left = 120 + Top = 272 + Width = 25 + Height = 21 + TabOrder = 5 + OnChange = Edit5Change + end + object Edit6: TEdit + Left = 120 + Top = 296 + Width = 25 + Height = 21 + TabOrder = 6 + OnChange = Edit6Change + end + object Edit7: TEdit + Left = 120 + Top = 320 + Width = 25 + Height = 21 + TabOrder = 7 + OnChange = Edit7Change + end + object Edit8: TEdit + Left = 120 + Top = 344 + Width = 25 + Height = 21 + TabOrder = 8 + OnChange = Edit8Change + end + object Edit9: TEdit + Left = 120 + Top = 368 + Width = 25 + Height = 21 + TabOrder = 9 + OnChange = Edit9Change + end + object Edit10: TEdit + Left = 120 + Top = 392 + Width = 25 + Height = 21 + TabOrder = 10 + OnChange = Edit10Change + end + object Edit11: TEdit + Left = 296 + Top = 200 + Width = 25 + Height = 21 + TabOrder = 11 + OnChange = Edit11Change + end + object Edit12: TEdit + Left = 296 + Top = 224 + Width = 25 + Height = 21 + TabOrder = 12 + OnChange = Edit12Change + end + object Edit13: TEdit + Left = 296 + Top = 248 + Width = 25 + Height = 21 + TabOrder = 13 + OnChange = Edit13Change + end + object Edit14: TEdit + Left = 296 + Top = 272 + Width = 25 + Height = 21 + TabOrder = 14 + OnChange = Edit14Change + end + object Edit15: TEdit + Left = 296 + Top = 296 + Width = 25 + Height = 21 + TabOrder = 15 + OnChange = Edit15Change + end + object Edit16: TEdit + Left = 296 + Top = 320 + Width = 25 + Height = 21 + TabOrder = 16 + OnChange = Edit16Change + end + object Edit17: TEdit + Left = 296 + Top = 344 + Width = 25 + Height = 21 + TabOrder = 17 + OnChange = Edit17Change + end + object Edit18: TEdit + Left = 296 + Top = 368 + Width = 25 + Height = 21 + TabOrder = 18 + OnChange = Edit18Change + end + object Edit19: TEdit + Left = 296 + Top = 392 + Width = 25 + Height = 21 + TabOrder = 19 + OnChange = Edit19Change + end + object EditNAdresses: TEdit + Left = 16 + Top = 120 + Width = 25 + Height = 21 + TabOrder = 20 + Text = '1' + OnChange = EditNAdressesChange + end +end diff --git a/UnitCDF.pas b/UnitCDF.pas new file mode 100644 index 0000000..e530d27 --- /dev/null +++ b/UnitCDF.pas @@ -0,0 +1,370 @@ +unit UnitCDF; + +interface + +uses + Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, + Dialogs, StdCtrls, ExtCtrls , unitconfig, UnitPrinc; + +type + TFormCDF = class(TForm) + Button1: TButton; + Label20: TLabel; + Label1: TLabel; + Label2: TLabel; + Label3: TLabel; + Label4: TLabel; + Label5: TLabel; + Label6: TLabel; + Label7: TLabel; + Label8: TLabel; + Label9: TLabel; + Label10: TLabel; + Label11: TLabel; + Label12: TLabel; + Label13: TLabel; + Label14: TLabel; + Label15: TLabel; + Label16: TLabel; + Label17: TLabel; + Label18: TLabel; + Label19: TLabel; + ImageDigi: TImage; + Shape1: TShape; + Label21: TLabel; + Label22: TLabel; + Edit1: TEdit; + Edit2: TEdit; + Edit3: TEdit; + Edit4: TEdit; + Edit5: TEdit; + Edit6: TEdit; + Edit7: TEdit; + Edit8: TEdit; + Edit9: TEdit; + Edit10: TEdit; + Edit11: TEdit; + Edit12: TEdit; + Edit13: TEdit; + Edit14: TEdit; + Edit15: TEdit; + Edit16: TEdit; + Edit17: TEdit; + Edit18: TEdit; + Edit19: TEdit; + Label23: TLabel; + EditNAdresses: TEdit; + LabelTitre: TLabel; + Label24: TLabel; + procedure Button1Click(Sender: TObject); + procedure FormActivate(Sender: TObject); + procedure Edit1Change(Sender: TObject); + procedure Edit2Change(Sender: TObject); + procedure Edit3Change(Sender: TObject); + procedure Edit4Change(Sender: TObject); + procedure Edit5Change(Sender: TObject); + procedure Edit6Change(Sender: TObject); + procedure Edit7Change(Sender: TObject); + procedure Edit8Change(Sender: TObject); + procedure Edit9Change(Sender: TObject); + procedure Edit10Change(Sender: TObject); + procedure Edit11Change(Sender: TObject); + procedure Edit12Change(Sender: TObject); + procedure Edit13Change(Sender: TObject); + procedure Edit14Change(Sender: TObject); + procedure Edit15Change(Sender: TObject); + procedure Edit16Change(Sender: TObject); + procedure Edit18Change(Sender: TObject); + procedure Edit19Change(Sender: TObject); + procedure Edit17Change(Sender: TObject); + procedure EditNAdressesChange(Sender: TObject); + private + { Déclarations privées } + public + { Déclarations publiques } + end; + +var + FormCDF: TFormCDF; + Adresse,Index : integer; + +implementation + +{$R *.dfm} + +procedure TFormCDF.Button1Click(Sender: TObject); +begin + close; +end; + +procedure TFormCDF.FormActivate(Sender: TObject); +var erreur : integer; +begin + Val(FormConfig.EditAdrSig.text,Adresse,erreur); + index:=index_feu(Adresse); + LabelTitre.caption:='Adresse du signal: '+intToSTR(adresse); + + Label1.caption:=etats[1]; + Label2.caption:=etats[2]; + Label3.caption:=etats[3]; + Label4.caption:=etats[4]; + Label5.caption:=etats[5]; + Label6.caption:=etats[6]; + Label7.caption:=etats[7]; + Label8.caption:=etats[8]; + Label9.caption:=etats[9]; + Label10.caption:=etats[10]; + Label11.caption:=etats[11]; + Label12.caption:=etats[12]; + Label13.caption:=etats[13]; + Label14.caption:=etats[14]; + Label15.caption:=etats[15]; + Label16.caption:=etats[16]; + Label17.caption:=etats[17]; + Label18.caption:=etats[18]; + Label19.caption:=etats[19]; + + ImageDigi.Picture:=FormConfig.ImageSignal.Picture; + with ImageDigi.Picture do + begin + Bitmap.TransparentMode:=tmAuto; + Bitmap.TransparentColor:=clblue; + end; + ImageDigi.Transparent:=true; + + Edit1.Text:=intToSTR(Feux[index].SR[1].sortie1); // carré + Edit2.Text:=intToSTR(Feux[index].SR[2].sortie1); // sémaphore + Edit3.Text:=intToSTR(Feux[index].SR[3].sortie1); // sémaphore cli + Edit4.Text:=intToSTR(Feux[index].SR[4].sortie1); + Edit5.Text:=intToSTR(Feux[index].SR[5].sortie1); + Edit6.Text:=intToSTR(Feux[index].SR[6].sortie1); + Edit7.Text:=intToSTR(Feux[index].SR[7].sortie1); + Edit8.Text:=intToSTR(Feux[index].SR[8].sortie1); + Edit9.Text:=intToSTR(Feux[index].SR[9].sortie1); + Edit10.Text:=intToSTR(Feux[index].SR[10].sortie1); + Edit11.Text:=intToSTR(Feux[index].SR[11].sortie1); + Edit12.Text:=intToSTR(Feux[index].SR[12].sortie1); + Edit13.Text:=intToSTR(Feux[index].SR[13].sortie1); + Edit14.Text:=intToSTR(Feux[index].SR[14].sortie1); + Edit15.Text:=intToSTR(Feux[index].SR[15].sortie1); + Edit16.Text:=intToSTR(Feux[index].SR[16].sortie1); + Edit17.Text:=intToSTR(Feux[index].SR[17].sortie1); + Edit18.Text:=intToSTR(Feux[index].SR[18].sortie1); + Edit19.Text:=intToSTR(Feux[index].SR[19].sortie1); + + editNadresses.text:=intToSTR(feux[index].NA); +end; + +procedure Maj_DB; +var s : string; +begin + s:=encode_sig_feux(index); + formconfig.RichSig.Lines[index-1]:=s; + aff_champs_sig_feux(index); +end; + +procedure TFormCDF.Edit1Change(Sender: TObject); +var erreur : integer; +begin + if index<>0 then + begin + val(Edit1.Text,Feux[index].SR[1].sortie1,erreur); + Maj_DB; + end; +end; + +procedure TFormCDF.Edit2Change(Sender: TObject); +var erreur : integer; +begin + if index<>0 then + begin + val(Edit2.Text,Feux[index].SR[2].sortie1,erreur); + Maj_DB; + end; +end; + +procedure TFormCDF.Edit3Change(Sender: TObject); +var erreur : integer; +begin + if index<>0 then + begin + val(Edit3.Text,Feux[index].SR[3].sortie1,erreur); + Maj_DB; + end; +end; + +procedure TFormCDF.Edit4Change(Sender: TObject); +var erreur : integer; +begin + if index<>0 then + begin + val(Edit4.Text,Feux[index].SR[4].sortie1,erreur); + Maj_DB; + end; +end; + +procedure TFormCDF.Edit5Change(Sender: TObject); +var erreur : integer; +begin + if index<>0 then + begin + val(Edit5.Text,Feux[index].SR[5].sortie1,erreur); + Maj_DB; + end; +end; + +procedure TFormCDF.Edit6Change(Sender: TObject); +var erreur : integer; +begin + if index<>0 then + begin + val(Edit6.Text,Feux[index].SR[6].sortie1,erreur); + Maj_DB; + end; +end; + +procedure TFormCDF.Edit7Change(Sender: TObject); +var erreur : integer; +begin + if index<>0 then + begin + val(Edit7.Text,Feux[index].SR[7].sortie1,erreur); + Maj_DB; + end; +end; + +procedure TFormCDF.Edit8Change(Sender: TObject); +var erreur : integer; +begin + if index<>0 then + begin + val(Edit8.Text,Feux[index].SR[8].sortie1,erreur); + Maj_DB; + end; +end; + +procedure TFormCDF.Edit9Change(Sender: TObject); +var erreur : integer; +begin + if index<>0 then + begin + val(Edit9.Text,Feux[index].SR[9].sortie1,erreur); + Maj_DB; + end; +end; + +procedure TFormCDF.Edit10Change(Sender: TObject); +var erreur : integer; +begin + if index<>0 then + begin + val(Edit10.Text,Feux[index].SR[10].sortie1,erreur); + Maj_DB; + end; +end; + +procedure TFormCDF.Edit11Change(Sender: TObject); +var erreur : integer; +begin + if index<>0 then + begin + val(Edit11.Text,Feux[index].SR[11].sortie1,erreur); + Maj_DB; + end; +end; + +procedure TFormCDF.Edit12Change(Sender: TObject); +var erreur : integer; +begin + if index<>0 then + begin + val(Edit12.Text,Feux[index].SR[12].sortie1,erreur); + Maj_DB; + end; +end; + +procedure TFormCDF.Edit13Change(Sender: TObject); +var erreur : integer; +begin + if index<>0 then + begin + val(Edit13.Text,Feux[index].SR[13].sortie1,erreur); + Maj_DB; + end; +end; + +procedure TFormCDF.Edit14Change(Sender: TObject); +var erreur : integer; +begin + if index<>0 then + begin + val(Edit14.Text,Feux[index].SR[14].sortie1,erreur); + Maj_DB; + end; +end; + +procedure TFormCDF.Edit15Change(Sender: TObject); +var erreur : integer; +begin + if index<>0 then + begin + val(Edit15.Text,Feux[index].SR[15].sortie1,erreur); + Maj_DB; + end; +end; + +procedure TFormCDF.Edit16Change(Sender: TObject); +var erreur : integer; +begin + if index<>0 then + begin + val(Edit16.Text,Feux[index].SR[16].sortie1,erreur); + Maj_DB; + end; +end; + +procedure TFormCDF.Edit17Change(Sender: TObject); +var erreur : integer; +begin + if index<>0 then + begin + val(Edit17.Text,Feux[index].SR[17].sortie1,erreur); + Maj_DB; + end; +end; + +procedure TFormCDF.Edit18Change(Sender: TObject); +var erreur : integer; +begin + if index<>0 then + begin + val(Edit18.Text,Feux[index].SR[18].sortie1,erreur); + Maj_DB; + end; +end; + +procedure TFormCDF.Edit19Change(Sender: TObject); +var erreur : integer; +begin + if index<>0 then + begin + val(Edit19.Text,Feux[index].SR[19].sortie1,erreur); + Maj_DB; + end; +end; + +procedure TFormCDF.EditNAdressesChange(Sender: TObject); +var erreur,i : integer; +begin + if index<>0 then + begin + val(EditNAdresses.Text,i,erreur); + if (i>0) and (i<5) then + begin + Feux[index].Na:=i; + Maj_DB; + end; + end; +end; + +end. diff --git a/UnitConfig.dcu b/UnitConfig.dcu index 3cd185b..9872402 100644 Binary files a/UnitConfig.dcu and b/UnitConfig.dcu differ diff --git a/UnitConfig.dfm b/UnitConfig.dfm index c9ad23d..37db8db 100644 --- a/UnitConfig.dfm +++ b/UnitConfig.dfm @@ -1,6 +1,6 @@ object FormConfig: TFormConfig - Left = 218 - Top = 143 + Left = 236 + Top = 124 Hint = 'Modifie la configuration selon les s'#233'lections choisies' BorderStyle = bsDialog Caption = 'Configuration g'#233'n'#233'rale' @@ -1520,27 +1520,6 @@ object FormConfig: TFormConfig 0000} Visible = False end - object Label19: TLabel - Left = 808 - Top = 96 - Width = 75 - Height = 13 - Caption = 'Element suivant' - end - object Label10: TLabel - Left = 792 - Top = 104 - Width = 105 - Height = 13 - Caption = 'Verrouillable au carr'#233' :' - end - object Label29: TLabel - Left = 856 - Top = 76 - Width = 6 - Height = 13 - Caption = #224 - end object Label20: TLabel Left = 648 Top = 312 @@ -1591,7 +1570,7 @@ object FormConfig: TFormConfig Top = 8 Width = 633 Height = 505 - ActivePage = TabSheetSig + ActivePage = TabSheetAutonome Font.Charset = DEFAULT_CHARSET Font.Color = clBlack Font.Height = -11 @@ -1993,8 +1972,8 @@ object FormConfig: TFormConfig Caption = 'Mode autonome' ImageIndex = 1 object Label9: TLabel - Left = 16 - Top = 440 + Left = 0 + Top = 448 Width = 294 Height = 13 Caption = 'Ces param'#232'tres sont utilis'#233's en fonctionnement sans CDM Rail' @@ -2005,7 +1984,7 @@ object FormConfig: TFormConfig Top = 8 Width = 297 Height = 113 - Caption = 'Acc'#232's USB/S'#233'rie '#224' l'#39'interface vers la centrale via XpressNet' + Caption = 'Acc'#232's USB/S'#233'rie '#224' l'#39'interface vers la centrale' TabOrder = 0 object Label3: TLabel Left = 16 @@ -2064,8 +2043,8 @@ object FormConfig: TFormConfig Left = 8 Top = 128 Width = 297 - Height = 81 - Caption = '4. Ent'#234'te des trames vers l'#39'interface' + Height = 65 + Caption = '4. Ent'#234'te des trames XpressNet vers l'#39'interface' TabOrder = 1 object RadioButton1: TRadioButton Left = 8 @@ -2083,21 +2062,13 @@ object FormConfig: TFormConfig Caption = '1 : Ent'#234'te FF FE (interfaces natives USB)' TabOrder = 1 end - object RadioButton3: TRadioButton - Left = 8 - Top = 56 - Width = 273 - Height = 17 - Caption = '2 : Ent'#234'te E4 - Suffixe 0D 0D 0A (arduino XpressNet)' - TabOrder = 2 - end end object GroupBox3: TGroupBox Left = 8 - Top = 216 + Top = 200 Width = 297 Height = 73 - Caption = 'Acc'#232's Ethernet '#224' l'#39'interface vers la centrale via XpressNet' + Caption = 'Acc'#232's Ethernet '#224' l'#39'interface' TabOrder = 2 object Label7: TLabel Left = 14 @@ -2142,7 +2113,7 @@ object FormConfig: TFormConfig BorderStyle = bsNone Lines.Strings = ( '1. Port COM de l'#39'adresse USB de l'#39'interface XpressNet.' - 'Attention de COM1 '#224' 9 - Si le port de l'#39'interface USB>9, il ' + 'Attention de COM1 '#224' 30 - Si le port de l'#39'interface USB>30, il ' 'faut le changer manuellement dans le gestionnaire des ' 'p'#233'riph'#233'riques. Si COMX : Signaux complexes d'#233'tecte le' 'port automatiquement (mais le d'#233'marrage est plus long)') @@ -2190,36 +2161,34 @@ object FormConfig: TFormConfig Left = 312 Top = 312 Width = 297 - Height = 73 + Height = 57 BevelInner = bvLowered BevelKind = bkFlat BorderStyle = bsNone Lines.Strings = ( '4. Pour l'#39'utilisation d'#39'interfaces s'#233'rie (GENLI), cette valeur ' 'doit '#234'tre '#224' 0. Pour les interfaces utilisant nativement de ' - 'l'#39'USB, cette valeur doit '#234'tre '#224' 1. ' - 'La valeur 2 est utilis'#233'e exclusivement pour des interfaces '#224' ' - 'base d'#39'arduino pour xpressnet.') + 'l'#39'USB, cette valeur doit '#234'tre '#224' 1. ') ReadOnly = True TabOrder = 6 end object GroupBox9: TGroupBox Left = 8 - Top = 296 + Top = 280 Width = 297 - Height = 129 + Height = 121 Caption = 'Au d'#233'marrage de signaux complexes en mode autonome' TabOrder = 7 object Label32: TLabel Left = 14 - Top = 50 + Top = 42 Width = 200 Height = 13 Caption = 'Temporisation de s'#233'quencement d'#39'init (ms)' end object CheckBoxInitAig: TCheckBox Left = 16 - Top = 24 + Top = 16 Width = 257 Height = 25 Hint = 'Initialisation des aiguillages au d'#233'marrage' @@ -2231,15 +2200,18 @@ object FormConfig: TFormConfig end object EditTempoAig: TEdit Left = 224 - Top = 46 + Top = 38 Width = 41 Height = 21 + Hint = 'Temporisation entre la commande de deux aiguillages' + ParentShowHint = False + ShowHint = True TabOrder = 1 Text = 'EditTempoAig' end object CheckPosAig: TCheckBox Left = 16 - Top = 72 + Top = 64 Width = 257 Height = 17 Caption = 'Demande positions des aiguillages '#224' la centrale' @@ -2247,27 +2219,57 @@ object FormConfig: TFormConfig end object CheckBoxDemarUSB: TCheckBox Left = 16 - Top = 88 + Top = 80 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' + Caption = 'Connexion de l'#39'interface en COM ou USB' ParentShowHint = False ShowHint = True TabOrder = 3 end object CheckBoxDemarEth: TCheckBox Left = 16 - Top = 104 + Top = 96 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' + Caption = 'Connexion de l'#39'interface en Ethernet' ParentShowHint = False ShowHint = True TabOrder = 4 end end + object GroupBox22: TGroupBox + Left = 312 + Top = 376 + Width = 297 + Height = 65 + Caption = 'Protocole de connexion '#224' la centrale ou '#224' l'#39'interface' + TabOrder = 8 + object RadioButtonDCC: TRadioButton + Left = 8 + Top = 40 + Width = 113 + Height = 17 + Hint = 'Protocole DCC++ vers la centrale/interface' + Caption = 'DCC++ (Arduino)' + ParentShowHint = False + ShowHint = True + TabOrder = 0 + end + object RadioButtonXpress: TRadioButton + Left = 8 + Top = 20 + Width = 257 + Height = 17 + Hint = 'Protocole Xpressnet vers la centrale/interface' + Caption = 'XpressNet (Lenz, Digikeijs, Roco, OpenDCC ...)' + ParentShowHint = False + ShowHint = True + TabOrder = 1 + end + end end object TabSheetAig: TTabSheet Caption = 'Aiguillages' @@ -3015,7 +3017,7 @@ object FormConfig: TFormConfig Width = 129 Height = 21 Style = csDropDownList - ItemHeight = 13 + ItemHeight = 0 TabOrder = 1 OnChange = ComboBoxDecChange end diff --git a/UnitConfig.pas b/UnitConfig.pas index 9b98980..ea74c4f 100644 --- a/UnitConfig.pas +++ b/UnitConfig.pas @@ -52,7 +52,6 @@ type GroupBox4: TGroupBox; RadioButton1: TRadioButton; RadioButton2: TRadioButton; - RadioButton3: TRadioButton; GroupBox3: TGroupBox; Label7: TLabel; Label8: TLabel; @@ -96,7 +95,6 @@ type LabelDec: TLabel; LabelDetAss: TLabel; LabelElSuiv: TLabel; - Label19: TLabel; GroupBoxRadio: TGroupBox; RadioButtonLoc: TRadioButton; GroupBoxAct: TGroupBox; @@ -119,7 +117,6 @@ type EditV1O: TEdit; EditV2O: TEdit; EditV3O: TEdit; - Label10: TLabel; Label17: TLabel; MemoCarre: TMemo; RichAig: TRichEdit; @@ -141,7 +138,6 @@ type Label28: TLabel; CheckInverse: TCheckBox; RadioButtonAccess: TRadioButton; - Label29: TLabel; CheckFenEt: TCheckBox; GroupBox15: TGroupBox; EditNbDetDist: TEdit; @@ -289,6 +285,9 @@ type CheckFRC: TCheckBox; Label40: TLabel; RadioButtonAig: TRadioButton; + GroupBox22: TGroupBox; + RadioButtonDCC: TRadioButton; + RadioButtonXpress: TRadioButton; procedure ButtonAppliquerEtFermerClick(Sender: TObject); procedure FormActivate(Sender: TObject); procedure FormCreate(Sender: TObject); @@ -431,12 +430,13 @@ IpV4_PC_ch='IpV4_PC'; retro_ch='retro'; Init_aig_ch='Init_Aig'; LAY_ch='Lay'; +Maxcom_ch='MaxCom'; Init_dem_aig_ch='Init_Dem_Aig'; Init_dem_interfaceUSBCOM_ch='Init_demUSBCOM'; Init_dem_interfaceEth_ch='Init_demETH'; -IPV4_INTERFACE_ch='IPV4_INTERFACE'; -PROTOCOLE_SERIE_ch='PROTOCOLE_SERIE'; -INTER_CAR_ch='INTER_CAR'; +IPV4_INTERFACE_ch='Ipv4_interface'; +PROTOCOLE_SERIE_ch='Protocole_serie'; +INTER_CAR_ch='Inter_car'; Tempo_maxi_ch='Tempo_maxi'; Entete_ch='Entete'; TCO_ch='TCO'; @@ -448,9 +448,10 @@ Tempo_aig_ch='Tempo_Aig'; Nb_cantons_Sig_ch='Nb_cantons_Sig'; Tempo_Feu_ch='Tempo_Feu'; Algo_Unisemaf_ch='Alg_Unisemaf'; -NOTIF_VERSION_ch='NOTIF_VERSION'; +NOTIF_VERSION_ch='notif_version'; verif_version_ch='verif_version'; Fonte_ch='Fonte'; +Protocole_ch='Protocole'; Raz_signaux_ch='RazSignaux'; // sections de config @@ -462,12 +463,14 @@ section_branches_ch='[section_branches]'; var FormConfig: TFormConfig; AdresseIPCDM,AdresseIP,PortCom,recuCDM,residuCDM,trainsauve : string; - portCDM,TempoOctet,TimoutMaxInterface,Valeur_entete,Port,protocole,NumPort, - LigneCliqueePN,AncLigneCliqueePN,clicMemo,Nb_cantons_Sig, + + portCDM,TempoOctet,TimoutMaxInterface,Valeur_entete,PortInterface,prot_serie,NumPort, + LigneCliqueePN,AncLigneCliqueePN,clicMemo,Nb_cantons_Sig,protocole,Port, ligneclicAig,AncLigneClicAig,ligneClicSig,AncligneClicSig, ligneClicBr,AncligneClicBr,ligneClicAct,AncLigneClicAct,Adressefeuclic,NumTrameCDM : integer; - ack_cdm,clicliste,affevt,config_modifie,clicproprietes,confasauver, - modif_branches : boolean; + + ack_cdm,clicliste,affevt,config_modifie,clicproprietes,confasauver,trouve_MaxPort, + modif_branches,ConfigPrete : boolean; fichier : text; function config_com(s : string) : boolean; @@ -485,7 +488,8 @@ function encode_sig_feux(i : integer): string; implementation -uses UnitDebug,UnitTCO, UnitSR; +uses UnitDebug,UnitTCO, UnitSR,UnitDigikeijs, + UnitCDF; {$R *.dfm} @@ -628,8 +632,8 @@ begin editAdrTrain.text:=IntToSTR(trains[1].adresse); end; end; - end - else Affiche('CDM Rail non lancé',clOrange); + end; + //else Affiche('CDM Rail non lancé',clOrange); end else begin @@ -658,7 +662,7 @@ var sa : string; i,erreur : integer; begin sa:=s; - protocole:=-1; + prot_serie:=-1; // supprimer la dernier paramètre i:=pos(',',s); if i<>0 then @@ -676,7 +680,7 @@ begin if i<>0 then begin delete(s,1,i); - Val(s,protocole,erreur); + Val(s,prot_serie,erreur); end; end; end; @@ -684,7 +688,7 @@ begin i:=pos(':',sa); val(copy(sa,4,i-1),Numport,erreur); - config_com:=not( (copy(sa,1,3)<>'COM') or (NumPort>9) or (protocole=-1) or (protocole>4) or (i=0) ); + config_com:=not( (copy(sa,1,3)<>'COM') or (NumPort>MaxPortCom) or (prot_serie=-1) or (prot_serie>4) or (i=0) ); end; // transforme l'aiguillage de la base de données aiguillage en texte @@ -850,8 +854,8 @@ begin // feu rouge cli if feux[i].checkFR then s:=s+',FRC1' else s:=s+',FRC0'; - // si unsemaf, paramètre supplémentaire - if feux[i].decodeur=6 then s:=s+',U'+intToSTR(feux[i].unisemaf); + // si unisemaf, paramètre supplémentaire + if (feux[i].decodeur=6) then s:=s+',U'+intToSTR(feux[i].unisemaf); // conditions supplémentaires pour le carré for nc:=1 to 6 do @@ -868,9 +872,9 @@ begin end; s:=s+')'; end; - end; + end; - // décodeur SR + // décodeur SR if feux[i].decodeur=7 then begin s:=s+',SR('; @@ -882,6 +886,29 @@ begin end; end; + // décodeur Digikeijs + if feux[i].decodeur=5 then + begin + s:=s+',DK('; + for nc:=1 to 19 do + begin + s:=s+intToSTR(feux[i].SR[nc].sortie1); + if nc<19 then s:=s+',' else s:=s+')'; + end; + end; + + // décodeur CDF + if feux[i].decodeur=2 then + begin + s:=s+',CDF('; + for nc:=1 to 19 do + begin + s:=s+intToSTR(feux[i].SR[nc].sortie1); + if nc<19 then s:=s+',' else s:=s+')'; + end; + s:=s+',NA'+intToSTR(feux[i].na); + end; + end else // feux directionnels @@ -986,7 +1013,7 @@ begin if j>1 then begin Feux[i].FeuBlanc:=(copy(s,1,j-1))='1';delete(s,1,j);end; j:=pos(',',s); val(s,Feux[i].decodeur,erreur); - + if (Feux[i].decodeur>NbDecodeur-1) then Affiche('Erreur 677 Ligne '+chaine_signal+' : erreur décodeur inconnu',clred); if j<>0 then delete(s,1,j); feux[i].Adr_el_suiv1:=0;feux[i].Adr_el_suiv2:=0;feux[i].Adr_el_suiv3:=0;feux[i].Adr_el_suiv4:=0; @@ -1075,21 +1102,27 @@ begin if length(s)>0 then if s[1]=',' then delete(s,1,1); if length(s)>0 then if s[1]='U' then delete(s,1,1); - // si décodeur UniSemaf (6) champ supplémentaire - if Feux[i].decodeur=6 then + // si décodeur UniSemaf (6) champ supplémentaire U + if (Feux[i].decodeur=6) then begin - if k=0 then begin Affiche('Erreur 680 Ligne '+chaine_signal,clred);Affiche('Manque définition de la cible pour le décodeur UniSemaf',clred);end + Val(s,k,erreur); + delete(s,1,erreur); + if k=0 then + begin + if Feux[i].decodeur=6 then begin Affiche('Erreur 680 Ligne '+chaine_signal,clred);Affiche('Manque définition décodeur UniSemaf',clred);end; + end else begin - Val(s,k,erreur); Feux[i].UniSemaf:=k; - erreur:=verif_UniSemaf(adresse,k); - if erreur=1 then begin Affiche('Erreur 681 Ligne '+chaine_signal,clred);Affiche('Erreur code Unisemaf',clred);end; - if erreur=2 then + if Feux[i].decodeur=6 then begin - Affiche('Erreur 682 Ligne '+chaine_signal,clred);Affiche('Erreur cohérence aspect signal ('+intToSTR(asp)+') et code Unisemaf ('+intToSTR(k)+')',clred); + erreur:=verif_UniSemaf(adresse,k); + if erreur=1 then begin Affiche('Erreur 681 Ligne '+chaine_signal,clred);Affiche('Erreur code Unisemaf',clred);end; + if erreur=2 then + begin + Affiche('Erreur 682 Ligne '+chaine_signal,clred);Affiche('Erreur cohérence aspect signal ('+intToSTR(asp)+') et code Unisemaf ('+intToSTR(k)+')',clred); + end; end; - end; end; end; @@ -1122,7 +1155,7 @@ begin val(chaine,adresse,erreur); feux[i].condCarre[l][bd].Adresse:=adresse; if erreur<>0 then feux[i].condCarre[l][bd].PosAig:=chaine[erreur] else - Affiche('Erreur 683 Définition du feu '+IntToSTR(feux[i].adresse)+': Manque D ou S dans les conditions de carré des aiguillages',clred); + Affiche('Erreur 683 Définition du signal '+IntToSTR(feux[i].adresse)+': Manque D ou S dans les conditions de carré des aiguillages',clred); end; k:=pos(',',sa);if k<>0 then delete(sa,1,k); @@ -1151,6 +1184,47 @@ begin end; end; + // champ DK + if length(s)>2 then + if copy(s,1,2)='DK' then + begin + delete(s,1,3); + for l:=1 to 19 do + begin + k:=pos(',',s); + val(s,j,erreur); + delete(s,1,k); + feux[i].SR[l].sortie1:=j; + end; + end; + + // champ CDF + if length(s)>3 then + if copy(s,1,3)='CDF' then + begin + delete(s,1,4); + for l:=1 to 19 do + begin + k:=pos(',',s); + val(s,j,erreur); + delete(s,1,k); + feux[i].SR[l].sortie1:=j; + end; + j:=pos('NA',s); + if j<>1 then affiche('Manque paramètre NA dans ligne '+chaine_signal,clred) + else + begin + delete(s,1,2); + val(s,j,erreur); + if (j<0) or (j>4) then + begin + j:=4;affiche('Paramètre NA incorrect dans ligne '+chaine_signal,clred) + end; + feux[i].na:=j; + end; + + end; + end; end; end; @@ -1249,10 +1323,9 @@ procedure genere_config; var s: string; fichierN : text; i : integer; - continue : boolean; begin - assign(fichierN,NomConfig); + assign(fichierN,NomConfig); rewrite(fichierN); // entête @@ -1262,12 +1335,17 @@ begin writeln(fichierN,Fonte_ch+'=',TailleFonte); FormPrinc.FenRich.Font.Size:=TailleFonte; + writeln(fichierN,Protocole_ch+'=',protocole); + // adresse ip et port de CDM writeln(fichierN,IpV4_PC_ch+'=',adresseIPCDM+':'+intToSTR(portCDM)); // adresse ip interface XpressNet - writeln(fichierN,IPV4_Interface_ch+'=',adresseIP+':'+intToSTR(port)); + writeln(fichierN,IPV4_Interface_ch+'=',adresseIP+':'+intToSTR(portInterface)); + // max com + writeln(fichierN,Maxcom_ch+'=',MaxPortCom); + // port com writeln(fichierN,Protocole_serie_ch+'=',portcom); @@ -1406,22 +1484,20 @@ end; procedure lit_config; -var s,sa,chaine,SOrigine: string; - c,paig : char; - tec,tjdC,tjsC,s2,trouve,triC,debugConfig,multiple,fini,finifeux,trouve_NbDetDist,trouve_ipv4_PC,trouve_retro, +var s,sa,SOrigine: string; + c : char; + tec,tjdC,tjsC,s2,triC,debugConfig,trouve_NbDetDist,trouve_ipv4_PC,trouve_retro,trouve_protocole, trouve_sec_init,trouve_init_aig,trouve_lay,trouve_IPV4_INTERFACE,trouve_PROTOCOLE_SERIE,trouve_INTER_CAR, 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_FVR, + trouve_section_branche,trouve_section_sig,trouve_section_act,trouve_tempo_feu, 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, + virgule,i_detect,i,erreur,aig2,detect,offset,j,position, 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; function lit_ligne : string ; - var esp,l1,l2,k : integer; - guim : boolean; - sp : string; + var esp,l1,l2 : integer; begin repeat readln(fichier,s); @@ -1508,66 +1584,69 @@ begin // définition des actionneurs repeat s:=lit_ligne; - sa:=s; sOrigine:=s; - - if s[1]='A' then + if s<>'0' then begin - Tablo_actionneur[maxtablo_act].typdeclenche:=2; // type aiguillage - Delete(sa,1,1); - val(sa,j,erreur); - Tablo_actionneur[maxtablo_act].adresse:=j; - delete(sa,1,erreur); - s:=sa; - end; + //Affiche(s,clyellow); + sa:=s; sOrigine:=s; - i:=pos('MEM[',sOrigine); - if i>0 then - begin - Tablo_actionneur[maxtablo_act].typdeclenche:=1; // type mémoire de zone - Delete(sa,1,4); - val(sa,j,erreur); - Tablo_actionneur[maxtablo_act].adresse:=j; - i:=pos(',',sa);delete(sa,1,i); - val(sa,j,erreur); - i:=pos(',',sa); - Tablo_actionneur[maxtablo_act].adresse2:=j; - Tablo_actionneur[maxTablo_act].det:=true; - delete(sa,1,i); - s:=sa; // mémo s - end; - - if length(sOrigine)>1 then - begin - if (sOrigine[1]<>'(') and (sorigine[1]<>'A') and (pos('MEM[',sOrigine)=0) then // si pas détecteur de PN + if s[1]='A' then begin - Tablo_actionneur[maxtablo_act].typdeclenche:=0; // type actionneur + Tablo_actionneur[maxtablo_act].typdeclenche:=2; // type aiguillage + Delete(sa,1,1); val(sa,j,erreur); Tablo_actionneur[maxtablo_act].adresse:=j; - if erreur<>0 then Tablo_actionneur[maxTablo_act].det:=sa[erreur]='Z' - else Affiche('Erreur actionneur '+sOrigine,clred); delete(sa,1,erreur); s:=sa; end; - end; - // vérifier si F ou A ou " au 4eme champ - i:=pos(',',sa); - if i>0 then delete(sa,1,i) else s:='0'; - i:=pos(',',sa); - if i>0 then delete(sa,1,i) else s:='0'; - - inc(Nligne); - - if length(sa)>1 then if (sa[1]='"') then - // -----------------son - begin - Tablo_actionneur[maxtablo_act].act:=false; - Tablo_actionneur[maxtablo_act].son:=true; - Tablo_actionneur[maxtablo_act].loco:=false; - i:=pos(',',s); - if i<>0 then + i:=pos('MEM[',sOrigine); + if i>0 then begin - val(s,j,erreur); + Tablo_actionneur[maxtablo_act].typdeclenche:=1; // type mémoire de zone + Delete(sa,1,4); + val(sa,j,erreur); + Tablo_actionneur[maxtablo_act].adresse:=j; + i:=pos(',',sa);delete(sa,1,i); + val(sa,j,erreur); + i:=pos(',',sa); + Tablo_actionneur[maxtablo_act].adresse2:=j; + Tablo_actionneur[maxTablo_act].det:=true; + delete(sa,1,i); + s:=sa; // mémo s + end; + + if length(sOrigine)>1 then + begin + if (sOrigine[1]<>'(') and (sorigine[1]<>'A') and (pos('MEM[',sOrigine)=0) then // si pas détecteur de PN + begin + Tablo_actionneur[maxtablo_act].typdeclenche:=0; // type actionneur + val(sa,j,erreur); + Tablo_actionneur[maxtablo_act].adresse:=j; + if erreur<>0 then Tablo_actionneur[maxTablo_act].det:=sa[erreur]='Z' + else Affiche('Erreur actionneur '+sOrigine,clred); + delete(sa,1,erreur); + s:=sa; + end; + end; + + // vérifier si F ou A ou " au 4eme champ + i:=pos(',',sa); + if i>0 then delete(sa,1,i) else s:='0'; + i:=pos(',',sa); + if i>0 then delete(sa,1,i) else s:='0'; + + inc(Nligne); + + if length(sa)>1 then if (sa[1]='"') then + // -----------------son + begin + Tablo_actionneur[maxtablo_act].act:=false; + Tablo_actionneur[maxtablo_act].son:=true; + Tablo_actionneur[maxtablo_act].loco:=false; + i:=pos(',',s); + if i<>0 then + begin + val(s,j,erreur); Tablo_actionneur[maxTablo_act].etat:=j; Delete(s,1,erreur); @@ -1580,67 +1659,66 @@ begin i:=pos('"',s); Tablo_actionneur[maxTablo_act].fichierSon:=copy(s,1,i-1); inc(maxTablo_act); - end; - end; - - if length(sa)>1 then if (sa[1]='A') then - // -----------------accessoire - begin - Tablo_actionneur[maxtablo_act].act:=true; - Tablo_actionneur[maxtablo_act].son:=false; - Tablo_actionneur[maxtablo_act].loco:=false; - - i:=pos(',',s); - if i<>0 then - begin - val(s,j,erreur); - Tablo_actionneur[maxTablo_act].etat:=j; - Delete(s,1,erreur); - - i:=pos(',',s); - Tablo_actionneur[maxTablo_act].trainDecl:=copy(s,1,i-1); - Delete(s,1,i); - - i:=pos('A',s); - if i<>0 then - begin - Delete(s,1,1); - val(s,j,erreur); - Tablo_actionneur[maxTablo_act].Accessoire:=j; - - i:=pos(',',s); - if i<>0 then - begin - Delete(S,1,i); - val(s,j,erreur); - Tablo_actionneur[maxTablo_act].sortie:=j; - end; - - i:=pos(',',s); - if i<>0 then - begin - Delete(S,1,i); - Tablo_actionneur[maxTablo_act].RAZ:=s[1]='Z'; - inc(maxTablo_act); - end; - - end; - s:='';i:=0; end; + end; - end; - - if length(sa)>1 then if (sa[1]='F') then - // -----------------fonction loco - begin - Tablo_actionneur[maxtablo_act].act:=false; - Tablo_actionneur[maxtablo_act].loco:=true; - Tablo_actionneur[maxtablo_act].son:=false; - - // 815,1,CC406526,F2,450 - i:=pos(',',s); - if i<>0 then + if length(sa)>1 then if (sa[1]='A') then + // -----------------accessoire begin + Tablo_actionneur[maxtablo_act].act:=true; + Tablo_actionneur[maxtablo_act].son:=false; + Tablo_actionneur[maxtablo_act].loco:=false; + + i:=pos(',',s); + if i<>0 then + begin + val(s,j,erreur); + Tablo_actionneur[maxTablo_act].etat:=j; + Delete(s,1,erreur); + + i:=pos(',',s); + Tablo_actionneur[maxTablo_act].trainDecl:=copy(s,1,i-1); + Delete(s,1,i); + + i:=pos('A',s); + if i<>0 then + begin + Delete(s,1,1); + val(s,j,erreur); + Tablo_actionneur[maxTablo_act].Accessoire:=j; + + i:=pos(',',s); + if i<>0 then + begin + Delete(S,1,i); + val(s,j,erreur); + Tablo_actionneur[maxTablo_act].sortie:=j; + end; + + i:=pos(',',s); + if i<>0 then + begin + Delete(S,1,i); + Tablo_actionneur[maxTablo_act].RAZ:=s[1]='Z'; + inc(maxTablo_act); + end; + + end; + s:='';i:=0; + end; + end; + + if length(sa)>1 then if (sa[1]='F') then + // -----------------fonction loco + begin + Tablo_actionneur[maxtablo_act].act:=false; + Tablo_actionneur[maxtablo_act].loco:=true; + Tablo_actionneur[maxtablo_act].son:=false; + + // 815,1,CC406526,F2,450 + i:=pos(',',s); + if i<>0 then + begin val(s,j,erreur); Tablo_actionneur[maxTablo_act].etat:=j; Delete(s,1,erreur); @@ -1668,108 +1746,107 @@ begin begin tablo_actionneur[maxTablo_act].TrainDest:=copy(s,i+1,length(s)-i); end; - inc(maxTablo_act); end; end; s:='';i:=0; end; - end; + end; - // Passage à niveau - if (pos('PN',s)<>0) then - begin - inc(NbrePN); - NbreVoies:=0; - repeat - inc(NbreVoies); - Delete(s,1,1); // supprime ( - // déterminer si il y a un - avant le ) - j:=pos(')',s); - i:=pos('-',s); - if (i0) then - begin - // zone de détection - val(s,j,erreur); - Tablo_PN[NbrePN].voie[NbreVoies].detZ1F:=j; - delete(s,1,erreur); + // Passage à niveau + if (pos('PN',s)<>0) then + begin + inc(NbrePN); + NbreVoies:=0; + repeat + inc(NbreVoies); + Delete(s,1,1); // supprime ( + // déterminer si il y a un - avant le ) + j:=pos(')',s); + i:=pos('-',s); + if (i0) then + begin + // zone de détection + val(s,j,erreur); + Tablo_PN[NbrePN].voie[NbreVoies].detZ1F:=j; + delete(s,1,erreur); - val(s,j,erreur); - Tablo_PN[NbrePN].voie[NbreVoies].detZ2F:=j; - delete(s,1,erreur); + val(s,j,erreur); + Tablo_PN[NbrePN].voie[NbreVoies].detZ2F:=j; + delete(s,1,erreur); - val(s,j,erreur); - Tablo_PN[NbrePN].voie[NbreVoies].detZ1O:=j; - delete(s,1,erreur); + val(s,j,erreur); + Tablo_PN[NbrePN].voie[NbreVoies].detZ1O:=j; + delete(s,1,erreur); - val(s,j,erreur); - Tablo_PN[NbrePN].voie[NbreVoies].detZ2O:=j; - end + val(s,j,erreur); + Tablo_PN[NbrePN].voie[NbreVoies].detZ2O:=j; + end + else + begin + // actionneurs + val(s,j,erreur); + Tablo_PN[NbrePN].voie[NbreVoies].ActFerme:=j; + // Affiche('Ferme='+intToSTR(j),clyellow); + i:=pos(',',s); + Delete(S,1,i); + val(s,j,erreur); + Tablo_PN[NbrePN].voie[NbreVoies].ActOuvre:=j; + // Affiche('Ouvre='+intToSTR(j),clyellow); + end; + + i:=pos(')',s);Delete(S,1,i); + i:=pos(',',s);Delete(S,1,i); + Tablo_PN[NbrePN].voie[NbreVoies].PresTrain:=false; + until (copy(s,1,2)='PN') or (NbreVoies=10); + + Tablo_PN[NbrePN].NbVoies:=NbreVoies; + Delete(s,1,3); // Supprime PN( + val(s,j,erreur); + Tablo_PN[NbrePN].Adresseferme:=j; + Delete(s,1,erreur-1); + if s[1]=',' then delete(s,1,1); + if s[1]='+' then Tablo_PN[NbrePN].CommandeFerme:=2 + else + if s[1]='-' then Tablo_PN[NbrePN].CommandeFerme:=1 else begin - // actionneurs + // nouvelle syntaxe val(s,j,erreur); - Tablo_PN[NbrePN].voie[NbreVoies].ActFerme:=j; - // Affiche('Ferme='+intToSTR(j),clyellow); - i:=pos(',',s); - Delete(S,1,i); - val(s,j,erreur); - Tablo_PN[NbrePN].voie[NbreVoies].ActOuvre:=j; - // Affiche('Ouvre='+intToSTR(j),clyellow); + Tablo_PN[NbrePN].CommandeFerme:=j; end; - - i:=pos(')',s);Delete(S,1,i); - i:=pos(',',s);Delete(S,1,i); - Tablo_PN[NbrePN].voie[NbreVoies].PresTrain:=false; - until (copy(s,1,2)='PN') or (NbreVoies=10); + j:=pos(',',s); + Delete(s,1,j); // supprime séparateurs - Tablo_PN[NbrePN].NbVoies:=NbreVoies; - Delete(s,1,3); // Supprime PN( - val(s,j,erreur); - Tablo_PN[NbrePN].Adresseferme:=j; - Delete(s,1,erreur-1); - if s[1]=',' then delete(s,1,1); - if s[1]='+' then Tablo_PN[NbrePN].CommandeFerme:=2 - else - if s[1]='-' then Tablo_PN[NbrePN].CommandeFerme:=1 - else - begin - // nouvelle syntaxe val(s,j,erreur); - Tablo_PN[NbrePN].CommandeFerme:=j; - end; - j:=pos(',',s); - Delete(s,1,j); // supprime séparateurs - - val(s,j,erreur); - Tablo_PN[NbrePN].AdresseOuvre:=j; - Delete(s,1,erreur-1); - if s[1]=',' then delete(s,1,1); - if s[1]='+' then Tablo_PN[NbrePN].CommandeOuvre:=2 - else - if s[1]='-' then Tablo_PN[NbrePN].CommandeOuvre:=1 - else - begin - // nouvelle syntaxe - val(s,j,erreur); - Tablo_PN[NbrePN].CommandeOuvre:=j; - end; - j:=pos(')',s); - Delete(s,1,j); // supprime séparateurs - if length(s)>0 then - begin - // champ impulsion nouvelle syntaxe + Tablo_PN[NbrePN].AdresseOuvre:=j; + Delete(s,1,erreur-1); if s[1]=',' then delete(s,1,1); - val(s,i,erreur); - Tablo_PN[NbrePN].Pulse:=i; + if s[1]='+' then Tablo_PN[NbrePN].CommandeOuvre:=2 + else + if s[1]='-' then Tablo_PN[NbrePN].CommandeOuvre:=1 + else + begin + // nouvelle syntaxe + val(s,j,erreur); + Tablo_PN[NbrePN].CommandeOuvre:=j; + end; + j:=pos(')',s); + Delete(s,1,j); // supprime séparateurs + if length(s)>0 then + begin + // champ impulsion nouvelle syntaxe + if s[1]=',' then delete(s,1,1); + val(s,i,erreur); + Tablo_PN[NbrePN].Pulse:=i; + s:=''; + end; end; - end; - if pos('PN',s)<>0 then i:=0; until (s='0'); dec(maxTablo_act); end; - + procedure compile_aiguillages; begin //Affiche('Définition des aiguillages',clyellow); @@ -2033,6 +2110,7 @@ begin repeat s:=lit_ligne; //affiche(s,cllime); + sa:=uppercase(Fonte_ch)+'='; i:=pos(sa,s); if i=1 then @@ -2045,6 +2123,17 @@ begin FormPrinc.FenRich.Font.Size:=TailleFonte; end; + sa:=uppercase(Protocole_ch)+'='; + i:=pos(sa,s); + if i=1 then + begin + inc(nv); + trouve_protocole:=true; + delete(s,i,length(sa)); + val(s,Protocole,erreur); + if (Protocole<1) or (Protocole>2) then Protocole:=1; //1=xpressnet 2=DCC+ + end; + // adresse ip et port de CDM sa:=uppercase(IpV4_PC_ch)+'='; i:=pos(sa,s); @@ -2074,12 +2163,26 @@ begin i:=pos(':',s); if i<>0 then begin - adresseIP:=copy(s,1,i-1);Delete(s,1,i);port:=StrToINT(s); - if (adresseIP<>'0') and (port=0) then affiche('Erreur port nul : '+sOrigine,clRed); + adresseIP:=copy(s,1,i-1);Delete(s,1,i);portInterface:=StrToINT(s); + if (adresseIP<>'0') and (portInterface=0) then affiche('Erreur port nul : '+sOrigine,clRed); end else begin adresseIP:='0';parSocketLenz:=false;end; end; + // nombre max de port série à explorer + // configuration du port com + sa:=uppercase(MaxCom_ch)+'='; + i:=pos(sa,s); + if i=1 then + begin + inc(nv); + delete(s,i,length(sa)); + trouve_MaxPort:=true; + val(s,MaxPortCom,erreur); + if erreur<>0 then Affiche('Erreur MaxCom: '+sOrigine,clred); + if (MaxPortCom<1) or (MaxPortCom>99) then MaxPortCom:=30; + end; + // configuration du port com sa:=uppercase(PROTOCOLE_SERIE_ch)+'='; i:=pos(sa,s); @@ -2129,9 +2232,8 @@ begin case Valeur_entete of 0 : begin entete:='';suffixe:='';end; 1 : begin entete:=#$FF+#$FE;suffixe:='';end; - 2 : begin entete:=#228;suffixe:=#13+#13+#10;end; end; - if (erreur<>0) or (valeur_entete>2) then Affiche('Erreur déclaration variable '+entete_ch,clred); + if (erreur<>0) or (valeur_entete>1) then Affiche('Erreur déclaration variable '+entete_ch,clred); end; // avec ou sans initialisation des aiguillages @@ -2449,7 +2551,7 @@ begin Ancien_detecteur[i]:=false; end; - Affiche('Lecture du fichier de configuration '+NomConfig,clyellow); + //Affiche('Lecture du fichier de configuration '+NomConfig,clyellow); {$I+} try assign(fichier,NomConfig); @@ -2458,7 +2560,7 @@ begin Affiche('Fichier '+NomConfig+' non trouvé : création d''un fichier vide par défaut',clred); portcom:='COM3:57600,N,8,1,2'; adresseIPCDM:='127.0.0.1';portCDM:=9999; - adresseIP:='192.168.1.23';port:=5550; + adresseIP:='192.168.1.23';portInterface:=5550; verifVersion:=true; Valeur_entete:=1; TempoOctet:=50; @@ -2583,8 +2685,8 @@ begin val(EditPortLenz.Text,i,erreur); if i=0 then i:=5550; if i>65535 then begin labelInfo.Caption:='Port Interface incorrect';ok:=false;end; - changeInterface:=changeInterface or (i<>port); - port:=i; + changeInterface:=changeInterface or (i<>portinterface); + portInterface:=i; Val(editTempoAig.Text,i,erreur); if i>3000 then begin labelInfo.Caption:='Temporisation de séquencement incorrecte ';ok:=false;end; @@ -2616,11 +2718,9 @@ begin if RadioButton1.checked then Valeur_entete:=0; if RadioButton2.checked then Valeur_entete:=1; - if RadioButton3.checked then Valeur_entete:=2; case Valeur_entete of 0 : begin entete:='';suffixe:='';end; 1 : begin entete:=#$FF+#$FE;suffixe:='';end; - 2 : begin entete:=#228;suffixe:=#13+#13+#10;end; end; if changeCDM then connecte_CDM; @@ -2631,7 +2731,7 @@ begin Affiche('demande connexion à la centrale Lenz par Ethernet',clyellow); With Formprinc do begin - ClientSocketLenz.port:=port; + ClientSocketLenz.port:=portInterface; ClientSocketLenz.Address:=AdresseIP; ClientSocketLenz.Open; end; @@ -2687,6 +2787,19 @@ begin AvecDemandeAiguillages:=checkPosAig.checked; AvecDemandeInterfaceUSB:=CheckBoxDemarUSB.checked; AvecDemandeInterfaceEth:=CheckBoxDemarEth.checked; + protocole:=1; + if RadioButtonXpress.Checked then + begin + protocole:=1; + formprinc.EditEnvoi.Visible:=false; + formprinc.ButtonEnv.Visible:=false; + end; + if RadioButtonDcc.Checked then + begin + protocole:=2; + formprinc.EditEnvoi.Visible:=true; + formprinc.ButtonEnv.Visible:=true; + end; end; if change_srv then services_CDM; @@ -2783,7 +2896,7 @@ begin EditAdrIPCDM.text:=adresseIPCDM; EditPortCDM.Text:=IntToSTR(portCDM); EditIPLenz.text:=AdresseIP; - EditportLenz.text:=IntToSTR(Port); + EditportLenz.text:=IntToSTR(PortInterface); EditTempoAig.Text:=IntToSTR(Tempo_Aig); EditComUSB.Text:=PortCom; @@ -2792,10 +2905,8 @@ begin EditTempoReponse.Text:=IntToSTR(TimoutMaxInterface); RadioButton1.checked:=false; RadioButton2.checked:=false; - RadioButton3.checked:=false; if Valeur_entete=0 then RadioButton1.checked:=true; if Valeur_entete=1 then RadioButton2.checked:=true; - if Valeur_entete=2 then RadioButton3.checked:=true; LabelInfo.Width:=253;LabelInfo.Height:=25; LabelResult.width:=137;LabelResult.Height:=25; LabelNomSon.top:=16;LabelNomSon.Left:=48; @@ -2836,11 +2947,13 @@ begin CheckBoxDemarUSB.checked:=AvecDemandeInterfaceUSB; CheckBoxDemarEth.checked:=AvecDemandeInterfaceEth; + RadioButtonXpress.Checked:=protocole=1; + RadioButtonDcc.Checked:=protocole=2; clicListe:=true; // empeche le traitement de l'evt text EditDroit_BD.Text:=''; EditPointe_BG.Text:=''; - EditDevie_HD.Text:=''; + EditDevie_HD.Text:=''; ligneclicSig:=-1; AncLigneClicSig:=-1; @@ -2957,7 +3070,7 @@ begin clicListe:=true; if affevt then affiche('FormConfig create',clLime); clicListe:=false; - + ConfigPrete:=true; end; @@ -2996,6 +3109,7 @@ var Adresse,Adr2,ind,id2,erreur,position : integer; i : integer; B : char; begin + if index<1 then exit; s:=Uppercase(formConfig.RichAig.Lines[index-1]); //Affiche(s,clLime); if s='' then exit; @@ -3399,10 +3513,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,p,k,nc,condCarre : integer; +var i,j,l,d,p,k,nc,decodeur : integer; s : string; begin if Affevt then affiche('Aff_champs_sig_feux('+intToSTR(index)+')',clyellow); + if index<0 then exit; clicListe:=true; i:=index; FormConfig.EditAdrSig.text:=InttoSTr(feux[i].adresse); @@ -3423,17 +3538,30 @@ begin EditDet4.Text:=''; EditSuiv4.Text:=''; ComboBoxDec.ItemIndex:=feux[i].decodeur; - if feux[i].decodeur=7 then - ButtonConfigSR.Visible:=true else ButtonConfigSR.Visible:=false; + decodeur:=feux[i].decodeur; + ButtonConfigSR.Visible:=false; + //SR + if (decodeur=7) or (decodeur=2) then ButtonConfigSR.Visible:=true; - if feux[i].decodeur=6 then + // unisemaf + if (decodeur=6) then begin - EditSpecUni.Visible:=true;LabelUni.Visible:=true; + EditSpecUni.Visible:=true; + LabelUni.Caption:='Spec Unisemaf'; + LabelUni.Visible:=true; EditSpecUni.Text:=IntToSTR(feux[i].Unisemaf); - end - else begin EditSpecUni.Visible:=false;LabelUni.Visible:=false;end; - - + editSpecUni.Hint:='Paramètre de description supplémentaire du décodeur Unisemaf'; + editSpecUni.ShowHint:=true; + end; + // digikeijs + if (decodeur=5) then + begin + ButtonConfigSR.Visible:=true ; + end; + if (decodeur<>6) then + begin EditSpecUni.Visible:=false;LabelUni.Visible:=false;end; + + d:=feux[i].aspect; case d of 2 : ComboBoxAsp.ItemIndex:=0; @@ -3562,6 +3690,7 @@ var etatact, adresse,sortie,fonction,tempo,access,typ : integer; det : boolean; begin if affevt then affiche('Aff_champs_act('+intToSTR(i)+')',clyellow); + if i<0 then exit; s:=Uppercase(FormConfig.RichAct.Lines[i]); if s='' then exit; inc(i); // passer en index tablo @@ -3706,6 +3835,7 @@ var adresse,erreur,j,v : integer; s : string; begin if affevt then affiche('Aff_champs_PN('+intToSTR(i)+')',clyellow); + if i<0 then exit; s:=Uppercase(FormConfig.RichPN.Lines[i]); if s='' then exit; @@ -4334,7 +4464,7 @@ end; procedure TFormConfig.ComboBoxDecChange(Sender: TObject); var s: string; - i : integer; + i,decodeur : integer; begin // Affiche(IntToStr(ComboBoxDec.ItemIndex),clyellow); if clicListe then exit; @@ -4342,7 +4472,8 @@ begin if NbreFeux0 then begin @@ -6427,7 +6562,7 @@ begin ok:=false; end; end; - + if (model2=aig) or (model2=triple) then begin if c='D' then @@ -6499,7 +6634,7 @@ begin if adr<>extr then Affiche('Erreur 10.34: Discordance de déclaration aiguillages '+intToSTR(adr)+'S: '+intToSTR(adr2)+'S différent de '+intToSTR(extr),clred); end; if c='P' then - begin + begin extr:=aiguillage[index2].APointe; if adr<>extr then Affiche('Erreur 10.35: Discordance de déclaration aiguillages '+intToSTR(adr)+'S: '+intToSTR(adr2)+'P différent de '+intToSTR(extr),clred); end; @@ -6667,7 +6802,7 @@ begin if aiguillage[k].Ddroit=SuivAdr then trouveSuiv:=true; if aiguillage[k].Ddevie=SuivAdr then trouveSuiv:=true; end; - + if not(trouveSuiv) then begin Affiche('Erreur 12: La description de l''aiguillage '+intToSTR(detect)+' ne correspond pas à son élément contigu ('+intToStr(SuivAdr)+') en branche '+intToSTR(i),clred); @@ -6725,6 +6860,11 @@ begin end; end; + // 10 Divers + i:=pos(':',portcom);j:=pos(',',portcom); + val(copy(portcom,i+1,j-i),vitesse,l); + if (protocole=2) and (vitesse<>115200) then Affiche('La vitesse COM/USB en procotole DCC++ doit être de 115200 bauds',clred); + verif_coherence:=ok; end; @@ -6775,7 +6915,7 @@ end; // supprime le ou les aiguillages sélectionnés dans le richEdit procedure supprime_aig; -var ligneDeb,LigneFin,i,index,index2,debut,longueur,fin,l,ltot : integer; +var ligneDeb,LigneFin,i,index,debut,longueur,fin,l,ltot : integer; s : string; begin //trouver ligne de début et de fin sélectionner. @@ -7814,10 +7954,25 @@ begin end; procedure TFormConfig.ButtonConfigSRClick(Sender: TObject); +var decodeur : integer; begin clicListe:=true; - formSR.showmodal; - formSR.close; + decodeur:=feux[ligneClicSig+1].decodeur; + if decodeur=7 then // SR + begin + formSR.showmodal; + formSR.close; + end; + if (decodeur=2) then // cdf + begin + formCDF.showmodal; + formCDF.close; + end; + if (decodeur=5) then + begin + formDigikeijs.showmodal; + formDigikeijs.close; + end; clicListe:=false; end; @@ -8533,6 +8688,8 @@ end; begin + + end. diff --git a/UnitConfigCellTCO.dcu b/UnitConfigCellTCO.dcu index e0923df..7ee269d 100644 Binary files a/UnitConfigCellTCO.dcu and b/UnitConfigCellTCO.dcu differ diff --git a/UnitConfigTCO.dcu b/UnitConfigTCO.dcu index ca07a2a..0d5b924 100644 Binary files a/UnitConfigTCO.dcu and b/UnitConfigTCO.dcu differ diff --git a/UnitConfigTCO.pas b/UnitConfigTCO.pas index 6f6ae59..6d1e19c 100644 --- a/UnitConfigTCO.pas +++ b/UnitConfigTCO.pas @@ -222,8 +222,6 @@ begin end; procedure TFormConfigTCO.ButtonOKClick(Sender: TObject); -var i : integer; - begin if verif_config_TCO then begin @@ -241,9 +239,6 @@ begin end; procedure TFormConfigTCO.ButtonDessineClick(Sender: TObject); -var i,erreur : integer; - r : Trect; - c : tCanvas; begin if verif_config_TCO then begin diff --git a/UnitDebug.dcu b/UnitDebug.dcu index 4eddefc..6a35e6e 100644 Binary files a/UnitDebug.dcu and b/UnitDebug.dcu differ diff --git a/UnitDebug.dfm b/UnitDebug.dfm index 47ccf28..2ab57c0 100644 --- a/UnitDebug.dfm +++ b/UnitDebug.dfm @@ -2,8 +2,7 @@ object FormDebug: TFormDebug Left = 429 Top = 147 Width = 754 - Height = 789 - VertScrollBar.Position = 82 + Height = 784 VertScrollBar.Tracking = True Caption = 'Fen'#234'tre de d'#233'bug' Color = clWindow @@ -18,12 +17,12 @@ object FormDebug: TFormDebug OnCreate = FormCreate DesignSize = ( 721 - 751) + 746) PixelsPerInch = 96 TextHeight = 13 object Label1: TLabel Left = 564 - Top = -78 + Top = 4 Width = 108 Height = 13 Anchors = [akTop, akRight] @@ -39,7 +38,7 @@ object FormDebug: TFormDebug end object Label2: TLabel Left = 412 - Top = -80 + Top = 2 Width = 131 Height = 18 Anchors = [akTop, akRight] @@ -53,7 +52,7 @@ object FormDebug: TFormDebug end object EditNivDebug: TEdit Left = 675 - Top = -80 + Top = 2 Width = 49 Height = 21 Anchors = [akTop, akRight] @@ -69,7 +68,7 @@ object FormDebug: TFormDebug end object MemoEvtDet: TMemo Left = 485 - Top = 254 + Top = 336 Width = 229 Height = 194 Anchors = [akTop, akRight] @@ -90,7 +89,7 @@ object FormDebug: TFormDebug end object ButtonEcrLog: TButton Left = 379 - Top = 246 + Top = 328 Width = 97 Height = 29 Anchors = [akTop, akRight] @@ -100,7 +99,7 @@ object FormDebug: TFormDebug end object ButtonRazTampon: TButton Left = 379 - Top = 278 + Top = 360 Width = 97 Height = 33 Anchors = [akTop, akRight] @@ -111,7 +110,7 @@ object FormDebug: TFormDebug end object ButtonCherche: TButton Left = 379 - Top = 214 + Top = 296 Width = 97 Height = 25 Anchors = [akTop, akRight] @@ -121,7 +120,7 @@ object FormDebug: TFormDebug end object ButtonAffEvtChrono: TButton Left = 379 - Top = 174 + Top = 256 Width = 97 Height = 33 Anchors = [akTop, akRight] @@ -132,7 +131,7 @@ object FormDebug: TFormDebug end object ButtonCop: TButton Left = 379 - Top = 126 + Top = 208 Width = 97 Height = 41 Anchors = [akTop, akRight] @@ -149,7 +148,7 @@ object FormDebug: TFormDebug end object RichEdit: TRichEdit Left = 485 - Top = 94 + Top = 176 Width = 229 Height = 153 Anchors = [akTop, akRight] @@ -168,7 +167,7 @@ object FormDebug: TFormDebug end object ButtonRazLog: TButton Left = 379 - Top = 318 + Top = 400 Width = 97 Height = 33 Anchors = [akTop, akRight] @@ -179,7 +178,7 @@ object FormDebug: TFormDebug end object GroupBox1: TGroupBox Left = 369 - Top = 566 + Top = 648 Width = 345 Height = 185 Anchors = [akTop, akRight] @@ -327,7 +326,7 @@ object FormDebug: TFormDebug end object GroupBox2: TGroupBox Left = 377 - Top = -62 + Top = 20 Width = 333 Height = 149 Anchors = [akTop, akRight] @@ -499,7 +498,7 @@ object FormDebug: TFormDebug end object RichDebug: TRichEdit Left = 8 - Top = -74 + Top = 8 Width = 353 Height = 718 Anchors = [akLeft, akTop, akRight, akBottom] @@ -513,7 +512,7 @@ object FormDebug: TFormDebug end object GroupBox5: TGroupBox Left = 369 - Top = 454 + Top = 536 Width = 345 Height = 57 Anchors = [akTop, akRight] @@ -580,7 +579,7 @@ object FormDebug: TFormDebug end object ButtonRazTout: TButton Left = 380 - Top = 94 + Top = 176 Width = 97 Height = 25 Hint = @@ -595,7 +594,7 @@ object FormDebug: TFormDebug end object GroupBox6: TGroupBox Left = 368 - Top = 518 + Top = 600 Width = 345 Height = 41 Anchors = [akTop, akRight] diff --git a/UnitDebug.pas b/UnitDebug.pas index 4750ad5..5b60838 100644 --- a/UnitDebug.pas +++ b/UnitDebug.pas @@ -299,7 +299,6 @@ begin end; procedure TFormDebug.ButtonCopClick(Sender: TObject); -var i : integer; begin RichDebug.Lines:=Formprinc.FenRich.lines; end; @@ -523,7 +522,7 @@ begin end; procedure TFormDebug.Button1Click(Sender: TObject); -var adr,sortie,erreur,groupe,pilotage : integer; +var adr,sortie,erreur,groupe : integer; fonction : byte; s : string; begin @@ -553,7 +552,6 @@ begin // pilotage par USB ou par éthernet de la centrale ------------ if (hors_tension2=false) and (portCommOuvert or parSocketLenz) then begin - pilotage:=1; groupe:=(adr-1) div 4; fonction:=((adr-1) mod 4)*2 + (sortie-1); // pilotage à 1 @@ -566,7 +564,7 @@ begin end; procedure TFormDebug.Button0Click(Sender: TObject); -var adr,sortie,erreur,groupe,pilotage : integer; +var adr,sortie,erreur,groupe : integer; fonction : byte; s : string; begin @@ -596,7 +594,6 @@ begin // pilotage par USB ou par éthernet de la centrale ------------ if (hors_tension2=false) and (portCommOuvert or parSocketLenz) then begin - pilotage:=1; groupe:=(adr-1) div 4; fonction:=((adr-1) mod 4)*2 + (sortie-1); // pilotage à 0 diff --git a/UnitDigikeijs.dcu b/UnitDigikeijs.dcu new file mode 100644 index 0000000..fed5875 Binary files /dev/null and b/UnitDigikeijs.dcu differ diff --git a/UnitDigikeijs.dfm b/UnitDigikeijs.dfm new file mode 100644 index 0000000..645f4c5 --- /dev/null +++ b/UnitDigikeijs.dfm @@ -0,0 +1,381 @@ +object FormDigikeijs: TFormDigikeijs + Left = 362 + Top = 124 + BorderStyle = bsDialog + Caption = 'Configuration du d'#233'codeur Digikeijs 4018' + ClientHeight = 442 + ClientWidth = 344 + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + OldCreateOrder = False + OnActivate = FormActivate + PixelsPerInch = 96 + TextHeight = 13 + object LabelTitre: TLabel + Left = 16 + Top = 8 + Width = 63 + Height = 19 + Caption = 'Adresse' + Font.Charset = ANSI_CHARSET + Font.Color = clWindowText + Font.Height = -16 + Font.Name = 'Arial' + Font.Style = [fsBold] + ParentFont = False + end + object Label1: TLabel + Left = 8 + Top = 136 + Width = 32 + Height = 13 + Caption = 'Label1' + end + object Label2: TLabel + Left = 8 + Top = 160 + Width = 32 + Height = 13 + Caption = 'Label2' + end + object Label3: TLabel + Left = 8 + Top = 184 + Width = 32 + Height = 13 + Caption = 'Label3' + end + object Label4: TLabel + Left = 8 + Top = 208 + Width = 32 + Height = 13 + Caption = 'Label4' + end + object Label5: TLabel + Left = 8 + Top = 232 + Width = 32 + Height = 13 + Caption = 'Label5' + end + object Label6: TLabel + Left = 8 + Top = 256 + Width = 32 + Height = 13 + Caption = 'Label6' + end + object Label7: TLabel + Left = 8 + Top = 280 + Width = 32 + Height = 13 + Caption = 'Label7' + end + object Label8: TLabel + Left = 8 + Top = 304 + Width = 32 + Height = 13 + Caption = 'Label8' + end + object Label9: TLabel + Left = 8 + Top = 328 + Width = 32 + Height = 13 + Caption = 'Label9' + end + object Label10: TLabel + Left = 8 + Top = 352 + Width = 38 + Height = 13 + Caption = 'Label10' + end + object Label11: TLabel + Left = 184 + Top = 160 + Width = 38 + Height = 13 + Caption = 'Label11' + end + object Label12: TLabel + Left = 184 + Top = 184 + Width = 38 + Height = 13 + Caption = 'Label12' + end + object Label13: TLabel + Left = 184 + Top = 208 + Width = 38 + Height = 13 + Caption = 'Label13' + end + object Label14: TLabel + Left = 184 + Top = 232 + Width = 38 + Height = 13 + Caption = 'Label14' + end + object Label15: TLabel + Left = 184 + Top = 256 + Width = 38 + Height = 13 + Caption = 'Label15' + end + object Label16: TLabel + Left = 184 + Top = 280 + Width = 38 + Height = 13 + Caption = 'Label16' + end + object Label17: TLabel + Left = 184 + Top = 304 + Width = 38 + Height = 13 + Caption = 'Label17' + end + object Label18: TLabel + Left = 184 + Top = 328 + Width = 38 + Height = 13 + Caption = 'Label18' + end + object Label19: TLabel + Left = 184 + Top = 352 + Width = 38 + Height = 13 + Caption = 'Label19' + end + object ImageDigi: TImage + Left = 240 + Top = 16 + Width = 57 + Height = 97 + end + object Shape1: TShape + Left = 168 + Top = 112 + Width = 2 + Height = 273 + end + object Label20: TLabel + Left = 24 + Top = 48 + Width = 184 + Height = 26 + Caption = + 'Tables d'#39'aspects du signal en fonction du motif envoy'#233' au d'#233'code' + + 'ur Digikeijs' + WordWrap = True + end + object Label21: TLabel + Left = 120 + Top = 112 + Width = 29 + Height = 13 + Caption = 'Motif' + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [fsBold] + ParentFont = False + end + object Label22: TLabel + Left = 296 + Top = 136 + Width = 29 + Height = 13 + Caption = 'Motif' + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [fsBold] + ParentFont = False + end + object Button1: TButton + Left = 128 + Top = 408 + Width = 75 + Height = 25 + Caption = 'Fermer' + TabOrder = 0 + OnClick = Button1Click + end + object Edit1: TEdit + Left = 120 + Top = 136 + Width = 25 + Height = 21 + TabOrder = 1 + OnChange = Edit1Change + end + object Edit2: TEdit + Left = 120 + Top = 160 + Width = 25 + Height = 21 + TabOrder = 2 + OnChange = Edit2Change + end + object Edit3: TEdit + Left = 120 + Top = 184 + Width = 25 + Height = 21 + TabOrder = 3 + OnChange = Edit3Change + end + object Edit4: TEdit + Left = 120 + Top = 208 + Width = 25 + Height = 21 + TabOrder = 4 + OnChange = Edit4Change + end + object Edit5: TEdit + Left = 120 + Top = 232 + Width = 25 + Height = 21 + TabOrder = 5 + OnChange = Edit5Change + end + object Edit6: TEdit + Left = 120 + Top = 256 + Width = 25 + Height = 21 + TabOrder = 6 + OnChange = Edit6Change + end + object Edit7: TEdit + Left = 120 + Top = 280 + Width = 25 + Height = 21 + TabOrder = 7 + OnChange = Edit7Change + end + object Edit8: TEdit + Left = 120 + Top = 304 + Width = 25 + Height = 21 + TabOrder = 8 + OnChange = Edit8Change + end + object Edit9: TEdit + Left = 120 + Top = 328 + Width = 25 + Height = 21 + TabOrder = 9 + OnChange = Edit9Change + end + object Edit10: TEdit + Left = 120 + Top = 352 + Width = 25 + Height = 21 + TabOrder = 10 + OnChange = Edit10Change + end + object Edit11: TEdit + Left = 296 + Top = 160 + Width = 25 + Height = 21 + TabOrder = 11 + OnChange = Edit11Change + end + object Edit12: TEdit + Left = 296 + Top = 184 + Width = 25 + Height = 21 + TabOrder = 12 + OnChange = Edit12Change + end + object Edit13: TEdit + Left = 296 + Top = 208 + Width = 25 + Height = 21 + TabOrder = 13 + OnChange = Edit13Change + end + object Edit14: TEdit + Left = 296 + Top = 232 + Width = 25 + Height = 21 + TabOrder = 14 + OnChange = Edit14Change + end + object Edit15: TEdit + Left = 296 + Top = 256 + Width = 25 + Height = 21 + TabOrder = 15 + OnChange = Edit15Change + end + object Edit16: TEdit + Left = 296 + Top = 280 + Width = 25 + Height = 21 + TabOrder = 16 + OnChange = Edit16Change + end + object Edit17: TEdit + Left = 296 + Top = 304 + Width = 25 + Height = 21 + TabOrder = 17 + OnChange = Edit17Change + end + object Edit18: TEdit + Left = 296 + Top = 328 + Width = 25 + Height = 21 + TabOrder = 18 + OnChange = Edit18Change + end + object Edit19: TEdit + Left = 296 + Top = 352 + Width = 25 + Height = 21 + TabOrder = 19 + OnChange = Edit19Change + end + object CheckMotif: TCheckBox + Left = 16 + Top = 88 + Width = 169 + Height = 17 + Caption = 'Inversion du sens du motif' + TabOrder = 20 + end +end diff --git a/UnitDigikeijs.pas b/UnitDigikeijs.pas new file mode 100644 index 0000000..b4bd4ec --- /dev/null +++ b/UnitDigikeijs.pas @@ -0,0 +1,355 @@ +unit UnitDigikeijs; + +interface + +uses + Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, + Dialogs, StdCtrls, ExtCtrls, UnitConfig,UnitPrinc ; + +type + TFormDigikeijs = class(TForm) + Button1: TButton; + LabelTitre: TLabel; + Label1: TLabel; + Label2: TLabel; + Label3: TLabel; + Label4: TLabel; + Label5: TLabel; + Label6: TLabel; + Label7: TLabel; + Label8: TLabel; + Label9: TLabel; + Label10: TLabel; + Label11: TLabel; + Label12: TLabel; + Label13: TLabel; + Label14: TLabel; + Label15: TLabel; + Label16: TLabel; + Label17: TLabel; + Label18: TLabel; + Label19: TLabel; + ImageDigi: TImage; + Edit1: TEdit; + Shape1: TShape; + Edit2: TEdit; + Edit3: TEdit; + Edit4: TEdit; + Edit5: TEdit; + Edit6: TEdit; + Edit7: TEdit; + Edit8: TEdit; + Edit9: TEdit; + Edit10: TEdit; + Edit11: TEdit; + Edit12: TEdit; + Edit13: TEdit; + Edit14: TEdit; + Edit15: TEdit; + Edit16: TEdit; + Edit17: TEdit; + Edit18: TEdit; + Edit19: TEdit; + Label20: TLabel; + Label21: TLabel; + Label22: TLabel; + CheckMotif: TCheckBox; + procedure Button1Click(Sender: TObject); + procedure FormActivate(Sender: TObject); + procedure Edit1Change(Sender: TObject); + procedure Edit2Change(Sender: TObject); + procedure Edit3Change(Sender: TObject); + procedure Edit4Change(Sender: TObject); + procedure Edit5Change(Sender: TObject); + procedure Edit6Change(Sender: TObject); + procedure Edit7Change(Sender: TObject); + procedure Edit8Change(Sender: TObject); + procedure Edit9Change(Sender: TObject); + procedure Edit10Change(Sender: TObject); + procedure Edit11Change(Sender: TObject); + procedure Edit12Change(Sender: TObject); + procedure Edit13Change(Sender: TObject); + procedure Edit14Change(Sender: TObject); + procedure Edit15Change(Sender: TObject); + procedure Edit16Change(Sender: TObject); + procedure Edit17Change(Sender: TObject); + procedure Edit18Change(Sender: TObject); + procedure Edit19Change(Sender: TObject); + private + { Déclarations privées } + public + { Déclarations publiques } + end; + +var + FormDigikeijs: TFormDigikeijs; + Adresse,Index : integer; + +implementation + + +{$R *.dfm} + +procedure TFormDigikeijs.Button1Click(Sender: TObject); +begin + InverseMotif:=checkMotif.Checked; + close; +end; + +procedure TFormDigikeijs.FormActivate(Sender: TObject); +var erreur : integer; +begin + + Val(FormConfig.EditAdrSig.text,Adresse,erreur); + index:=index_feu(Adresse); + LabelTitre.caption:='Adresse du signal: '+intToSTR(adresse); + + Label1.caption:=etats[1]; + Label2.caption:=etats[2]; + Label3.caption:=etats[3]; + Label4.caption:=etats[4]; + Label5.caption:=etats[5]; + Label6.caption:=etats[6]; + Label7.caption:=etats[7]; + Label8.caption:=etats[8]; + Label9.caption:=etats[9]; + Label10.caption:=etats[10]; + Label11.caption:=etats[11]; + Label12.caption:=etats[12]; + Label13.caption:=etats[13]; + Label14.caption:=etats[14]; + Label15.caption:=etats[15]; + Label16.caption:=etats[16]; + Label17.caption:=etats[17]; + Label18.caption:=etats[18]; + Label19.caption:=etats[19]; + + ImageDigi.Picture:=FormConfig.ImageSignal.Picture; + with ImageDigi.Picture do + begin + Bitmap.TransparentMode:=tmAuto; + Bitmap.TransparentColor:=clblue; + end; + ImageDigi.Transparent:=true; + + Edit1.Text:=intToSTR(Feux[index].SR[1].sortie1); // carré + Edit2.Text:=intToSTR(Feux[index].SR[2].sortie1); // sémaphore + Edit3.Text:=intToSTR(Feux[index].SR[3].sortie1); // sémaphore cli + Edit4.Text:=intToSTR(Feux[index].SR[4].sortie1); + Edit5.Text:=intToSTR(Feux[index].SR[5].sortie1); + Edit6.Text:=intToSTR(Feux[index].SR[6].sortie1); + Edit7.Text:=intToSTR(Feux[index].SR[7].sortie1); + Edit8.Text:=intToSTR(Feux[index].SR[8].sortie1); + Edit9.Text:=intToSTR(Feux[index].SR[9].sortie1); + Edit10.Text:=intToSTR(Feux[index].SR[10].sortie1); + Edit11.Text:=intToSTR(Feux[index].SR[11].sortie1); + Edit12.Text:=intToSTR(Feux[index].SR[12].sortie1); + Edit13.Text:=intToSTR(Feux[index].SR[13].sortie1); + Edit14.Text:=intToSTR(Feux[index].SR[14].sortie1); + Edit15.Text:=intToSTR(Feux[index].SR[15].sortie1); + Edit16.Text:=intToSTR(Feux[index].SR[16].sortie1); + Edit17.Text:=intToSTR(Feux[index].SR[17].sortie1); + Edit18.Text:=intToSTR(Feux[index].SR[18].sortie1); + Edit19.Text:=intToSTR(Feux[index].SR[19].sortie1); + CheckMotif.checked:=InverseMotif; +end; + +procedure Maj_DB; +var s : string; +begin + s:=encode_sig_feux(index); + formconfig.RichSig.Lines[index-1]:=s; + aff_champs_sig_feux(index); +end; + +procedure TFormDigikeijs.Edit1Change(Sender: TObject); +var erreur : integer; +begin + if index<>0 then + begin + val(Edit1.Text,Feux[index].SR[1].sortie1,erreur); + Maj_DB; + end; +end; + +procedure TFormDigikeijs.Edit2Change(Sender: TObject); +var erreur : integer; +begin + if index<>0 then + begin + val(Edit2.Text,Feux[index].SR[2].sortie1,erreur); + Maj_DB; + end; +end; + +procedure TFormDigikeijs.Edit3Change(Sender: TObject); +var erreur : integer; +begin + if index<>0 then + begin + val(Edit3.Text,Feux[index].SR[3].sortie1,erreur); + Maj_DB; + end; +end; + +procedure TFormDigikeijs.Edit4Change(Sender: TObject); +var erreur : integer; +begin + if index<>0 then + begin + val(Edit4.Text,Feux[index].SR[4].sortie1,erreur); + Maj_DB; + end; +end; + +procedure TFormDigikeijs.Edit5Change(Sender: TObject); +var erreur : integer; +begin + if index<>0 then + begin + val(Edit5.Text,Feux[index].SR[5].sortie1,erreur); + Maj_DB; + end; +end; + +procedure TFormDigikeijs.Edit6Change(Sender: TObject); +var erreur : integer; +begin + if index<>0 then + begin + val(Edit6.Text,Feux[index].SR[6].sortie1,erreur); + Maj_DB; + end; +end; + +procedure TFormDigikeijs.Edit7Change(Sender: TObject); +var erreur : integer; +begin + if index<>0 then + begin + val(Edit7.Text,Feux[index].SR[7].sortie1,erreur); + Maj_DB; + end; +end; + +procedure TFormDigikeijs.Edit8Change(Sender: TObject); +var erreur : integer; +begin + if index<>0 then + begin + val(Edit8.Text,Feux[index].SR[8].sortie1,erreur); + Maj_DB; + end; +end; + +procedure TFormDigikeijs.Edit9Change(Sender: TObject); +var erreur : integer; +begin + if index<>0 then + begin + val(Edit9.Text,Feux[index].SR[9].sortie1,erreur); + Maj_DB; + end; +end; + +procedure TFormDigikeijs.Edit10Change(Sender: TObject); +var erreur : integer; +begin + if index<>0 then + begin + val(Edit10.Text,Feux[index].SR[10].sortie1,erreur); + Maj_DB; + end; +end; + +procedure TFormDigikeijs.Edit11Change(Sender: TObject); +var erreur : integer; +begin + if index<>0 then + begin + val(Edit11.Text,Feux[index].SR[11].sortie1,erreur); + Maj_DB; + end; +end; + +procedure TFormDigikeijs.Edit12Change(Sender: TObject); +var erreur : integer; +begin + if index<>0 then + begin + val(Edit12.Text,Feux[index].SR[12].sortie1,erreur); + Maj_DB; + end; +end; + +procedure TFormDigikeijs.Edit13Change(Sender: TObject); +var erreur : integer; +begin + if index<>0 then + begin + val(Edit13.Text,Feux[index].SR[13].sortie1,erreur); + Maj_DB; + end; +end; + +procedure TFormDigikeijs.Edit14Change(Sender: TObject); +var erreur : integer; +begin + if index<>0 then + begin + val(Edit14.Text,Feux[index].SR[14].sortie1,erreur); + Maj_DB; + end; +end; + +procedure TFormDigikeijs.Edit15Change(Sender: TObject); +var erreur : integer; +begin + if index<>0 then + begin + val(Edit15.Text,Feux[index].SR[15].sortie1,erreur); + Maj_DB; + end; +end; + +procedure TFormDigikeijs.Edit16Change(Sender: TObject); +var erreur : integer; +begin + if index<>0 then + begin + val(Edit16.Text,Feux[index].SR[16].sortie1,erreur); + Maj_DB; + end; +end; + +procedure TFormDigikeijs.Edit17Change(Sender: TObject); +var erreur : integer; +begin + if index<>0 then + begin + val(Edit17.Text,Feux[index].SR[17].sortie1,erreur); + Maj_DB; + end; +end; + +procedure TFormDigikeijs.Edit18Change(Sender: TObject); +var erreur : integer; +begin + if index<>0 then + begin + val(Edit18.Text,Feux[index].SR[18].sortie1,erreur); + Maj_DB; + end; +end; + +procedure TFormDigikeijs.Edit19Change(Sender: TObject); +var erreur : integer; +begin + if index<>0 then + begin + val(Edit19.Text,Feux[index].SR[19].sortie1,erreur); + Maj_DB; + end; +end; + +end. diff --git a/UnitPilote.dcu b/UnitPilote.dcu index 9f96337..63f5b92 100644 Binary files a/UnitPilote.dcu and b/UnitPilote.dcu differ diff --git a/UnitPrinc.dcu b/UnitPrinc.dcu index ac89ec5..657cd09 100644 Binary files a/UnitPrinc.dcu and b/UnitPrinc.dcu differ diff --git a/UnitPrinc.dfm b/UnitPrinc.dfm index 073f4f0..34e8bdb 100644 --- a/UnitPrinc.dfm +++ b/UnitPrinc.dfm @@ -18,8 +18,8 @@ object FormPrinc: TFormPrinc OnClose = FormClose OnCreate = FormCreate DesignSize = ( - 1197 - 612) + 1205 + 619) PixelsPerInch = 96 TextHeight = 13 object LabelTitre: TLabel @@ -1189,7 +1189,7 @@ object FormPrinc: TFormPrinc end object LabelEtat: TLabel Left = 440 - Top = 16 + Top = 8 Width = 152 Height = 18 Anchors = [akTop, akRight] @@ -1264,8 +1264,8 @@ object FormPrinc: TFormPrinc end object StatusBar1: TStatusBar Left = 0 - Top = 590 - Width = 1197 + Top = 597 + Width = 1205 Height = 22 Panels = <> SimplePanel = True @@ -1441,7 +1441,7 @@ object FormPrinc: TFormPrinc Width = 153 Height = 33 Hint = 'Ecriture CV en mode direct sur voie de programmation' - Caption = 'Ecriture CV - 1 '#224' 255 par bus XpressNet' + Caption = 'Ecriture CV - 1 '#224' 255 par interface' TabOrder = 0 WordWrap = True OnClick = ButtonEcrCVClick @@ -1452,7 +1452,7 @@ object FormPrinc: TFormPrinc Width = 153 Height = 33 Hint = 'Lecture CV en mode direct sur voie de programmation' - Caption = 'Lecture CV - 1 '#224' 255 par le bus XpressNet' + Caption = 'Lecture CV - 1 '#224' 255 par interface' Enabled = False TabOrder = 1 WordWrap = True @@ -1474,7 +1474,7 @@ object FormPrinc: TFormPrinc end end object GroupBox3: TGroupBox - Left = 632 + Left = 736 Top = 64 Width = 265 Height = 129 @@ -1582,6 +1582,24 @@ object FormPrinc: TFormPrinc OnChange = TrackBarVitChange end end + object ButtonEnv: TButton + Left = 1064 + Top = 144 + Width = 113 + Height = 33 + Caption = 'Envoi vers centrale DCC++' + TabOrder = 10 + WordWrap = True + OnClick = ButtonEnvClick + end + object EditEnvoi: TEdit + Left = 928 + Top = 152 + Width = 121 + Height = 21 + TabOrder = 11 + Text = '<1>' + end object Timer1: TTimer Interval = 100 OnTimer = Timer1Timer @@ -1645,12 +1663,12 @@ object FormPrinc: TFormPrinc object Interface1: TMenuItem Caption = 'Interface' object MenuConnecterUSB: TMenuItem - Caption = 'Connecter l'#39'interface XpressNet en USB' + Caption = 'Connecter l'#39'interface en USB' Hint = 'Connecter l'#39'interface en USB (mode autonome)' OnClick = MenuConnecterUSBClick end object DeconnecterUSB: TMenuItem - Caption = 'D'#233'connecter l'#39'interface XpressNet de l'#39'USB' + Caption = 'D'#233'connecter l'#39'interface de l'#39'USB' Hint = 'D'#233'connecter l'#39'interface USB' OnClick = DeconnecterUSBClick end @@ -1658,12 +1676,12 @@ object FormPrinc: TFormPrinc Caption = '-' end object MenuConnecterEthernet: TMenuItem - Caption = 'Connecter l'#39'interface XpressNet en Ethernet' + Caption = 'Connecter l'#39'interface en Ethernet' Hint = 'Connecter l'#39'interface par Ethernet' OnClick = MenuConnecterEthernetClick end object MenuDeconnecterEthernet: TMenuItem - Caption = 'D'#233'connecter l'#39'interface XpressNet de Ethernet' + Caption = 'D'#233'connecter l'#39'interface de Ethernet' Hint = 'D'#233'connecter l'#39'interface par Ethernet' OnClick = MenuDeconnecterEthernetClick end @@ -1671,7 +1689,7 @@ object FormPrinc: TFormPrinc Caption = '-' end object Demanderversiondelacentrale1: TMenuItem - Caption = 'Interface XpressNet:' + Caption = 'Interface' object Demanderlaversiondelacentrale1: TMenuItem Caption = 'Demander la version de la centrale' OnClick = Demanderlaversiondelacentrale1Click diff --git a/UnitPrinc.pas b/UnitPrinc.pas index 1f5bc2b..7682475 100644 --- a/UnitPrinc.pas +++ b/UnitPrinc.pas @@ -10,7 +10,7 @@ Unit UnitPrinc; - 1 = aiguillage dévié = sortie 1 de l'adresse d'accessoire *) -// en mode simulation run: +// en mode simulation run: // CDM ne renvoie pas les détecteurs au départ du RUN. // il ne renvoie pas non plus le nom des trains sur les actionneurs // les noms des trains sont bien renvoyés sur les détecteurs à 1 @@ -33,7 +33,7 @@ interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, OleCtrls, ExtCtrls, jpeg, ComCtrls, ShellAPI, TlHelp32, - ImgList, ScktComp, StrUtils, Menus, ActnList, MSCommLib_TLB, MMSystem ; + ImgList, ScktComp, StrUtils, Menus, ActnList, MSCommLib_TLB, MMSystem ; type TFormPrinc = class(TForm) @@ -137,6 +137,8 @@ type Demandetataccessoires1: TMenuItem; LancerCDMrail1: TMenuItem; TrackBarVit: TTrackBar; + ButtonEnv: TButton; + EditEnvoi: TEdit; procedure FormCreate(Sender: TObject); procedure MSCommUSBLenzComm(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); @@ -204,6 +206,7 @@ type procedure LancerCDMrail1Click(Sender: TObject); procedure TrackBarVitChange(Sender: TObject); procedure EditVitesseChange(Sender: TObject); + procedure ButtonEnvClick(Sender: TObject); private { Déclarations privées } procedure DoHint(Sender : Tobject); @@ -244,10 +247,10 @@ Max_Event_det_tick=30000; EtatSign : array[0..13] of string[20] =('carré','sémaphore','sémaphore cli','vert','vert cli','violet', 'blanc','blanc cli','jaune','jaune cli','ral 30','ral 60','rappel 30','rappel 60'); NbDecodeur = 8; -decodeur : array[0..NbDecodeur-1] of string[20] =('rien','Digital Bahn','CDF','LDT','LEB','NMRA','Unisemaf Paco','SR'); -Etats : array[0..19] of string[30]=('Non commandé','carré','sémaphore','sémaphore cli','vert','vert cli','violet', - 'blanc','blanc cli','jaune','jaune cli','ralen 30','ralen 60','ralen 60 + jaune cli','rappel 30','rappel 60', - 'rappel 30 + jaune','rappel 30 + jaune cli','rappel 60 + jaune','rappel 60 + jaune cli'); +decodeur : array[0..NbDecodeur-1] of string[20] =('rien','Digital Bahn','CDF','LDT','LEB','Digikeijs 4018','Unisemaf Paco','SR'); +Etats : array[0..19] of string[30]=('Non commandé', + 'carré','sémaphore','sémaphore cli','vert','vert cli','violet','blanc','blanc cli','jaune','jaune cli', + 'ralen 30','ralen 60','ralen 60 + jaune cli','rappel 30','rappel 60','rappel 30 + jaune','rappel 30 + jaune cli','rappel 60 + jaune','rappel 60 + jaune cli'); type Taccessoire = (aigP,feu); // aiguillage ou feu @@ -306,7 +309,7 @@ TFeu = record FeuVertCli : boolean ; // avec checkbox ou pas FeuRougeCli : boolean ; // avec checkbox ou pas FeuBlanc : boolean ; // avec checkbox ou pas - decodeur : integer; // type du décodeur // 'rien','Digital Bahn','CDF','LDT','LEB','NMRA','Unisemaf','SR' + decodeur : integer; // type du décodeur // 'rien','Digital Bahn','CDF','LDT','LEB','Digikeijs','Unisemaf','SR' Adr_det1 : integer; // adresse du détecteur1 sur lequel il est implanté Adr_det2 : integer; // adresse du détecteur2 sur lequel il est implanté (si un signal est pour plusieurs voies) Adr_det3 : integer; // adresse du détecteur3 sur lequel il est implanté (si un signal est pour plusieurs voies) @@ -323,7 +326,7 @@ TFeu = record modifie : boolean; // feu modifié EtatSignal : word ; // état du signal AncienEtat : word ; // ancien état du signal - UniSemaf : integer ; // définition supplémentaire de la cible pour les décodeurs UNISEMAF + UniSemaf : integer ; // définition supplémentaire de la cible pour les décodeurs UNISEMAF ou du préréglage pour digikeijs AigDirection : array[1..7] of array of record // pour les signaux directionnels : contient la liste des aiguillages associés Adresse : integer; // 6 feux max associés à un tableau dynamique décrivant les aiguillages +1 position 0 posAig : char; @@ -333,15 +336,16 @@ TFeu = record Adresse : integer; // aiguillage posAig : char; end; - SR : array[1..8] of record // configuration du décodeur Stéphane Ravaut + SR : array[1..19] of record // configuration du décodeur Stéphane Ravaut : 8 valeurs maxi sortie1,sortie0 : integer; end; + Na : integer; // nombre d'adresses du feu occupées par le décodeur CDF end; var - maxaiguillage,detecteur_chgt,Temps,Tempo_init,Suivant,ntrains, - N_Cv,index_simule,NDetecteurs,N_Trains,N_routes,espY, + maxaiguillage,detecteur_chgt,Temps,Tempo_init,Suivant,ntrains,MaxPortCom, + N_Cv,index_simule,NDetecteurs,N_Trains,N_routes,espY,Tps_affiche_retour_dcc, NbreImagePligne,NbreBranches,Index2_det,Index2_aig,branche_det, I_simule,maxTablo_act,NbreVoies,AdresseFeuSuivant,El_suivant, tempsCli,NbreFeux,pasreponse,AdrDevie,fenetre,Tempo_Aig,Tempo_feu, @@ -349,13 +353,13 @@ var Nbre_recu_cdm,Tempo_chgt_feux,Adj1,Adj2,NbrePN,ServeurInterfaceCDM,index_couleur, ServeurRetroCDM,TailleFonte,Nb_Det_Dist,Tdoubleclic,algo_Unisemaf,fA,fB,AdrTrain : integer; - ack,portCommOuvert,traceTrames,AffMem,CDM_connecte,dupliqueEvt, + ack,portCommOuvert,traceTrames,AffMem,CDM_connecte,dupliqueEvt,affiche_retour_dcc, Raz_Acc_signaux,AvecInit,AvecTCO,terminal,Srvc_Aig,Srvc_Det,Srvc_Act,MasqueBandeauTCO, - Srvc_PosTrain,Srvc_Sig,debugtrames,LayParParam,AvecFVR, + Srvc_PosTrain,Srvc_Sig,debugtrames,LayParParam,AvecFVR,InverseMotif, 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, - AvecDemandeInterfaceUSB,AvecDemandeInterfaceEth,aff_acc : boolean; + AvecDemandeInterfaceUSB,AvecDemandeInterfaceEth,aff_acc,affiche_aigdcc : boolean; tick,Premier_tick : longint; @@ -363,8 +367,6 @@ var FormPrinc: TFormPrinc; - tablo : array of byte; // tableau rx usb - Enregistrement,chaine_Envoi,chaine_recue,Id_CDM,Af,version_Interface,entete,suffixe,Lay : string; @@ -518,6 +520,7 @@ implementation uses UnitDebug, verif_version, UnitPilote, UnitSimule, UnitTCO, UnitConfig; +{ procedure menu_interface(MA : TMA); var val : boolean; begin @@ -528,8 +531,9 @@ begin DeConnecterUSB.enabled:=val; MenuConnecterEthernet.enabled:=val; MenuDeConnecterEthernet.enabled:=val; - end; + end; end; +} procedure Tformprinc.DoHint(Sender : Tobject); begin @@ -1218,9 +1222,22 @@ begin RE_ColorLine(FenRich,FenRich.lines.count-1,lacouleur); end; end; + +procedure Affiche_suivi(s : string;lacouleur : TColor); +var i : integer; +begin + with formprinc.FenRich do + begin + i:=lines.Count-1; + s:=lines.Strings[i]+s; + lines.Strings[i]:=s; + RE_ColorLine(Formprinc.FenRich,i,lacouleur); + end; +end; + // renvoie l'index du feu dans le tableau feux[] en fonction de son adresse -//si pas trouvé renvoie 0 +// si pas trouvé renvoie 0 function Index_feu(adresse : integer) : integer; var i : integer; trouve : boolean; @@ -1234,7 +1251,7 @@ begin end; // renvoie l'index de l'aiguillage dans le tableau aiguillages[] en fonction de son adresse -//si pas trouvé renvoie 0 +// si pas trouvé renvoie 0 function Index_Aig(adresse : integer) : integer; var i : integer; trouve : boolean; @@ -1286,7 +1303,7 @@ begin if adrPilote=0 then exit; i:=Index_feu(AdrPilote); if i=0 then exit; - + with Formpilote do begin TFormPilote.Create(Self); // rajouté @@ -1355,8 +1372,8 @@ begin Name:='ImageFeu'+IntToSTR(adresse); // nom de l'image - sert à identifier le composant si on fait clic droit. Top:=(HtImg+espY+20)*((rang-1) div NbreImagePLigne); // détermine les points d'origine 20 Left:=10+ (LargImg+5)*((rang-1) mod (NbreImagePLigne)); //5 - //width:=LargImg; - //Height:=HtImg; + width:=LargImg; + Height:=HtImg; s:='Index='+IntToSTR(rang)+' @='+inttostr(Adresse)+' Décodeur='+intToSTR(feux[rang].Decodeur)+ ' Adresse détecteur associé='+intToSTR(feux[rang].Adr_det1)+ @@ -1370,12 +1387,10 @@ begin // affecter le type d'image de feu dans l'image créée T_BP:=Select_dessin_feu(TypeFeu); picture.Bitmap:=T_Bp; - Width:=T_Bp.width; - Height:=T_Bp.Height; picture.BitMap.TransparentMode:=tmfixed; // tmauto (la couleur transparente est déterminée par pixel le plus en haut à gauche du bitmap) // tmfixed (la couleur transparente est explicitement assignée et stockée dans le bitmap) - Picture.Bitmap.TransparentColor:=clblue; + Picture.Bitmap.TransparentColor:=clblue; // la couleur de transparence est bleue Transparent:=true; // mettre rouge par défaut @@ -1470,13 +1485,17 @@ end; procedure envoi_ss_ack(s : string); var i,timeout,valto : integer; begin - s:=entete+s+suffixe; - if traceTrames then AfficheDebug('Tick='+IntToSTR(tick)+'/Env '+chaine_Hex(s),ClLime); + if protocole=1 then + begin + s:=entete+s+suffixe; + if traceTrames then AfficheDebug('Tick='+IntToSTR(tick)+'/Env '+chaine_Hex(s),ClLime); + end; + if (protocole=2) and TraceTrames then AfficheDebug('Tick='+IntToSTR(tick)+'/Env '+s,ClLime); // par port com-usb if portCommOuvert then begin - if (protocole=4) then // le protocole 4 contrôle simplement la ligne CTS avant de transmettre et temporise octet par octet + if (prot_serie=4) then // le protocole 4 contrôle simplement la ligne CTS avant de transmettre et temporise octet par octet begin i:=1; valto:=10; @@ -1501,30 +1520,30 @@ begin end; // protocole Rts Cts ou sans temporisation - if (protocole=2) or (tempoOctet=0) then + if (prot_serie=2) or (tempoOctet=0) then begin FormPrinc.MSCommUSBLenz.Output:=s; exit; end; - // sans procotole ou xon xoff ou xon-rts - if (protocole=0) or (protocole=1) or (protocole=3) then + // procotole xon xoff ou xon-rts + if (prot_serie=1) or (prot_serie=3) then begin for i:=1 to length(s) do begin FormPrinc.MSCommUSBLenz.Output:=s[i]; - //if terminal then Affiche(s[i],clyellow) else Affiche(chaine_hex(s[i]),clyellow); - Application.ProcessMessages; + //Affiche(s[i],clyellow);// else Affiche(chaine_hex(s[i]),clyellow); Sleep(TempoOctet); end; end; + if (prot_serie=0) then FormPrinc.MSCommUSBLenz.Output:=s; end; // par socket (ethernet) if parSocketLenz then Formprinc.ClientSocketLenz.Socket.SendText(s); end; -// envoi d'une chaîne à la centrale Lenz par USBLenz ou socket, puis attend l'ack ou le nack +// envoi d'une chaîne à l'interface par USB ou socket, puis attend l'ack ou le nack function envoi(s : string) : boolean; var tempo : integer; begin @@ -1542,7 +1561,10 @@ begin until ferme or ack or nack or (tempo>(TimoutMaxInterface*3)); // l'interface répond < 5s en mode normal et 1,5 mn en mode programmation if not(ack) or nack then begin - Affiche('Pas de réponse de l''interface',clRed);inc(pasreponse); + s:='Pas de réponse de l''interface'; + Affiche(s,clRed); + if traceTrames then AfficheDebug(s,clred); + inc(pasreponse); // &&&if pasreponse>3 then hors_tension2:=true; end; if ack then begin pasreponse:=0;hors_tension2:=false;end; @@ -1641,16 +1663,20 @@ var groupe : integer ; fonction : byte; s : string; begin - groupe:=(adresse-1) div 4; - fonction:=((adresse-1) mod 4)*2 + (octet-1); - // pilotage - if etat then - s:=#$52+Char(groupe)+char(fonction or $80) - else - s:=#$52+Char(groupe)+char(fonction or $88); + if protocole=1 then + begin + groupe:=(adresse-1) div 4; + fonction:=((adresse-1) mod 4)*2 + (octet-1); + // pilotage + if etat then + s:=#$52+Char(groupe)+char(fonction or $80) + else + s:=#$52+Char(groupe)+char(fonction or $88); - s:=checksum(s); - envoi(s); // envoi de la trame et attente Ack + s:=checksum(s); + envoi(s); // envoi de la trame et attente Ack + end; + if protocole=2 then Affiche('D1: Commande DCC++ pas encore implantée',clred); end; procedure pilote_direct01(adresse:integer;octet:integer); @@ -1658,17 +1684,21 @@ var groupe : integer ; fonction : byte; s : string; begin - if octet=0 then octet:=2; - groupe:=(adresse-1) div 4; - fonction:=((adresse-1) mod 4)*2 + (octet-1); - // pilotage - if octet=2 then - s:=#$52+Char(groupe)+char(fonction or $80) - else - s:=#$52+Char(groupe)+char(fonction or $88); + if protocole=1 then + begin + if octet=0 then octet:=2; + groupe:=(adresse-1) div 4; + fonction:=((adresse-1) mod 4)*2 + (octet-1); + // pilotage + if octet=2 then + s:=#$52+Char(groupe)+char(fonction or $80) + else + s:=#$52+Char(groupe)+char(fonction or $88); - s:=checksum(s); - if envoi(s) then exit else envoi(s); // envoi de la trame et attente Ack sinon renvoyer + s:=checksum(s); + if envoi(s) then exit else envoi(s); // envoi de la trame et attente Ack sinon renvoyer + end; + if protocole=2 then Affiche('D2: Commande DCC++ pas encore implantée',clred); end; @@ -1678,18 +1708,22 @@ var ah,al,i : integer; begin if portCommOuvert or parSocketLenz then begin - if loco<99 then begin Ah:=0;Al:=loco;end - else begin ah:=((loco and $FF00) + $C000) shr 8;al:=loco and 255;end; - s:=#$E3+#0+char(ah)+char(al); - s:=checksum(s); - fa:=256;fb:=256; - envoi(s); - i:=0; - repeat - inc(i); - Sleep(100); - Application.ProcessMessages; - until (fa<>256) or (i=10); + if protocole=1 then + begin + if loco<99 then begin Ah:=0;Al:=loco;end + else begin ah:=((loco and $FF00) + $C000) shr 8;al:=loco and 255;end; + s:=#$E3+#0+char(ah)+char(al); + s:=checksum(s); + fa:=256;fb:=256; + envoi(s); + i:=0; + repeat + inc(i); + Sleep(100); + Application.ProcessMessages; + until (fa<>256) or (i=10); + end; + if protocole=2 then Affiche('D3: Commande DCC++ pas encore implantée',clred); end; end; @@ -1697,52 +1731,127 @@ end; procedure Fonction_Loco_Operation(loco,fonction,etat : integer); var s : string ; ah,al : integer; - b : byte ; + b,c : byte ; begin if (fonction<0) or (fonction>28) or (loco<0) or (loco>9999) then exit; if portCommOuvert or parSocketLenz then begin - demande_etat_loco(loco); // récupère les états des fonctions Fa=F0 à 4 Fb=F5 à F12 AdrTrain - //Affiche('Train='+IntToSTR(AdrTrain)+' '+IntToHex(fa,2)+' '+IntToHex(fb,2),clyellow); - // en fonction du décodeur, on n'a pas le bon train!! - if (fa<>256) then + if protocole=1 then begin - s:=#$E4; - if fonction<=4 then s:=s+#$20; - if (fonction>=5) and (fonction<=8) then s:=s+#$21; - if (fonction>=9) and (fonction<=12) then s:=s+#$22; - if (fonction>=13) and (fonction<=20) then s:=s+#$23; // 23 non doc - if (fonction>=21) and (fonction<=28) then s:=s+#$28; // 28 non doc - // codification de l'adresse de la loco : doc Xpressnet page 40 (§2.1.15) - if loco<99 then begin Ah:=0;Al:=loco;end - else begin ah:=((loco or $C000) shr 8);al:=loco and 255;end; - s:=s+char(ah)+char(al); - // codification de la fonction : doc Xpressnet page 64 {§2.2.20.5) - if etat<>0 then + demande_etat_loco(loco); // récupère les états des fonctions Fa=F0 à 4 Fb=F5 à F12 AdrTrain + //Affiche('Train='+IntToSTR(AdrTrain)+' '+IntToHex(fa,2)+' '+IntToHex(fb,2),clyellow); + // en fonction du décodeur, on n'a pas le bon train!! + if (fa<>256) then begin - case fonction of - 0 : b:=fa or setbit(0,4); - 1,2,3,4 : b:=fa or setbit(0,fonction-1); // fa est aligné avec l'octet de demande - 5,6,7,8 : b:=fb or setbit(0,fonction-5); // fa est aligné avec l'octet de demande - 9,10,11,12 : b:=(fb shr 4) or setbit(0,fonction-9); // fa est décalé à gauche de 4 avec l'octet de demande + s:=#$E4; + if fonction<=4 then s:=s+#$20; + if (fonction>=5) and (fonction<=8) then s:=s+#$21; + if (fonction>=9) and (fonction<=12) then s:=s+#$22; + if (fonction>=13) and (fonction<=20) then s:=s+#$23; // 23 non doc + if (fonction>=21) and (fonction<=28) then s:=s+#$28; // 28 non doc + // codification de l'adresse de la loco : doc Xpressnet page 40 (§2.1.15) + if loco<99 then begin Ah:=0;Al:=loco;end + else begin ah:=((loco or $C000) shr 8);al:=loco and 255;end; + s:=s+char(ah)+char(al); + // codification de la fonction : doc Xpressnet page 64 {§2.2.20.5) + if etat<>0 then + begin + case fonction of + 0 : b:=fa or setbit(0,4); + 1,2,3,4 : b:=fa or setbit(0,fonction-1); // fa est aligné avec l'octet de demande + 5,6,7,8 : b:=fb or setbit(0,fonction-5); // fa est aligné avec l'octet de demande + 9,10,11,12 : b:=(fb shr 4) or setbit(0,fonction-9); // fa est décalé à gauche de 4 avec l'octet de demande + end; + if (fonction>=13) and (fonction<=20) then b:=(fb shr 8) or setbit(0,fonction-13); // non doc + if (fonction>=21) and (fonction<=28) then b:=(fb shr 8) or setbit(0,fonction-21); // non doc + end + else + begin + case fonction of + 0 : b:=fa and razbit(255,4); // fa est aligné avec l'octet de demande + 1,2,3,4 : b:=fa and razbit(255,fonction-1); // fa est aligné avec l'octet de demande + 5,6,7,8 : b:=fb and razbit(255,fonction-5); + 9,10,11,12 : b:=(fb shr 4) and razbit(255,fonction-9); + end; + if (fonction>=13) and (fonction<=20) then b:=(fb shr 8) or razbit(255,fonction-13); // non doc + if (fonction>=21) and (fonction<=28) then b:=(fb shr 8) or razbit(255,fonction-21); // non doc end; - if (fonction>=13) and (fonction<=20) then b:=(fb shr 8) or setbit(0,fonction-13); // non doc - if (fonction>=21) and (fonction<=28) then b:=(fb shr 8) or setbit(0,fonction-21); // non doc - end - else - begin - case fonction of - 0 : b:=fa and razbit(255,4); // fa est aligné avec l'octet de demande - 1,2,3,4 : b:=fa and razbit(255,fonction-1); // fa est aligné avec l'octet de demande - 5,6,7,8 : b:=fb and razbit(255,fonction-5); - 9,10,11,12 : b:=(fb shr 4) and razbit(255,fonction-9); - end; - if (fonction>=13) and (fonction<=20) then b:=(fb shr 8) or razbit(255,fonction-13); // non doc - if (fonction>=21) and (fonction<=28) then b:=(fb shr 8) or razbit(255,fonction-21); // non doc + s:=s+char(b); + s:=checksum(s); + envoi(s); end; - s:=s+char(b); - s:=checksum(s); - envoi(s); + end; + if protocole=2 then + begin + c:=0; + if fonction<=4 then + begin + b:=128; + if etat=1 then + case fonction of + 0 : b:=b+16; + 1 : b:=b+1; + 2 : b:=b+2; + 3 : b:=b+4; + 4 : b:=b+8; + end; + end; + if (fonction>=5) and (fonction<=8) then + begin + b:=176; + if etat=1 then + case fonction of + 5 : b:=b+1; + 6 : b:=b+2; + 7 : b:=b+4; + 8 : b:=b+8; + end; + end; + if (fonction>=9) and (fonction<=12) then + begin + b:=160; + if etat=1 then + case fonction of + 9 : b:=b+1; + 10 : b:=b+2; + 11 : b:=b+4; + 12 : b:=b+8; + end; + end; + if (fonction>=13) and (fonction<=20) then + begin + b:=222; + if etat=1 then + case fonction of + 13 : c:=1; + 14 : c:=2; + 15 : c:=4; + 16 : c:=8; + 17 : c:=16; + 18 : c:=32; + 19 : c:=64; + 20 : c:=128; + end; + end; + if (fonction>=21) and (fonction<=28) then + begin + b:=223; + if etat=1 then + case fonction of + 21 : c:=1; + 22 : c:=2; + 23 : c:=4; + 24 : c:=8; + 25 : c:=16; + 26 : c:=32; + 27 : c:=64; + 28 : c:=128; + end; + end; + s:='<'+intToSTR(loco)+' '+intToSTR(b); + if c<>0 then s:=s+' '+inttostr(c); + s:=s+'>'; + envoi_ss_ack(s); // pas d'ack sur les fonctions F end; end; end; @@ -1756,28 +1865,32 @@ begin if (fonction<0) or (fonction>28) or (loco<0) or (loco>9999) then exit; if portCommOuvert or parSocketLenz then begin - s:=#$E4; - case fonction of - 0,1,2,3,4 : s:=s+#$24; - 5,6,7,8 : s:=s+#$25; - 9,10,11,12 : s:=s+#$26; - 13,14,15,16 : s:=s+#$27; // non doc + if protocole=1 then + begin + s:=#$E4; + case fonction of + 0,1,2,3,4 : s:=s+#$24; + 5,6,7,8 : s:=s+#$25; + 9,10,11,12 : s:=s+#$26; + 13,14,15,16 : s:=s+#$27; // non doc + end; + // codification de l'adresse de la loco : doc Xpressnet page 40 (§2.1.15) + if loco<99 then begin Ah:=0;Al:=loco;end + else begin ah:=((loco and $FF00) + $C000) shr 8;al:=loco and 255;end; + s:=s+char(ah)+char(al); + // codification de la fonction : doc Xpressnet page 64 {§2.2.20.5) + case fonction of + 0 : b:=setbit(0,4); + 1,2,3,4 : b:=setbit(0,fonction-1); + 5,6,7,8 : b:=setbit(0,fonction-5); + 9,10,11,12 : b:=setbit(0,fonction-9); + 13,14,15,16 : b:=setbit(0,fonction-13); // non doc + end; + s:=s+char(b); + s:=checksum(s); + envoi(s); end; - // codification de l'adresse de la loco : doc Xpressnet page 40 (§2.1.15) - if loco<99 then begin Ah:=0;Al:=loco;end - else begin ah:=((loco and $FF00) + $C000) shr 8;al:=loco and 255;end; - s:=s+char(ah)+char(al); - // codification de la fonction : doc Xpressnet page 64 {§2.2.20.5) - case fonction of - 0 : b:=setbit(0,4); - 1,2,3,4 : b:=setbit(0,fonction-1); - 5,6,7,8 : b:=setbit(0,fonction-5); - 9,10,11,12 : b:=setbit(0,fonction-9); - 13,14,15,16 : b:=setbit(0,fonction-13); // non doc - end; - s:=s+char(b); - s:=checksum(s); - envoi(s); + if protocole=2 then Affiche('D5: Commande DCC++ pas encore implantée',clred); end; end; @@ -1787,17 +1900,25 @@ var s : string; begin if portCommOuvert or parSocketLenz then begin - if sens then vitesse:=vitesse or 128; - s:=#$e4+#$13+#$0+char(loco)+char(vitesse); - s:=checksum(s); - envoi(s); + if protocole=1 then + begin + if sens then vitesse:=vitesse or 128; + s:=#$e4+#$13+#$0+char(loco)+char(vitesse); + s:=checksum(s); + envoi(s); + end; + if protocole=2 then + begin + s:=''; + envoi(s); + end; end; if cdm_connecte then begin s:=chaine_CDM_vitesseST(vitesse,nom_train); // par nom du train //s:=chaine_CDM_vitesseINT(vitesse,loco); // par adresse du train envoi_CDM(s); - //affiche(s,clLime); + //affiche(s,clLime); end; end; @@ -1815,7 +1936,7 @@ begin begin if aspect<>-1 then s:=s+'+'; s:=s+etatSign[combine]; - end; + end; end; chaine_signal:=s; end; @@ -1992,29 +2113,187 @@ envoie les donn ===========================================================================*} procedure envoi_CDF(adresse : integer); var - code,aspect,combine : integer; - i : integer; + combine,aspect,code : integer; + i,nombre : integer; s : string; + + procedure ecrire(v : integer); + var j : integer; + begin + // bit 0 + if nombre>0 then + begin + if (v and 1)=0 then j:=1 else j:=2; + pilote_acc(adresse,j,feu); + end; + + // bit 1 + if nombre>1 then + begin + if (v and 2)=0 then j:=1 else j:=2; + pilote_acc(adresse+1,j,feu); + end; + + // bit 2 + if nombre>2 then + begin + if (v and 4)=0 then j:=1 else j:=2; + pilote_acc(adresse+2,j,feu); + end; + + // bit 3 + if nombre>3 then + begin + if (v and 8)=0 then j:=1 else j:=2; + pilote_acc(adresse+3,j,feu); + end; + end; + + procedure ecrire_2(v : integer); + var j,bit2 : integer; + begin + // bit 0-1 (adresse) + if nombre>0 then + begin + bit2:=v and 3; + if bit2=0 then + begin + // raz les 2 bits + Pilote_acc0_X(adresse,1);Pilote_acc0_X(adresse,2); + end; + if bit2=1 then pilote_acc(adresse,1,feu); + if bit2=2 then pilote_acc(adresse,2,feu); + end; + + // bit 2-3 (adresse+1) + if nombre>1 then + begin + inc(adresse); + bit2:=v and $c; // 1100 + if bit2=0 then + begin + // raz les 2 bits + Pilote_acc0_X(adresse,1);Pilote_acc0_X(adresse,2); + end; + if bit2=4 then pilote_acc(adresse,1,feu); + if bit2=8 then pilote_acc(adresse,2,feu); + end; + + // bit 4-5 (adresse+2) + if nombre>2 then + begin + inc(adresse); + bit2:=v and $30; // 11 0000 + if bit2=0 then + begin + // raz les 2 bits + Pilote_acc0_X(adresse,1);Pilote_acc0_X(adresse,2); + end; + if bit2=16 then pilote_acc(adresse,1,feu); + if bit2=32 then pilote_acc(adresse,2,feu); + end; + + // bit 6-7 (adresse+3) + if nombre>3 then + begin + inc(adresse); + bit2:=v and $c0; // 1100 0000 + if bit2=0 then + begin + // raz les 2 bits + Pilote_acc0_X(adresse,1);Pilote_acc0_X(adresse,2); + end; + if bit2=64 then pilote_acc(adresse,1,feu); + if bit2=128 then pilote_acc(adresse,2,feu); + end; + end; + + procedure ecrire_3(v : integer); + var bit2 : integer; + begin + // adresse+0 + if (nombre>0) then + begin + bit2:=v and 3; //0000 0011 + if bit2<>0 then + begin + pilote_acc(adresse,bit2,feu); + exit; + end; + end; + + // adresse+1 + if (nombre>1) then + begin + bit2:=v and $c; //0000 1100 + if bit2<>0 then + begin + pilote_acc(adresse+1,bit2 shr 2,feu); + exit; + end; + end; + + // adresse+2 + if (nombre>2) then + begin + bit2:=v and $30; //0011 0000 + if bit2<>0 then + begin + pilote_acc(adresse+2,bit2 shr 4,feu); + exit; + end; + end; + + // adresse+3 + if (nombre>3) then + begin + bit2:=v and $c0; //1100 0000 + if bit2<>0 then + begin + pilote_acc(adresse+3,bit2 shr 6,feu); + end; + end; + end; + begin i:=index_feu(adresse); if (feux[i].AncienEtat<>feux[i].EtatSignal) then //; && (stop_cmd==FALSE)) begin code:=feux[i].EtatSignal; + nombre:=feux[i].Na; // nombre d'adresses occupées par le signal code_to_aspect(code,aspect,combine); s:='Signal CDF: ad'+IntToSTR(adresse)+'='+chaine_signal(code); if traceSign then affiche(s,clOrange); if Affsignal then afficheDebug(s,clOrange); - if (aspect=carre) then pilote_acc(adresse,2,feu) ; - if (aspect=semaphore) then pilote_acc(adresse,1,feu) ; - if (aspect=vert) then pilote_acc(adresse+1,1,feu) ; - if (aspect=jaune) then pilote_acc(adresse+1,2,feu); - // signalisation non combinée rappel 30 seul - if (combine=rappel_30) then pilote_acc(adresse+1,1,feu); - - // signalisation combinée - rappel 30 + avertissement - à tester...... - if (Combine=-1) then pilote_acc(adresse+2,1,feu) ; // éteindre rappel 30 - if (Combine=rappel_30) then pilote_acc(adresse+2,2,feu) ; // allumer rappel 30 + if combine=-1 then + case aspect of + carre : ecrire_3(Feux[i].SR[1].sortie1); + semaphore : ecrire_3(Feux[i].SR[2].sortie1); + semaphore_cli : ecrire_3(Feux[i].SR[3].sortie1); + vert : ecrire_3(Feux[i].SR[4].sortie1); + vert_cli : ecrire_3(Feux[i].SR[5].sortie1); + violet : ecrire_3(Feux[i].SR[6].sortie1); + blanc : ecrire_3(Feux[i].SR[7].sortie1); + blanc_cli : ecrire_3(Feux[i].SR[8].sortie1); + jaune : ecrire_3(Feux[i].SR[9].sortie1); + jaune_cli : ecrire_3(Feux[i].SR[10].sortie1); + end; + if aspect=-1 then + case combine of + ral_30 : ecrire_3(Feux[i].SR[11].sortie1); + ral_60 : ecrire_3(Feux[i].SR[12].sortie1); + rappel_30 : ecrire_3(Feux[i].SR[14].sortie1); + rappel_60 : ecrire_3(Feux[i].SR[15].sortie1); + end; + if (aspect<>-1) and (combine<>-1) then + begin + if (Combine=ral_60) and (aspect=jaune_cli) then ecrire_3(Feux[i].SR[13].sortie1); + if (Combine=rappel_30) and (aspect=jaune) then ecrire_3(Feux[i].SR[16].sortie1); + if (Combine=rappel_30) and (aspect=jaune_cli) then ecrire_3(Feux[i].SR[17].sortie1); + if (Combine=rappel_60) and (aspect=jaune) then ecrire_3(Feux[i].SR[18].sortie1); + if (Combine=rappel_60) and (aspect=jaune_cli) then ecrire_3(Feux[i].SR[19].sortie1); + end; end; end; @@ -2754,7 +3033,7 @@ begin if (aspect=blanc) then begin pilote_acc(adresse+2,2,feu);sleep(tempo_Feu);pilote_acc(adresse,2,feu);end; if (aspect=semaphore) then begin pilote_acc(adresse+2,2,feu);sleep(tempo_Feu);pilote_acc(adresse+1,1,feu);end; if (combine=aspect8) then begin pilote_acc(adresse+2,2,feu);sleep(tempo_Feu);pilote_acc(adresse+1,2,feu);end; - if (combine=ral_60) and (aspect=jaune_cli) + if (combine=ral_60) and (aspect=jaune_cli) then begin pilote_acc(adresse+3,1,feu);sleep(tempo_Feu);pilote_acc(adresse,1,feu);end; // demande groupe 3 if (aspect=vert_cli) then begin pilote_acc(adresse+3,1,feu);sleep(tempo_Feu);pilote_acc(adresse,2,feu);end; // demande groupe 3 if (combine=Disque_D) then begin pilote_acc(adresse+3,1,feu);sleep(tempo_Feu);pilote_acc(adresse+1,1,feu);end;// demande groupe 3 @@ -2785,6 +3064,85 @@ begin end; end; +// inverse l'ordre des bits dans un octet +function inverse(b : byte) : byte; +var r : byte; +begin + r:= ((b and $80) shr 7); + r:=r or ((b and $40) shr 5); + r:=r or ((b and $20) shr 3); + r:=r or ((b and $10) shr 2); + r:=r or ((b and $08) shl 1); + r:=r or ((b and $04) shl 3); + r:=r or ((b and $02) shl 5); + r:=r or ((b and $01) shl 7); + inverse:=r; +end; + +// envoie les données au digikeijs 4018 +procedure digi_4018(adresse : integer); + procedure ecrire(v : integer); + var j : integer; + begin + if InverseMotif then v:=inverse(v); + // bit 0 + if (v and 1)=0 then j:=1 else j:=2; + pilote_acc(adresse,j,feu); + + // bit 1 + if (v and 2)=0 then j:=1 else j:=2; + pilote_acc(adresse+1,j,feu); + + // bit 2 + if (v and 4)=0 then j:=1 else j:=2; + pilote_acc(adresse+2,j,feu); + end; + +var + combine,aspect,code : integer; + i : integer; + s : string; +begin + i:=index_feu(adresse); + if (feux[i].AncienEtat<>feux[i].EtatSignal) then //; && (stop_cmd==FALSE)) + begin + code:=feux[i].EtatSignal; + code_to_aspect(code,aspect,combine); + s:='Signal digikeijs 4018: ad'+IntToSTR(adresse)+'='+chaine_signal(code); + if traceSign then affiche(s,clOrange); + if Affsignal then afficheDebug(s,clOrange); + + if combine=-1 then + case aspect of + carre : ecrire(Feux[i].SR[1].sortie1); + semaphore : ecrire(Feux[i].SR[2].sortie1); + semaphore_cli : ecrire(Feux[i].SR[3].sortie1); + vert : ecrire(Feux[i].SR[4].sortie1); + vert_cli : ecrire(Feux[i].SR[5].sortie1); + violet : ecrire(Feux[i].SR[6].sortie1); + blanc : ecrire(Feux[i].SR[7].sortie1); + blanc_cli : ecrire(Feux[i].SR[8].sortie1); + jaune : ecrire(Feux[i].SR[9].sortie1); + jaune_cli : ecrire(Feux[i].SR[10].sortie1); + end; + if aspect=-1 then + case combine of + ral_30 : ecrire(Feux[i].SR[11].sortie1); + ral_60 : ecrire(Feux[i].SR[12].sortie1); + rappel_30 : ecrire(Feux[i].SR[14].sortie1); + rappel_60 : ecrire(Feux[i].SR[15].sortie1); + end; + if (aspect<>-1) and (combine<>-1) then + begin + if (Combine=ral_60) and (aspect=jaune_cli) then ecrire(Feux[i].SR[13].sortie1); + if (Combine=rappel_30) and (aspect=jaune) then ecrire(Feux[i].SR[16].sortie1); + if (Combine=rappel_30) and (aspect=jaune_cli) then ecrire(Feux[i].SR[17].sortie1); + if (Combine=rappel_60) and (aspect=jaune) then ecrire(Feux[i].SR[18].sortie1); + if (Combine=rappel_60) and (aspect=jaune_cli) then ecrire(Feux[i].SR[19].sortie1); + end; + end; +end; + (*========================================================================== envoie les données au décodeur digitalbahn équipé du logiciel "led_signal_10" adresse=adresse sur le bus @@ -2822,7 +3180,7 @@ begin // si état demandé du signal=jaune ou cli jau:=TestBit(code,jaune) or TestBit(code,jaune_cli) ; - //effacement du signal combiné par sémaphore suivant condition + // effacement du signal combiné par sémaphore suivant condition if (((Ancralrap and not(ralrap)) or (Ancjau and not(jau))) and (aspect>=8)) then begin Sleep(40); @@ -2834,7 +3192,7 @@ begin // affichage du premier aspect du signal(1er bit à 1 dans codebin if aspect<>-1 then pilote_acc(adresse+aspect,2,feu) ; - // affichage de la signalisation combinée + // affichage de la signalisation combinée if (Combine<>-1) then begin sleep(40); @@ -2843,7 +3201,7 @@ begin end; end; -// pilotage d'un signal , et mise à jour du graphisme du feu dans les 3 fenetres +// pilotage d'un signal, et mise à jour du graphisme du feu dans les 3 fenetres procedure envoi_signal(Adr : integer); var i,adresse,det,a,b,aspect,x,y,x0,y0,TailleX,TailleY,Orientation : integer; ImageFeu : TImage; @@ -2870,7 +3228,7 @@ begin 2 : envoi_CDF(Adr); 3 : envoi_LDT(Adr); 4 : envoi_LEB(Adr); - 5 : envoi_NMRA(Adr); + 5 : digi_4018(Adr); 6 : envoi_UniSemaf(Adr); 7 : envoi_SR(Adr); end; @@ -2909,60 +3267,59 @@ begin end; - - feux[i].AncienEtat:=feux[i].EtatSignal; - // allume les signaux du feu dans la fenêtre de droite - Dessine_feu_mx(Feux[i].Img.Canvas,0,0,1,1,adr,1); + feux[i].AncienEtat:=feux[i].EtatSignal; - // allume les signaux du feu dans le TCO - if formTCO.Showing then - begin - for y:=1 to NbreCellY do - for x:=1 to NbreCellX do + // 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 formTCO.Showing then + begin + for y:=1 to NbreCellY do + for x:=1 to NbreCellX do + begin + if TCO[x,y].Bimage=30 then begin - if TCO[x,y].Bimage=30 then + adresse:=TCO[x,y].adresse; // vérifie si le feu existe dans le TCO + aspect:=feux[index_feu(adresse)].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; + 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 + 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 - adresse:=TCO[x,y].adresse; // vérifie si le feu existe dans le TCO - aspect:=feux[index_feu(adresse)].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; - 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 - 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; + 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; // pilotage des signaux @@ -4173,7 +4530,7 @@ var suiv1,indexBranche_det1,indexBranche_det2,branche_det2,branche_det1, if (suiv_pointe=prec) and ((typ=aig) or (typ=triple)) then begin // faire le droit - if afdeb then afficheDebug('251. Aig '+intToSTR(suiv)+' test en pointe droit',clyellow); + if afdeb then afficheDebug('251. Aig '+intToSTR(suiv)+' test en pointe droit',clyellow); type_Dernier:=aig; aig_ext(suiv,'D',suiv_2,type_tmp); if type_tmp<>'Z' then aig_suiv(suiv,suiv_2) else @@ -5215,7 +5572,6 @@ begin 2 : envoi_DirectionCDF(Adr,nbre); //3 : envoi_DirectionLDT(Adr,nbre); 4 : envoi_DirectionLEB(Adr,nbre); - //5 : envoi_DirectionNMRA(Adr,nbre); end; end; @@ -6008,7 +6364,7 @@ begin begin zone_TCO(det2,det3,0); // désactivation // activation - if ModeCouleurCanton=0 then zone_TCO(det3,AdrSuiv,1) + if ModeCouleurCanton=0 then zone_TCO(det3,AdrSuiv,1) else zone_TCO(det3,AdrSuiv,2); // affichage avec la couleur de index_couleur du train end; // mettre à jour le feu de det3 pour le passer au rouge de suite @@ -6159,25 +6515,32 @@ begin AfficheDebug('4. Nouveau Tampon train '+intToStr(N_trains)+'--------',clyellow); AfficheDebug(intToSTR(event_det_train[N_trains].det[1]),clyellow ); end; - end; + end; end; // demande l'état d'un accessoire à la centrale. Le résultat sera réceptionné sur évènement des informations // de rétrosignalisation. -procedure demande_info_acc(adresse : integer); +procedure demande_info_acc_XpressNet(adresse : integer); var s : string; n : byte; begin // uniquement si connecté directement à la centrale if portCommOuvert or parSocketLenz then begin - s:=#$42+char((adresse-1) div 4); - n:=((adresse-1) mod 4) div 2; // N=0 ou 1 - //AfficheDebug(intToSTR(adresse)+' '+intToSTR(n),ClWhite); - n:=$80 or n; - s:=s+char(n); - s:=checksum(s); - envoi(s); + if protocole=1 then + begin + s:=#$42+char((adresse-1) div 4); + n:=((adresse-1) mod 4) div 2; // N=0 ou 1 + //AfficheDebug(intToSTR(adresse)+' '+intToSTR(n),ClWhite); + n:=$80 or n; + s:=s+char(n); + s:=checksum(s); + envoi(s); + end; + if protocole=2 then + begin + Affiche('Erreur demande info accessoire '+intToSTR(adresse)+' non traitée en dcc+',clred); + end; end; end; @@ -6189,16 +6552,26 @@ begin if portCommOuvert or parSocketLenz then begin Affiche('Demande état des aiguillages',ClYellow); - for i:=1 to maxaiguillage do + if protocole=1 then begin - model:=aiguillage[i].modele ; - if (model<>rien) and (model<>crois) then + for i:=1 to maxaiguillage do begin - adresse:=aiguillage[i].Adresse; - Affiche('Demande état aiguillage '+intToSTR(adresse),clLime); - demande_info_acc(adresse); + model:=aiguillage[i].modele ; + if (model<>rien) and (model<>crois) then + begin + adresse:=aiguillage[i].Adresse; + + Affiche('Demande état aiguillage '+intToSTR(adresse),clLime); + demande_info_acc_XpressNet(adresse); + end; end; end; + if protocole=2 then + begin + affiche_aigdcc:=true; + envoi(''); + affiche_aigdcc:=false; + end; end; end; @@ -6568,18 +6941,28 @@ begin end; end; -// pilote une sortie à 0 à l'interface en Xpressnet dont l'adresse est à octet +// pilote une sortie à 0 à l'interface dont l'adresse est à 1 ou 2 (octet) procedure Pilote_acc0_X(adresse : integer;octet : byte); var groupe : integer ; fonction : byte; s : string; begin - if debug_dec_sig then AfficheDebug('Tick='+IntToSTR(Tick)+' signal '+intToSTR(adresse)+' '+intToSTR(octet),clorange); - groupe:=(adresse-1) div 4; - fonction:=((adresse-1) mod 4)*2 + (octet-1); - s:=#$52+Char(groupe)+char(fonction or $80); // désactiver la sortie - s:=checksum(s); - envoi(s); // envoi de la trame à l'interface et attente Ack + if (portCommOuvert or parSocketLenz) then + begin + if debug_dec_sig then AfficheDebug('Tick='+IntToSTR(Tick)+' signal '+intToSTR(adresse)+' '+intToSTR(octet)+' à 0',clorange); + if protocole=1 then + begin + groupe:=(adresse-1) div 4; + fonction:=((adresse-1) mod 4)*2 + (octet-1); + s:=#$52+Char(groupe)+char(fonction or $80); // désactiver la sortie + s:=checksum(s); + envoi(s); // envoi de la trame à l'interface et attente Ack + end; + if protocole=2 then + begin + //la RAZ d'une sortie n'existe pas en DCC+! + end; + end; end; // pilotage d'un accessoire (décodeur d'aiguillage, de signal) @@ -6607,7 +6990,7 @@ begin end; // pilotage par CDM rail ----------------- - if CDM_connecte then + if CDM_connecte then begin //AfficheDebug(intToSTR(adresse),clred); if debug_dec_sig and (acc=feu) then AfficheDebug('Tick='+IntToSTR(Tick)+' signal '+intToSTR(adresse)+' '+intToSTR(pilotage),clorange); @@ -6625,39 +7008,53 @@ begin exit; end; + if (pilotage=0) or (pilotage>2) then exit; + // pilotage par USB ou par éthernet de la centrale ------------ if (hors_tension2=false) and (portCommOuvert or parSocketLenz) then begin - if (pilotage=0) or (pilotage>2) then exit; - - groupe:=(adresse-1) div 4; - fonction:=((adresse-1) mod 4)*2 + (pilotage-1); - // pilotage à 1 - s:=#$52+Char(groupe)+char(fonction or $88); // activer la sortie - s:=checksum(s); - if debug_dec_sig and (acc=feu) then AfficheDebug('Tick='+IntToSTR(Tick)+' signal '+intToSTR(adresse)+' '+intToSTR(pilotage),clorange); - envoi(s); // envoi de la trame et attente Ack - event_aig(adresse,pilotage); - - // si l'accessoire est un feu et sans raz des signaux, sortir - if (acc=feu) and not(Raz_Acc_signaux) then exit; - - // si aiguillage, faire une temporisation - //if (index_feu(adresse)=0) or (Acc=aig) then - if Acc=AigP then + if protocole=1 then begin - temp:=aiguillage[index].temps;if temp=0 then temp:=4; - if portCommOuvert or parSocketLenz then tempo(temp); - end; - //sleep(50); - // pilotage à 0 pour éteindre le pilotage de la bobine du relais - s:=#$52+Char(groupe)+char(fonction or $80); // désactiver la sortie - s:=checksum(s); - if debug_dec_sig and (acc=feu) then AfficheDebug('Tick='+IntToSTR(Tick)+' signal '+intToSTR(adresse)+' 0',clorange); - envoi(s); // envoi de la trame et attente Ack - exit; - end; + groupe:=(adresse-1) div 4; + fonction:=((adresse-1) mod 4)*2 + (pilotage-1); + // pilotage à 1 + s:=#$52+Char(groupe)+char(fonction or $88); // activer la sortie + s:=checksum(s); + if debug_dec_sig and (acc=feu) then AfficheDebug('Tick='+IntToSTR(Tick)+' signal '+intToSTR(adresse)+' '+intToSTR(pilotage),clorange); + envoi(s); // envoi de la trame et attente Ack + event_aig(adresse,pilotage); + // si l'accessoire est un feu et sans raz des signaux, sortir + if (acc=feu) and not(Raz_Acc_signaux) then exit; + + // si aiguillage, faire une temporisation + //if (index_feu(adresse)=0) or (Acc=aig) then + if Acc=AigP then + begin + temp:=aiguillage[index].temps;if temp=0 then temp:=4; + if portCommOuvert or parSocketLenz then tempo(temp); + end; + //sleep(50); + // pilotage à 0 pour éteindre le pilotage de la bobine du relais + s:=#$52+Char(groupe)+char(fonction or $80); // désactiver la sortie + s:=checksum(s); + if debug_dec_sig and (acc=feu) then AfficheDebug('Tick='+IntToSTR(Tick)+' signal '+intToSTR(adresse)+' 0',clorange); + envoi(s); // envoi de la trame et attente Ack + exit; + end; + if protocole=2 then + begin + event_aig(adresse,pilotage); + // en pilotage, on envoie que l'ID cad l'adresse - 0=droit 1=dévié + if pilotage=const_devie then fonction:=1; + if pilotage=const_droit then fonction:=0; + //affiche_retour_DCC:=true; + s:=''; + //Affiche(s,clYellow); + envoi(s); + exit; + end; + end; // pas de centrale et pas CDM connecté: on change la position de l'aiguillage if acc=aigP then event_aig(adresse,octet); end; @@ -6665,7 +7062,7 @@ end; // le décodage de la rétro est appelé sur une réception d'une trame de la rétrosignalisation de la centrale. // On déclenche ensuite les évènements détecteurs ou aiguillages. -procedure decode_retro(adresse,valeur : integer); +procedure decode_retro_XpressNet(adresse,valeur : integer); var s : string; adraig,bitsITT,i : integer; begin @@ -6799,9 +7196,211 @@ begin end; end; +// renvoi le nombre de paramètres dans une chaine DCC++ entre le premier < > +function nombre_parametres(s : string) : integer; +var i,j,n : integer; +begin + i:=1;n:=0; + j:=pos('>',s); + repeat + i:=posEx(' ',s,i); + if i<>0 then begin inc(n);inc(i);end; + until (i=0) or (i>j); + result:=n; +end; + +// décodage chaine au protocole DCC (un seul paramètre encadré par < > ) +function decode_chaine_retro_dcc(chaineINT : string) : string; +var i,j,n,adresse,groupe,rang,valeur,erreur : integer; + s : string; +begin + i:=pos('<',chaineINT); + j:=pos('>',chaineINT); + if (i=0) or (j=0) then exit; + + ack:=chaineINT<>''; + //Affiche(chaineINT,clLime); + + if affiche_retour_dcc then + begin + Affiche(chaineINT,clOrange); + end; + + if pos('DCC',chaineINT)<>0 then + begin + version_Interface:=chaineINT; + chaineINT:=''; + exit; + end; + + // réponse écriture eprom + i:=pos('0 then + begin + delete(chaineINT,1,i+2); + val(chaineINT,valeur,erreur); + i:=pos('>',chaineINT); + if i<>0 then delete(chaineINT,1,i); + result:=chaineINT; + exit; + end; + + // eprom vide + i:=pos('<0>',chaineINT); + if i<>0 then + begin + delete(chaineINT,i,i+3); + result:=chaineINT; + exit; + end; + + + // détecteur 0 (Q ID) ou réponse à un détecteur si 3 paramètres (Q ID PIN PULLUP) + i:=pos('0 then + begin + delete(chaineINT,1,i+2); + val(chaineINT,valeur,erreur); + i:=pos('>',chaineINT); + if i=erreur then // 1 seul paramètre + begin + if i<>0 then delete(chaineINT,1,i); + result:=chaineINT; + Event_detecteur(valeur,true,''); // pas de train affecté + exit; + end; + // sinon 3 paramètres + if i<>0 then delete(chaineINT,1,i); + exit; + end; + + // détecteur 1 + i:=pos('0 then + begin + delete(chaineINT,1,i+2); + val(chaineINT,valeur,erreur); + i:=pos('>',chaineINT); + if i<>0 then delete(chaineINT,1,i); + result:=chaineINT; + Event_detecteur(valeur,false,''); // pas de train affecté + exit; + end; + + // réponse à la demande de mise sous tension ou hors tension de la voie + i:=pos('0 then + begin + delete(chaineINT,1,i+1); + val(chaineINT,valeur,erreur); + i:=pos('>',chaineINT); + if i<>0 then delete(chaineINT,1,i); + result:=chaineINT; + exit; + end; + + // Ok + i:=pos('',chaineINT); + if i<>0 then + begin + delete(chaineINT,i,3); + exit; + end; + + // Nok + i:=pos('',chaineINT); + if i<>0 then + begin + delete(chaineINT,i,3); + exit; + end; + + // réponse à un aiguillage ou à leur définition + i:=pos('0 then + begin + // détermine le nombre de paramètres + delete(chaineINT,1,i+1); + n:=nombre_parametres(chaineINT); + if n=4 then // position d'un aiguillage, réponse à + begin + val(chaineINT,adresse,erreur); + delete(chaineINT,1,erreur); + val(chaineINT,groupe,erreur); + delete(chaineINT,1,erreur); + val(chaineINT,rang,erreur); + delete(chaineINT,1,erreur); + val(chaineINT,valeur,erreur); + j:=const_inconnu; + if valeur=0 then j:=const_droit; + if valeur=1 then j:=const_devie; + i:=index_aig(adresse); + if i<>0 then aiguillage[i].position:=j + else affiche('Erreur 70 : Aiguillage '+intToSTR(adresse)+' envoyé par la centrale non défini dans signaux_complexes',clred); + if affiche_aigdcc then + begin + s:='Aiguillage '+intToSTR(adresse)+':'; + if j=const_droit then s:=s+'droit'; + if j=const_devie then s:=s+'devie'; + Affiche(s,clyellow); + end; + end; + i:=pos('>',chaineINT); + if i<>0 then delete(chaineINT,1,i); + result:=chaineINT; + exit; + end; + + // réponse à une demande de vitesse loco + i:=pos(' ou + if i<>0 then + begin + delete(chaineINT,1,i+1); + val(chaineINT,valeur,erreur); + i:=pos('>',chaineINT); + if i<>0 then delete(chaineINT,1,i); + result:=chaineINT; + exit; + end; + + // réponse à la programmation d'un CV + i:=pos('0 then + begin + delete(chaineINT,1,i+1); + j:=pos('|',chaineINT); + j:=posEx('|',chaineINT,j+1); + delete(chaineINT,1,j); + val(chaineINT,valeur,erreur); + tablo_cv[1]:=valeur; + recu_cv:=true; + i:=pos('>',chaineINT); + if i<>0 then delete(chaineINT,1,i); + result:=chaineINT; + exit; + end; + + // réponse aux définitions des sorties + i:=pos('0 then + begin + delete(chaineINT,1,i+2); + val(chaineINT,valeur,erreur); + i:=pos('>',chaineINT); + if i<>0 then delete(chaineINT,1,i); + result:=chaineINT; + exit; + end; + + + if chaineINT<>'' then Affiche('Reçu commande inconnue :'+chaineINT,clred); + chaineINT:=''; + +end; // décodage d'une chaine simple de la rétrosignalisation de la centrale -function decode_chaine_retro(chaineINT : string) : string ; +// en sortie, la chaine chaineINT est supprimée de la partie traitée +function decode_chaine_retro_Xpress(chaineINT : string) : string ; var msg : string; i,cvLoc : integer; begin @@ -6822,7 +7421,7 @@ begin if traceTrames and (chaineINT[2]=#4) then AfficheDebug(msg,clYellow); if traceTrames and (chaineINT[2]<>#4) then AfficheDebug(msg,clRed); delete(chaineINT,1,3); - decode_chaine_retro:=chaineINT; + decode_chaine_retro_Xpress:=chaineINT; exit; end; @@ -6831,8 +7430,8 @@ begin msg:='Version matérielle '+intTohex(ord(chaineINT[2]),2)+' - Version soft '+intToHex(ord(chaineINT[3]),2); Affiche(msg,clYellow); version_Interface:=chaineInt; - delete(chaineINT,1,2); - decode_chaine_retro:=chaineINT; + delete(chaineINT,1,4); + decode_chaine_retro_Xpress:=chaineINT; exit; end; @@ -6852,7 +7451,7 @@ begin end; if nack then affiche(msg,clred) else affiche(msg,clyellow); delete(chaineINT,1,2); - decode_chaine_retro:=chaineINT; + decode_chaine_retro_Xpress:=chaineINT; exit; end; @@ -6871,16 +7470,16 @@ begin end; recu_cv:=true; delete(chaineInt,1,3); - decode_chaine_retro:=chaineINT; + decode_chaine_retro_Xpress:=chaineINT; exit; end; if chaineINT[1]=#$42 then begin delete(chaineInt,1,1); - decode_retro(ord(chaineInt[1]),ord(chaineInt[2])); + decode_retro_XpressNet(ord(chaineInt[1]),ord(chaineInt[2])); delete(chaineInt,1,3); - decode_chaine_retro:=chaineINT; + decode_chaine_retro_Xpress:=chaineINT; exit; end; @@ -6889,7 +7488,7 @@ begin delete(chaineInt,1,2); Affiche('Voie hors tension msg1',clRed); Hors_tension2:=true; - decode_chaine_retro:=chaineINT; + decode_chaine_retro_Xpress:=chaineINT; exit; end; @@ -6898,13 +7497,13 @@ begin delete(chaineInt,1,2); Affiche('Voie hors tension msg2',clRed); Hors_tension2:=false; - decode_chaine_retro:=chaineINT; + decode_chaine_retro_Xpress:=chaineINT; exit; end; if chaineINT[1]=#$46 then begin - //FF FD 46 43 40 41 40 40 49 4D non documentée + //FF FD 46 43 40 41 40 40 49 4D non documentée //FF FD 46 43 50 41 50 40 50 54 non documentée // 46 43 40 41 40 40 48 4C // 46 43 50 41 54 40 50 50 @@ -6912,7 +7511,7 @@ begin Affiche('reprise puissance ',clLime); delete(chaineInt,1,8); Hors_tension2:=false; - decode_chaine_retro:=chaineINT; + decode_chaine_retro_Xpress:=chaineINT; exit; end; @@ -6922,7 +7521,7 @@ begin delete(chaineInt,1,3); Affiche('Reprise msg 2',clOrange); Hors_tension2:=false; - decode_chaine_retro:=chaineINT; + decode_chaine_retro_Xpress:=chaineINT; exit; end; @@ -6930,7 +7529,7 @@ begin begin delete(chaineInt,1,2); Affiche('Court circuit msg 1',clRed); - decode_chaine_retro:=chaineINT; + decode_chaine_retro_Xpress:=chaineINT; exit; end; @@ -6941,31 +7540,49 @@ begin Fa:=ord(chaineInt[4]); // fonction A Fb:=ord(chaineInt[5]); // fonction B delete(chaineInt,1,6); - decode_chaine_retro:=chaineINT; + decode_chaine_retro_Xpress:=chaineINT; exit; end; ack:=false; nack:=true; affiche('Erreur 7, chaîne rétrosig. inconnue recue:'+chaine_HEX(chaineINT),clred); - decode_chaine_retro:=''; + decode_chaine_retro_Xpress:=''; end; // procédure appellée après réception sur le port USB ou socket -procedure interprete_reponse(chaine : string); +// la chaine peut contenir plusieurs informations +// on boucle tant qu'on a pas traitée toute la chaine +function interprete_reponse(chaine : string): string; var chaineInt: string; + i,j : integer; begin chaineINT:=chaine; - while length(chaineINT)>=3 do + if protocole=1 then begin - if length(chaineINT)>4 then + while length(chaineINT)>=3 do begin - // supprimer l'entete éventuelle - if (chaineINT[1]=#$ff) and (chaineINT[2]=#$fe) then Delete(chaineINT,1,2); - if (chaineINT[1]=#$ff) and (chaineINT[2]=#$fd) then Delete(chaineINT,1,2); + if length(chaineINT)>4 then + begin + // supprimer l'entete éventuelle + if (chaineINT[1]=#$ff) and (chaineINT[2]=#$fe) then Delete(chaineINT,1,2); + if (chaineINT[1]=#$ff) and (chaineINT[2]=#$fd) then Delete(chaineINT,1,2); + end; + chaineINT:=decode_chaine_retro_Xpress(chaineINT); end; - chaineINT:=decode_chaine_retro(chaineINT); end; + if protocole=2 then + begin + i:=pos('<',chaineINT); + j:=pos('>',chaineINT); + while (i<>0) and (j<>0) do + begin + chaineINT:=decode_chaine_retro_dcc(chaineINT); + i:=pos('<',chaineINT); + j:=pos('>',chaineINT); + end; + end; + interprete_reponse:=chaineINT; end; function HexToStr(s: string) : string ; @@ -7032,16 +7649,89 @@ begin end; {$J-} -function trouve_USB : integer; -var port,i,j,temp : integer; +procedure envoi_aiguillages_DCCpp; +var adr,groupe,fonction,i : integer; + s :string; +begin + Affiche('Envoi la liste des aiguillages à la centrale DCC++',clyellow); + Affiche('',clyellow); + for i:=1 to MaxAiguillage do + begin + + adr:=aiguillage[i].adresse; + groupe:=((adr-1) div 4)+1; + fonction:=((adr-1) mod 4); + s:=''; + Affiche_suivi(intToSTR(adr)+' ',clyellow); + envoi(s); + end; +end; + +function test_protocole : boolean; +var s: string; + temp : integer; + trouve: boolean; +begin +// voir si le comm ouvert est en protocole xpressnet ou dcc + if portCommOuvert then + begin + if protocole=1 then // Xpressnet + begin + s:=#$f0; + s:=checksum(s); + end; + if protocole=2 then // dcc++ + s:=''; + + envoi_ss_ack(s); + application.processMessages; + + temp:=0; + repeat + sleep(100); + inc(temp); + Application.processmessages; + until (version_Interface<>'') or (temp>15); + + if (temp>15) then + begin + Affiche_suivi(' mais l''interface n''a pas répondu',clyellow); + portCommOuvert:=false; // refermer le port + result:=false; + Formprinc.MSCommUSBLenz.portopen:=false; + end + else + begin + if (protocole=1) and (version_interface[1]=#2) then + begin + Affiche_suivi(' et l''interface a répondu correctement en '+intToSTR(temp)+'00 ms',clLime); + trouve:=true; + result:=true; + end; + if (protocole=2) and (version_interface<>'') then + begin + Affiche_suivi(' et l''interface a répondu correctement en '+intToSTR(temp)+'00 ms',clLime); + trouve:=true; + result:=true; + end; + + if not(trouve) then + begin + Affiche_suivi(s+' mais l''interface a répondu incorrectement',clyellow); + result:=false; + end; + end; + end +end; + +function connecte_port_usb(port : integer) : integer; +var i,j,temp : integer; trouve : boolean; s : string; begin - port:=1; result:=0; trouve:=false; - repeat - With Formprinc.MSCommUSBLenz do + With Formprinc.MSCommUSBLenz do begin //Affiche('Test port com'+intToSTR(port),clyellow); version_interface:=''; @@ -7052,18 +7742,19 @@ begin j:=posEx(',',PortCom,j+1); s:=copy(portCom,i+1,j-i-1); - Settings:=s; // COMx:vitesse,n,8,1 - if protocole>=4 then Handshaking:=0 {0=aucun 1=Xon-Xoff 2=cts 3=RTS-Xon-Xoff 4=5=protocoles "maison"} - else Handshaking:=protocole; + Settings:=s; // vitesse,n,8,1 + if prot_serie>=4 then Handshaking:=0 {0=aucun 1=Xon-Xoff 2=cts 3=RTS-Xon-Xoff 4=5=protocoles "maison"} + else Handshaking:=prot_serie; SThreshold:=1; RThreshold:=1; InputLen:=0; CommPort:=Port; DTREnable:=True; - if protocole=4 then RTSEnable:=True //pour la genli + if prot_serie=4 then RTSEnable:=True //pour la genli else RTSenable:=False; InputMode:=comInputModeBinary; end; + portCommOuvert:=true; try Formprinc.MSCommUSBLenz.portopen:=true; @@ -7071,113 +7762,60 @@ begin portCommOuvert:=false; end; - // voir si le comm ouvert est en protocole lenz - if portCommOuvert then begin - s:=#$f0; - s:=checksum(s); - envoi_ss_ack(s); - application.processMessages; - s:='Port com'+intToSTR(port)+' ouvert '; - - temp:=0; - repeat - sleep(100); - inc(temp); - Application.processmessages; // provoque violation - until (version_Interface<>'') or (temp>2); - - if (temp>2) then - begin - Affiche(s+' mais l''interface n''a pas répondu',clyellow); - portCommOuvert:=false; // refermer le port - Formprinc.MSCommUSBLenz.portopen:=false; - inc(port); - end - else - begin - if version_interface[1]=#2 then - begin - Affiche(s+' et l''interface a répondu correctement',clyellow); - trouve:=true; - result:=port; - end - else - begin - Affiche(s+' mais l''interface a répondu incorrectement',clyellow); - inc(port); - end; - end; - end - else inc(port); - - until (port=10) or trouve; + Affiche('Port COM'+intToSTR(port)+' ouvert',clLime); + sleep(1000); + trouve:=test_protocole; + end; + if trouve then result:=port else result:=0; end; - -// initialisation de la comm USB pour l'interface Xpressnet -procedure connecte_USB; -var i,j : integer; - ConfStCom : string; + +procedure connecte_usb; +var + numport,erreur : integer; + s : string; begin - //traceTrames:=true; - if NumPort<>0 then + if portcommouvert then exit; + numport:=0; + if portcom<>'' then val(portcom[4],numport,erreur); + + if numport=0 then + // scan des ports begin - With Formprinc.MSCommUSBLenz do // MSComm est le composant OCX TMSComm32 - begin - i:=pos(':',portCom); - j:=pos(',',PortCom); - j:=posEx(',',PortCom,j+1); - j:=posEx(',',PortCom,j+1); - j:=posEx(',',PortCom,j+1); - - confStCom:=copy(portCom,i+1,j-i-1); - Settings:=ConfStCom; // vitesse,n,8,1 - Affiche('Demande ouverture interface Xpressnet COM'+intToSTR(NumPort)+':'+ConfStCom+' protocole '+IntToSTR(protocole),CLYellow); - if protocole>=4 then Handshaking:=0 {0=aucun 1=Xon-Xoff 2=cts 3=RTS-Xon-Xoff 4=5=protocoles "maison"} - else Handshaking:=protocole; - SThreshold:=1; - RThreshold:=1; - InputLen:=0; - CommPort:=NumPort; - DTREnable:=True; - if protocole=4 then RTSEnable:=True //pour la genli - else RTSenable:=False; - InputMode:=comInputModeBinary; - end; - - portCommOuvert:=true; - try - Formprinc.MSCommUSBLenz.portopen:=true; - except - portCommOuvert:=false; - end; + numport:=1; + repeat + //Affiche('Test port COM'+intToSTR(numport),clyellow); + With Formprinc.MSCommUSBLenz do + begin + //Affiche('Test port com'+intToSTR(numport),clyellow); + port:=connecte_port_usb(numport); + inc(numport); + end; + until (port<>0) or (numport>MaxPortCom); + end + else port:=connecte_port_usb(numport); + + if port=0 then + begin + s:='Pas d''interface '; + if protocole=1 then s:=s+'XpressNet'; + if protocole=2 then s:=s+'DCC++'; + Affiche(s+' trouvée sur les ports COM de 1 à '+intToSTR(MaxPortCom),clOrange); end - else begin - portCommOuvert:=false; - //Affiche('Détection automatique du port de l''interface Xpressnet',clyellow); - NumPort:=trouve_USB; - portCommOuvert:=NumPort<>0; - end; - - if portCommOuvert then - begin + Formprinc.DeConnecterUSB.enabled:=true; With Formprinc do begin - LabelTitre.caption:=titre+' Interface connectée au COM'+IntToSTR(NumPort); - affiche('Port COM'+intToSTR(NumPort)+' ouvert',clGreen); - MenuConnecterUSB.enabled:=false; - DeConnecterUSB.enabled:=true; - ConnecterCDMRail.enabled:=false; - DeConnecterCDMRail.enabled:=false; + ButtonEcrCV.Enabled:=true; + LireunfichierdeCV1.enabled:=true; + ButtonLitCV.Enabled:=true; end; - end - else affiche('Port COM non ouvert',clorange); + if protocole=2 then envoi_aiguillages_DCCpp; // envoi la liste des aiguillages à l'interface DCC++ + end; end; - Function GetWindowFromID(ProcessID : Cardinal): THandle; Var TestID : Cardinal; TestHandle : Thandle; @@ -7491,24 +8129,35 @@ end; procedure TFormPrinc.FormCreate(Sender: TObject); var i : integer; s : string; - t : tequipement; begin TraceSign:=True; + configPrete:=false; // form config prete PremierFD:=false; // services commIP CDM par défaut ntrains:=1; + protocole:=1; Srvc_Aig:=true; Srvc_Det:=true; Srvc_Act:=true; Srvc_PosTrain:=false; Srvc_sig:=false; confasauver:=false; - config_modifie:=false; - AF:='Client TCP-IP CDM Rail ou USB - système XpressNet - Version '+Version+sousVersion; + AF:='Client TCP-IP CDM Rail ou USB - système XpressNet DCC++ Version '+Version+sousVersion; + chaine_recue:=''; Caption:=AF; Application.onHint:=doHint; + // box2=CV + GroupBox2.Left:=633; + GroupBox2.Top:=60; + GroupBox2.Visible:=false; + // box3=vitesses et fonctions F + GroupBox3.Left:=633; + GroupBox3.Top:=60; + GroupBox3.visible:=true; + + // version d'OS pour info if IsWow64Process then s:='OS 64 Bits' else s:='OS 32 Bits'; s:=DateToStr(date)+' '+TimeToStr(Time)+' '+s; @@ -7524,21 +8173,22 @@ begin ncrois:=0; debugtrames:=false; algo_Unisemaf:=1; + MaxPortCom:=30; espY:=15; AvecInit:=true; //&&&& avec initialisation des aiguillages ou pas Option_demarrage:=false; // démarrage des trains après tempo, pas encore au point Diffusion:=AvecInit; // mode diffusion publique // pour Rad studio------------------------ - FenRich.Height:=Height-150; + FenRich.Height:=Height-150; ScrollBox1.Height:=Height-280; StaticText.AutoSize:=true; StaticText.Top:=FenRich.Height+FenRich.Top+10; //---------------------------------------- - + // créée la fenetre vérification de version FormVersion:=TformVersion.Create(Self); - + ferme:=false; CDM_connecte:=false; pasreponse:=0; @@ -7548,15 +8198,29 @@ begin N_routes:=0; N_trains:=0; NumTrameCDM:=0; + protocole:=1; Application.HintHidePause:=30000; + visible:=true; // rend la form visible plus tot // lecture fichiers de configuration - lit_config; + lit_config; + + if protocole=1 then + begin + ButtonEnv.visible:=false; + EditEnvoi.Visible:=false; + end; + if protocole=2 then + begin + ButtonEnv.visible:=true; + EditEnvoi.Visible:=true; + end; + Application.ProcessMessages; // lancer CDM rail et le connecte si on le demande - if LanceCDM then Lance_CDM; + Loco.Visible:=true; // tenter la liaison vers CDM rail @@ -7573,8 +8237,8 @@ begin // Initialisation de la comm socket LENZ if AdresseIP<>'0' then begin - Affiche('Demande ouverture interface XpressNet par Ethernet '+AdresseIP+':'+intToSTR(port),clyellow); - ClientSocketLenz.port:=port; + Affiche('Demande ouverture interface par Ethernet '+AdresseIP+':'+intToSTR(port),clyellow); + ClientSocketLenz.port:=portInterface; ClientSocketLenz.Address:=AdresseIP; ClientSocketLenz.Open; end; @@ -7613,28 +8277,27 @@ begin N_Event_tick:=0 ; // dernier index NombreImages:=0; - // box2=CV - GroupBox2.Left:=633; - GroupBox2.Top:=60; - GroupBox2.Visible:=false; - // box3=vitesses et fonctions F - GroupBox3.Left:=633; - GroupBox3.Top:=60; - GroupBox3.visible:=true; - // TCO begin //créée la fenêtre TCO non modale FormTCO:=TformTCO.Create(nil); - if avecTCO then FormTCO.show; + if avecTCO then + begin + formTCO.show; + With Formprinc do + begin + BringToFront; + Setfocus; + end; + end; end; - Affiche('Fin des initialisations',clyellow); + //Affiche('Fin des initialisations',clyellow); LabelEtat.Caption:=' '; Affiche_memoire; // DoubleBuffered:=true; - { + { aiguillage[index_aig(1)].position:=const_droit; aiguillage[index_aig(3)].position:=const_devie; aiguillage[index_aig(4)].position:=const_devie; @@ -7659,8 +8322,8 @@ end; // évènement réception d'une trame sur le port COM USB (centrale Lenz) procedure TFormPrinc.MSCommUSBLenzComm(Sender: TObject); -var i : integer; - tev : integer; +var i,tev : integer; + tablo : array of byte; // tableau rx usb begin tev:=MSCommUSBLenz.commEvent; { @@ -7696,10 +8359,14 @@ begin begin chaine_recue:=chaine_recue+char(tablo[i]); end; - if traceTrames then AfficheDebug('Tick='+IntToSTR(tick)+'/Rec '+chaine_Hex(chaine_recue),Clwhite); - if terminal then Affiche(chaine_recue,clLime); - interprete_reponse(chaine_recue); - chaine_recue:=''; + setlength(tablo,0); + if traceTrames then + begin + if protocole=1 then AfficheDebug('Tick='+IntToSTR(tick)+'/Rec '+chaine_Hex(chaine_recue),Clwhite); + if protocole=2 then AfficheDebug('Tick='+IntToSTR(tick)+'/Rec '+chaine_recue,Clwhite); + end; + //if terminal then Affiche(chaine_recue,clLime); + chaine_recue:=interprete_reponse(chaine_recue); end; end; @@ -7735,7 +8402,7 @@ begin // 1 fois pour initialser la position dans le tableau // 2eme fois pour positionner physiquement les aiguillages // pour générer les evts de position - //Affiche('Positionnement aiguillages',cyan); + // Affiche('Positionnement aiguillages',cyan); for i:=1 to MaxAcc do begin index:=index_aig(i); @@ -7754,25 +8421,13 @@ begin s:=s+' non positionné'; end; Affiche(s,cyan); - if pos<>const_inconnu then aiguillage[index].position:=pos; + aiguillage[index].position:=pos; end; - end; - end; - for i:=1 to MaxAcc do - begin - index:=index_aig(i); - - model:=aiguillage[index].modele; - if (model<>rien) and (model<>crois) then // si l'aiguillage existe et différent de croisement - begin - Affiche('Pos aig '+intToSTR(i),cyan); - pos:=aiguillage[index].posInit; if (pos=const_devie) or (pos=const_droit) then begin - if pos<>const_inconnu then pilote_acc(i,pos,aigP); + pilote_acc(i,pos,aigP); if portCommOuvert or parSocketLenz or CDM_connecte then sleep(Tempo_Aig); - //application.processMessages; end; end; end; @@ -7790,6 +8445,11 @@ begin if sourisclic then inc(Temposouris); if Tdoubleclic>0 then dec(Tdoubleclic); if Tempo_init>0 then dec(Tempo_init); + if tps_affiche_retour_dcc>0 then + begin + dec(tps_affiche_retour_dcc); + if tps_affiche_retour_dcc=0 then affiche_retour_dcc:=false; + end; if (Tempo_init=1) and AvecInit then begin if not(ConfigNulle) and not(ferme) and (AvecInitAiguillages) then @@ -7804,13 +8464,13 @@ begin demande_etat_acc; // demande l'état des accessoires (position des aiguillages) end; LabelEtat.Caption:=' '; - Menu_interface(valide); + //Menu_interface(valide); end; if temps>0 then dec(temps); // gestion du clignotant des feux de la page principale - + if tempsCli>0 then dec(tempsCli); if tempsCli=0 then begin @@ -8071,7 +8731,7 @@ end; procedure TFormprinc.proc_checkBoxFB(Sender : Tobject); var s : string; Cb : TcheckBox; - etat,adresse,erreur : integer; + etat,adresse : integer; i : word; coche : boolean; begin @@ -8100,7 +8760,7 @@ end; procedure TFormprinc.proc_checkBoxFV(Sender : Tobject); var s : string; Cb : TcheckBox; - etat,adresse,erreur : integer; + etat,adresse : integer; i : word; coche : boolean; begin @@ -8129,7 +8789,7 @@ end; procedure TFormprinc.proc_checkBoxFR(Sender : Tobject); var s : string; Cb : TcheckBox; - etat,adresse,erreur : integer; + etat,adresse : integer; i : word; coche : boolean; begin @@ -8189,8 +8849,8 @@ procedure TFormPrinc.MenuConnecterEthernetClick(Sender: TObject); begin if AdresseIP<>'0' then begin - Affiche('Demande de connexion de l''interface XpressNet en ethernet sur '+AdresseIP+':'+IntToSTR(Port),clyellow); - ClientSocketLenz.port:=port; + Affiche('Demande de connexion de l''interface en ethernet sur '+AdresseIP+':'+IntToSTR(PortInterface),clyellow); + ClientSocketLenz.port:=portInterface; ClientSocketLenz.Address:=AdresseIP; ClientSocketLenz.Open; Hors_tension2:=false; @@ -8312,6 +8972,12 @@ begin ButtonLitCV.Enabled:=true; LireunfichierdeCV1.enabled:=true; LabelTitre.caption:=titre+' Interface connectée par Ethernet'; + if protocole=2 then + begin + envoi_ss_ack(''); + application.processMessages; + envoi_aiguillages_DCCpp; + end; end; procedure TFormPrinc.ClientSocketCDMConnect(Sender: TObject;Socket: TCustomWinSocket); @@ -9118,7 +9784,16 @@ begin s:=s+intToSTR(feux[i].SR[l].sortie0); if l<8 then s:=s+'/' else s:=s+')'; end; - end; + end; + if feux[i].decodeur=8 then + begin + s:=s+' DK('; + for l:=1 to 19 do + begin + s:=s+intToSTR(feux[i].SR[l].sortie1); + if l<19 then s:=s+',' else s:=s+')'; + end; + end; end else @@ -9158,25 +9833,33 @@ var adr,valeur,erreur : integer; begin // doc XpressNet page 55 val(EditCV.text,adr,erreur); - if (erreur<>0) or (Adr>255) or (Adr<0) then + if (erreur<>0) or (Adr>255) or (Adr<0) then begin EditCV.Text:='1'; exit; - end; - + end; + val(EditVal.Text,valeur,erreur); - if (erreur<>0) or (valeur<0) or (valeur>255) then + if (erreur<>0) or (valeur<0) or (valeur>255) then begin EditVal.text:='1'; exit; - end; - - //s:=#$ff+#$fe+#$23+#$1e+Char(adr)+Char(valeur); //CV de 512 à 767 V3.4 - //s:=#$ff+#$fe+#$23+#$1d+Char(adr)+Char(valeur); //CV de 256 à 511 V3.4 - s:=#$23+#$16+Char(adr)+Char(valeur); //CV de 1 à 256 - s:=checksum(s); - envoi(s); // envoi de la trame et attente Ack - // la centrale passe en mode service (p23) + end; + + if protocole=1 then + begin + //s:=#$ff+#$fe+#$23+#$1e+Char(adr)+Char(valeur); //CV de 512 à 767 V3.4 + //s:=#$ff+#$fe+#$23+#$1d+Char(adr)+Char(valeur); //CV de 256 à 511 V3.4 + s:=#$23+#$16+Char(adr)+Char(valeur); //CV de 1 à 256 + s:=checksum(s); + envoi(s); // envoi de la trame et attente Ack + // la centrale passe en mode service (p23) + end; + if protocole=2 then + begin + s:=''; + envoi(s); + end; Affiche('CV'+intToSTR(Adr)+'='+intToSTR(valeur),clyellow); end; @@ -9249,29 +9932,55 @@ begin begin EditCV.Text:='1'; exit; - end; - //trace:=true; - s:=#$22+#$15+Char(cv); //CV de 1 à 256 (V3.0) - //s:=#$22+#$18+Char(cv); //CV de 1 à 255 + 1024 (V3.6) - s:=checksum(s); - // envoi de la trame : fait passer la centrale en mode programmation (service) - envoi_ss_ack(s); + end; - // attendre la trame 01 04 05 (env 1s) - succes:=false;i:=0; - repeat - Application.processMessages; - Sleep(100); - inc(i); - until succes or (i>20); - - if succes then + if protocole=1 then begin - recu_cv:=false; - //Affiche('reçu trame succes',clyellow); - s:=#$21+#$10; // demande d'envoi du résultat du mode service + //trace:=true; + s:=#$22+#$15+Char(cv); //CV de 1 à 256 (V3.0) + //s:=#$22+#$18+Char(cv); //CV de 1 à 255 + 1024 (V3.6) s:=checksum(s); - //envoi(s); + // envoi de la trame : fait passer la centrale en mode programmation (service) + envoi_ss_ack(s); + + // attendre la trame 01 04 05 (env 1s) + succes:=false;i:=0; + repeat + Application.processMessages; + Sleep(100); + inc(i); + until succes or (i>20); + + if succes then + begin + recu_cv:=false; + //Affiche('reçu trame succes',clyellow); + s:=#$21+#$10; // demande d'envoi du résultat du mode service + s:=checksum(s); + //envoi(s); + envoi_ss_ack(s); + Tempo(1); + // attente de la réponse de la centrale + i:=0; + repeat + Tempo(2); // attend 200 ms + inc(i); + until recu_cv or (i>4); + if (i>4) then + begin + Affiche('Erreur attente trop longue CV',clred); + exit; + end; + sa:=sa+'Cv'+IntToSTR(cv)+'='+IntToSTR(Tablo_cv[cv])+' '; + Affiche(sa,clyellow);sa:=''; + end + else + Affiche('Pas de réponse de l''interface après demande de passage en mode prog',clOrange); + end; + + if protocole=2 then + begin + s:=''; envoi_ss_ack(s); Tempo(1); // attente de la réponse de la centrale @@ -9285,11 +9994,9 @@ begin Affiche('Erreur attente trop longue CV',clred); exit; end; - sa:=sa+'Cv'+IntToSTR(cv)+'='+IntToSTR(Tablo_cv[cv])+' '; + sa:=sa+'Cv'+IntToSTR(cv)+'='+IntToSTR(Tablo_cv[1])+' '; Affiche(sa,clyellow);sa:=''; - end - else - Affiche('Pas de réponse de l''interface après demande de passage en mode prog',clOrange); + end; end; procedure TFormPrinc.Quitter1Click(Sender: TObject); @@ -9299,9 +10006,12 @@ end; procedure TFormPrinc.ConfigClick(Sender: TObject); begin - FormConfig.PageControl.ActivePage:=Formconfig.TabSheetCDM; // force le premier onglet sur la page - formconfig.showmodal; - // ne pas faire close : déja provoqué par le self de la fermeture + if ConfigPrete then + begin + FormConfig.PageControl.ActivePage:=Formconfig.TabSheetCDM; // force le premier onglet sur la page + formconfig.showmodal; + // ne pas faire close : déja provoqué par le self de la fermeture + end; end; procedure TFormPrinc.Codificationdesactionneurs1Click(Sender: TObject); @@ -9472,9 +10182,12 @@ begin Etat:=Feux[i].EtatSignal; s:='Signal '+IntToSTR(Adr)+' Etat='; code_to_aspect(Etat,aspect,combine); - s:=s+IntToSTR(etat)+'='; - if aspect<>-1 then s:=s+EtatSign[aspect]; - if combine<>-1 then s:=s+' '+EtatSign[combine]; + s:=s+IntToSTR(etat); + if Feux[i].aspect<10 then + begin + if aspect<>-1 then s:=s+' '+EtatSign[aspect]; + if combine<>-1 then s:=s+' '+EtatSign[combine]; + end; Affiche(s,clYellow); end; end; @@ -9637,32 +10350,51 @@ end; procedure TFormPrinc.Demanderlaversiondelacentrale1Click(Sender: TObject); var s : string; begin - if portCommOuvert or parSocketLenz then + if (portcommOuvert=false) and (parsocketLenz=false) then + begin + Affiche('L''interface n''est pas connectée par USB ou par Ethernet',clorange); + exit; + end; + if (protocole=1) then begin s:=#$f0; s:=checksum(s); envoi(s); + end ; + if (protocole=2) then + begin + affiche_retour_dcc:=true; + tps_affiche_retour_dcc:=2; + s:=checksum(''); + envoi(s); end - else Affiche('L''interface XpressNet n''est pas connectée par USB ou par Ethernet',clorange); end; procedure TFormPrinc.Demandetatdesaiguillages1Click(Sender: TObject); begin - if portCommOuvert or parSocketLenz then demande_etat_acc - else Affiche('L''interface XpressNet n''est pas connectée par USB ou par Ethernet',clorange); + if (portcommOuvert=false) and (parsocketLenz=false) then + begin + Affiche('L''interface n''est pas connectée par USB ou par Ethernet',clorange); + exit; + end; + if (protocole=1) then demande_etat_acc ; end; - procedure TFormPrinc.RepriseDCC1Click(Sender: TObject); var s : string; begin - if portCommOuvert or parSocketLenz then + if (portcommOuvert=false) and (parsocketLenz=false) then + begin + Affiche('L''interface n''est pas connectée par USB ou par Ethernet',clorange); + exit; + end; + if protocole=1 then begin s:=#$21+#$81; s:=checksum(s); envoi(s); // envoi de la trame et attente Ack - end - else Affiche('L''interface XpressNet n''est pas connectée par USB ou par Ethernet',clorange); + end; + if protocole=2 then envoi('<1>'); end; procedure TFormPrinc.BoutonRazTrainsClick(Sender: TObject); @@ -9674,7 +10406,7 @@ end; procedure TFormPrinc.Demandetataccessoires1Click(Sender: TObject); begin if portCommOuvert or parSocketLenz then demande_etat_acc - else Affiche('L''interface XpressNet n''est pas connectée par USB ou par Ethernet',clorange); + else Affiche('L''interface n''est pas connectée par USB ou par Ethernet',clorange); end; procedure TFormPrinc.LancerCDMrail1Click(Sender: TObject); @@ -9695,8 +10427,16 @@ begin if (e=0) and (i>=0) and (i<=100) then TrackBarVit.position:=i; end; - - +procedure TFormPrinc.ButtonEnvClick(Sender: TObject); +var temp : integer; +begin + //decode_chaine_retro_dcc(''); + //TraceTrames:=true; + affiche_retour_dcc:=true; + tps_affiche_retour_dcc:=2; + Affiche(editEnvoi.text,ClWhite); + envoi(editEnvoi.Text); +end; end. diff --git a/UnitSR.dcu b/UnitSR.dcu index 8981617..259c757 100644 Binary files a/UnitSR.dcu and b/UnitSR.dcu differ diff --git a/UnitSR.dfm b/UnitSR.dfm index 1ddaa62..94fe10b 100644 --- a/UnitSR.dfm +++ b/UnitSR.dfm @@ -1,9 +1,10 @@ object FormSR: TFormSR Left = 425 Top = 73 - Width = 491 - Height = 600 + BorderStyle = bsDialog Caption = 'Configuration du d'#233'codeur du signal St'#233'phane Ravaut' + ClientHeight = 562 + ClientWidth = 475 Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText diff --git a/UnitSR.pas b/UnitSR.pas index 65eeb79..fad558b 100644 --- a/UnitSR.pas +++ b/UnitSR.pas @@ -7,7 +7,7 @@ interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, - Dialogs, StdCtrls, ExtCtrls; + Dialogs, StdCtrls, ExtCtrls , UnitPrinc, UnitConfig; type TFormSR = class(TForm) @@ -128,13 +128,10 @@ var implementation -uses UnitPrinc, UnitConfig; - {$R *.dfm} procedure etat_SR(etat : integer;var etat1,etat2 : integer) ; -var i : integer; begin // etat1 correspond à l'allumage des leds du 1er cycle clignotant // etat2 correspond à l'allumage des leds du 2eme cycle clignotant @@ -182,7 +179,7 @@ end; procedure TFormSR.FormActivate(Sender: TObject); -var erreur,i,etat1,etat2 : integer; +var erreur,etat1,etat2 : integer; begin Val(FormConfig.EditAdrSig.text,Adr,erreur); indexSig:=index_feu(Adr); diff --git a/UnitSimule.dcu b/UnitSimule.dcu index 02a4e60..ad31b00 100644 Binary files a/UnitSimule.dcu and b/UnitSimule.dcu differ diff --git a/UnitTCO.dcu b/UnitTCO.dcu index 868edaf..e5d97a9 100644 Binary files a/UnitTCO.dcu and b/UnitTCO.dcu differ diff --git a/UnitTCO.dfm b/UnitTCO.dfm index 4f803c0..1150305 100644 --- a/UnitTCO.dfm +++ b/UnitTCO.dfm @@ -1,8 +1,8 @@ object FormTCO: TFormTCO - Left = 178 - Top = 70 + Left = 152 + Top = 35 Width = 1139 - Height = 694 + Height = 686 VertScrollBar.Visible = False Caption = 'FormTCO' Color = clBtnFace @@ -19,9 +19,10 @@ object FormTCO: TFormTCO OnCreate = FormCreate OnDockOver = FormDockOver OnKeyDown = FormKeyDown + OnMouseWheel = FormMouseWheel DesignSize = ( - 1123 - 656) + 1131 + 655) PixelsPerInch = 96 TextHeight = 13 object LabelCoord: TLabel @@ -71,8 +72,8 @@ object FormTCO: TFormTCO Height = 97 end object Label19: TLabel - Left = 1059 - Top = 407 + Left = 1075 + Top = 399 Width = 32 Height = 13 Anchors = [akRight, akBottom] @@ -87,25 +88,25 @@ object FormTCO: TFormTCO object ScrollBox: TScrollBox Left = 8 Top = 18 - Width = 1036 - Height = 375 + Width = 1057 + Height = 367 HorzScrollBar.Smooth = True HorzScrollBar.Tracking = True VertScrollBar.Smooth = True VertScrollBar.Tracking = True Anchors = [akLeft, akTop, akRight, akBottom] BevelEdges = [beLeft, beTop, beRight] - Color = clBtnFace + Color = clBackground ParentColor = False TabOrder = 0 DesignSize = ( - 1032 - 371) + 1053 + 363) object ImageTCO: TImage Left = 0 Top = 0 - Width = 1009 - Height = 353 + Width = 1030 + Height = 345 Anchors = [akLeft, akTop, akRight, akBottom] ParentShowHint = False PopupMenu = PopupMenu1 @@ -120,10 +121,10 @@ object FormTCO: TFormTCO end end object TrackBarZoom: TTrackBar - Left = 1059 + Left = 1075 Top = 18 Width = 41 - Height = 366 + Height = 358 Anchors = [akTop, akRight, akBottom] Max = 50 Min = 20 @@ -135,10 +136,11 @@ object FormTCO: TFormTCO end object Panel1: TPanel Left = 8 - Top = 479 - Width = 1100 + Top = 471 + Width = 1113 Height = 166 Anchors = [akLeft, akRight, akBottom] + Color = clActiveBorder Font.Charset = ANSI_CHARSET Font.Color = clBlue Font.Height = -9 @@ -148,7 +150,7 @@ object FormTCO: TFormTCO TabOrder = 2 OnDragOver = Panel1DragOver DesignSize = ( - 1100 + 1113 166) object ImagePalette5: TImage Left = 504 @@ -718,7 +720,7 @@ object FormTCO: TFormTCO ParentFont = False end object ButtonSauveTCO: TButton - Left = 992 + Left = 1005 Top = 48 Width = 92 Height = 33 @@ -729,7 +731,7 @@ object FormTCO: TFormTCO OnClick = ButtonSauveTCOClick end object ButtonRedessine: TButton - Left = 992 + Left = 1005 Top = 8 Width = 92 Height = 33 @@ -739,8 +741,8 @@ object FormTCO: TFormTCO OnClick = ButtonRedessineClick end object Button1: TButton - Left = 784 - Top = 112 + Left = 608 + Top = 104 Width = 89 Height = 25 Caption = 'Simu det 1' @@ -748,8 +750,8 @@ object FormTCO: TFormTCO OnClick = Button1Click end object Button2: TButton - Left = 880 - Top = 112 + Left = 728 + Top = 104 Width = 89 Height = 25 Caption = 'Simu Det 0' @@ -757,7 +759,7 @@ object FormTCO: TFormTCO OnClick = Button2Click end object ButtonConfigTCO: TButton - Left = 992 + Left = 1005 Top = 88 Width = 92 Height = 33 @@ -767,8 +769,8 @@ object FormTCO: TFormTCO OnClick = ButtonConfigTCOClick end object ButtonSimu: TButton - Left = 864 - Top = 80 + Left = 720 + Top = 136 Width = 113 Height = 25 Caption = 'Simu canton occup'#233 @@ -776,7 +778,7 @@ object FormTCO: TFormTCO OnClick = ButtonSimuClick end object ButtonMasquer: TButton - Left = 992 + Left = 1005 Top = 128 Width = 92 Height = 33 @@ -931,10 +933,21 @@ object FormTCO: TFormTCO OnClick = CheckPinvClick end end + object buttonRaz: TButton + Left = 901 + Top = 128 + Width = 92 + Height = 33 + Anchors = [akTop, akRight] + Caption = 'Raz des occupations' + TabOrder = 8 + WordWrap = True + OnClick = buttonRazClick + end end object ButtonAfficheBandeau: TButton - Left = 1051 - Top = 431 + Left = 1067 + Top = 423 Width = 57 Height = 33 Anchors = [akRight, akBottom] @@ -997,6 +1010,42 @@ object FormTCO: TFormTCO object N2: TMenuItem Caption = '-' end + object Inserer: TMenuItem + Caption = 'Inserer' + object LigneDessus: TMenuItem + Caption = 'Ligne au dessus' + OnClick = LigneDessusClick + end + object LigneDessous: TMenuItem + Caption = 'Ligne en dessous' + OnClick = LigneDessousClick + end + object N7: TMenuItem + Caption = '-' + end + object Colonnegauche1: TMenuItem + Caption = 'Colonne '#224' gauche' + OnClick = Colonnegauche1Click + end + object Colonnedroite1: TMenuItem + Caption = 'Colonne '#224' droite' + OnClick = Colonnedroite1Click + end + end + object Supprimer: TMenuItem + Caption = 'Supprimer' + object SupprimeLigne: TMenuItem + Caption = 'Ligne' + OnClick = SupprimeLigneClick + end + object Colonne: TMenuItem + Caption = 'Colonne' + OnClick = ColonneClick + end + end + object N6: TMenuItem + Caption = '-' + end object N3: TMenuItem Caption = 'Propri'#233't'#233's' OnClick = N3Click diff --git a/UnitTCO.pas b/UnitTCO.pas index bdda94d..b8130e0 100644 --- a/UnitTCO.pas +++ b/UnitTCO.pas @@ -103,6 +103,17 @@ type ComboRepr: TComboBox; Label1: TLabel; CheckPinv: TCheckBox; + N6: TMenuItem; + Inserer: TMenuItem; + Supprimer: TMenuItem; + LigneDessus: TMenuItem; + LigneDessous: TMenuItem; + SupprimeLigne: TMenuItem; + Colonne: TMenuItem; + N7: TMenuItem; + Colonnegauche1: TMenuItem; + Colonnedroite1: TMenuItem; + buttonRaz: TButton; procedure FormCreate(Sender: TObject); procedure ImageTCOClick(Sender: TObject); procedure FormActivate(Sender: TObject); @@ -283,7 +294,15 @@ type procedure Signalgauchedelavoie1Click(Sender: TObject); procedure PopupMenu1Popup(Sender: TObject); procedure N3Click(Sender: TObject); - procedure Button3Click(Sender: TObject); + procedure LigneDessusClick(Sender: TObject); + procedure LigneDessousClick(Sender: TObject); + procedure SupprimeLigneClick(Sender: TObject); + procedure Colonnegauche1Click(Sender: TObject); + procedure Colonnedroite1Click(Sender: TObject); + procedure ColonneClick(Sender: TObject); + procedure buttonRazClick(Sender: TObject); + procedure FormMouseWheel(Sender: TObject; Shift: TShiftState; + WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean); private { Déclarations privées } @@ -312,7 +331,7 @@ type TTCO = array[1..MaxCellX] of array[1..MaxCellY] of record Adresse : integer ; // adresse du détecteur ou de l'aiguillage ou du feu BImage : integer ; // 0=rien 1=voie 2=aiguillage gauche gauche ... 30=feu - mode : Tcolor; // couleur de voie 0=éteint + mode : integer; // couleur de voie 0=éteint 1=ClVoies 2=couleur en fonction du train inverse : boolean; // aiguillage piloté inversé repr : integer; // position de la représentation texte 0 = rien 1=centrale 2=Haut 3=Bas Texte : string[30]; // texte de la cellule @@ -341,8 +360,9 @@ var TamponTCO,tco : TTco ; // pour copier coller TamponTCO_Org : record - x1,y1,x2,y2 : integer; - end; + x1,y1,x2,y2,NbreCellX,NbreCellY : integer; + end; + rAncien : TRect; PCanvasTCO : Tcanvas; PBitMapTCO : TBitMap; @@ -378,7 +398,7 @@ var fichier : textfile; nv,x,y,i,j,m,adresse,valeur,erreur,FeuOriente,PiedFeu,tailleFont : integer; e : integer; trouve_CoulFond,trouve_clVoies,trouve_clAllume,trouve_clGrille,trouve_clCanton, - trouve_clTexte,trouve_clQuai,trouve_matrice,trouve_cellule,trouve_ModeCanton, + trouve_clTexte,trouve_clQuai,trouve_matrice,trouve_ratio,trouve_ModeCanton, trouve_AvecGrille : boolean; function lit_ligne : string ; var c : char; @@ -387,6 +407,7 @@ var fichier : textfile; readln(fichier,s); s:=Uppercase(s); //Affiche(s,clWhite); + c:=#0; if length(s)>0 then c:=s[1]; until ((c<>'/') and (s<>'')) or eof(fichier) ; lit_ligne:=s; @@ -412,7 +433,7 @@ begin trouve_clTexte:=false; trouve_clQuai:=false; trouve_matrice:=false; - trouve_cellule:=false; + trouve_ratio:=false; trouve_clCanton:=false; trouve_ModeCanton:=false; trouve_AvecGrille:=false; @@ -548,7 +569,7 @@ begin if i<>0 then begin inc(nv); - trouve_cellule:=true; + trouve_ratio:=true; delete(s,i,length(sa)); val(s,i,erreur); RatioC:=i; @@ -685,7 +706,7 @@ begin closefile(fichier); e:=sizeof(Tco) div 1024; - Affiche('Dimensions du tco : '+intToSTR(NbreCellX)+'x'+intToSTR(NbreCellY)+' / '+IntToSTR(e)+'Ko',clyellow); + //Affiche('Dimensions du tco : '+intToSTR(NbreCellX)+'x'+intToSTR(NbreCellY)+' / '+IntToSTR(e)+'Ko',clyellow); end; procedure sauve_fichier_tco; @@ -867,13 +888,13 @@ begin end; procedure dessin_2(Canvas : Tcanvas;x,y : integer;Mode : integer); -var x0,y0,xc,yc,jy1,jy2,xf,yf,x1,x2,y1,y2,x3,position : integer; +var x0,y0,xc,yc,jy1,jy2,xf,yf,position : integer; r : Trect; procedure trajet_droit; begin if mode=0 then - with canvas do + with canvas do begin pen.color:=clvoies; Brush.Color:=clvoies; @@ -921,7 +942,7 @@ var x0,y0,xc,yc,jy1,jy2,xf,yf,x1,x2,y1,y2,x3,position : integer; // partie horz g en couleur de voie pen.color:=clvoies; Brush.Color:=clvoies; - moveto(x0,yc);LineTo(xc,yc); + moveto(x0,yc);LineTo(xc,yc); if mode=1 then couleur:=clAllume; if mode=2 then couleur:=couleurtrain[index_couleur]; @@ -970,8 +991,6 @@ begin pen.color:=fond; Brush.Color:=fond; pen.width:=1; - x1:=xc-epaisseur;y1:=yc-(epaisseur div 2)-1; - x2:=xc+epaisseur+10;y2:=yc-epaisseur-3; jy1:=yc-(Epaisseur div 2); // pos Y de la bande sup pen.width:=1; Polygon([point(x0+1,y0+hauteurCell-epaisseur),Point(xc-(epaisseur div 2),jy1),Point(xc-epaisseur-epaisseur,jy1),Point(x0+1,y0+hauteurcell-epaisseur-epaisseur)]); @@ -983,9 +1002,6 @@ begin pen.color:=fond; Brush.Color:=fond; pen.Width:=1; - x1:=xc+(epaisseur div 2);y1:=yc+(epaisseur div 2); - x2:=x1+epaisseur-1;y2:=yc-(epaisseur div 2); - x3:=x1+10; jy2:=yc+(Epaisseur div 2); // pos Y de la bande inf r:=rect(x0+1,jy2+1,x0+largeurCell-1,jy2+epaisseur); FillRect(r); @@ -994,7 +1010,7 @@ begin end; procedure dessin_3(Canvas : Tcanvas;x,y : integer;Mode : integer); -var x0,y0,xc,yc,jy1,xf,yf,x1,x2,y1,y2,x3,position : integer; +var x0,y0,xc,yc,jy1,xf,yf,position : integer; r : Trect; procedure trajet_droit; @@ -1097,9 +1113,6 @@ begin pen.color:=fond; Brush.Color:=fond; pen.width:=1; - x1:=xc-epaisseur;y1:=yc-(epaisseur div 2)-1; - x2:=xc+epaisseur+10;y2:=yc-epaisseur-3; - jy1:=yc-(Epaisseur div 2); // pos Y de la bande sup pen.width:=1; Polygon([point(xc+epaisseur-4,yc+epaisseur-1),point(xc+2*epaisseur-1,yc-epaisseur),point(xc+3*epaisseur,yc-epaisseur),point(xc+2*epaisseur,yc+epaisseur-1)]); end; @@ -1110,9 +1123,6 @@ begin pen.color:=fond; Brush.Color:=fond; pen.Width:=1; - x1:=xc+(epaisseur div 2);y1:=yc+(epaisseur div 2); - x2:=x1+epaisseur-1;y2:=yc-(epaisseur div 2); - x3:=x1+10; jy1:=yc-(Epaisseur div 2); // pos Y de la bande sup r:=rect(x0+1,jy1,x0+largeurCell-1,jy1-epaisseur); FillRect(r); @@ -1121,7 +1131,7 @@ begin end; procedure dessin_4(Canvas : Tcanvas;x,y : integer;Mode : integer); -var x0,y0,xc,yc,jy1,jy2,xf,yf,x1,x2,y1,y2,x3,y3,x4,y4,position : integer; +var x0,y0,xc,yc,xf,yf,x1,x2,y1,y2,x3,y3,x4,y4,position : integer; r : Trect; procedure trajet_droit; @@ -1375,7 +1385,7 @@ end; // coin supérieur gauche (Element 6) procedure dessin_6(Canvas : Tcanvas;x,y : integer;Mode : integer); -var x0,y0,xc,yc,x1,y1,x2,y2,x3,y3,x4,y4,jy1,jy2 : integer; +var x0,y0,xc,yc : integer; r : Trect; begin x0:=(x-1)*LargeurCell; @@ -1439,7 +1449,7 @@ var x0,y0,xc,yc : integer; begin x0:=(x-1)*LargeurCell; y0:=(y-1)*HauteurCell; - xc:=x0+(largeurCell div 2); + xc:=x0+(largeurCell div 2); yc:=y0+(hauteurCell div 2); with canvas do @@ -1494,7 +1504,7 @@ end; // élément 10 procedure dessin_10(Canvas : Tcanvas;x,y : integer;Mode : integer); -var Adr, x0,y0,x1,y1,x2,y2,x3,y3,x4,y4 : integer; +var Adr, x0,y0: integer; r : Trect; begin x0:=(x-1)*LargeurCell; @@ -1683,7 +1693,7 @@ end; // Elément 13 procedure dessin_13(Canvas : Tcanvas;x,y : integer;Mode : integer); -var x0,y0,xc,yc,xf,yf,x1,x2,y1,y2,x3,y3,x4,y4,position : integer; +var x0,y0,xc,yc,xf,yf,x1,x2,y1,y2,x3,y3,x4,position : integer; r : Trect; procedure trajet_droit; @@ -2147,7 +2157,7 @@ end; // Element 19 procedure dessin_19(Canvas : Tcanvas;x,y,mode: integer); -var x0,y0,xc,yc,adr : integer; +var x0,y0,xc,yc : integer; r : Trect; begin x0:=(x-1)*LargeurCell; @@ -2209,12 +2219,11 @@ end; // Element 21 - croisement - TJD procedure dessin_21(Canvas : Tcanvas;x,y,mode : integer); -var x0,y0,xc,yc : integer; +var x0,y0,yc : integer; r : Trect; begin x0:=(x-1)*LargeurCell; y0:=(y-1)*HauteurCell; - xc:=x0+(largeurCell div 2); yc:=y0+(hauteurCell div 2); with canvas do @@ -2238,12 +2247,11 @@ end; // Element 22 procedure dessin_22(Canvas : Tcanvas;x,y,mode : integer); -var x0,y0,xc,yc : integer; +var x0,y0,yc : integer; r : Trect; begin x0:=(x-1)*LargeurCell; y0:=(y-1)*HauteurCell; - xc:=x0+(largeurCell div 2); yc:=y0+(hauteurCell div 2); with canvas do @@ -2268,7 +2276,7 @@ end; // Element 23 procedure dessin_23(Canvas : Tcanvas;x,y,mode: integer); -var x0,y0,x1,y1,x2,y2,jy1,jy2 : integer; +var x0,y0,x1,x2,jy1,jy2 : integer; r : Trect; begin x0:=(x-1)*LargeurCell; @@ -2283,8 +2291,8 @@ begin Brush.Color:=clQuai; pen.color:=clQuai; - x1:=x0;y1:=y0; - x2:=x0+largeurCell;y2:=y0+HauteurCell-round(3*FrYGlob); + x1:=x0; + x2:=x0+largeurCell; jy1:=y0+(HauteurCell div 2)-round(14*frYGlob); // pos Y de la bande sup jy2:=y0+(HauteurCell div 2)+round(14*frYGlob); // pos Y de la bande inf @@ -2914,7 +2922,7 @@ end; // affiche la cellule x et y en cases procedure affiche_cellule(x,y : integer); -var i,repr,p,Xorg,Yorg,xt,yt,mode,adresse,Bimage,aspect,oriente,pos,pos2,pied : integer; +var repr,Xorg,Yorg,xt,yt,mode,adresse,Bimage,aspect,oriente,pied : integer; Bt : TEquipement; s : string; begin @@ -2995,6 +3003,7 @@ begin // détecteurs if ((BImage=1) ) and (adresse<>0) then begin // Adresse de l'élément + if repr<>0 then with PCanvasTCO do begin Brush.Color:=fond; @@ -3002,13 +3011,12 @@ begin Font.Name:='Arial'; Font.Style:=style(tco[x,y].FontStyle); xt:=round(15*frXGlob); - repr:=0; case repr of 1 : yt:=(HauteurCell div 2)-round(7*fryGlob); // milieu 2 : yt:=1; // haut 3 : yt:=HauteurCell-round(17*frYGlob); // bas end; - if repr<>0 then TextOut(xOrg+xt,Yorg+yt,s); + TextOut(xOrg+xt,Yorg+yt,s); end; end; @@ -3138,7 +3146,6 @@ end; procedure affiche_texte(x,y : integer); var x0,y0,yt,repr : integer; ss,s : string; - fs : TFontStyles; begin x0:=(x-1)*Largeurcell; y0:=(y-1)*hauteurcell; @@ -3172,7 +3179,7 @@ end; // affiche le tco suivant le tableau TCO procedure Affiche_TCO ; -var x,y,x0,y0,DimX,DimY,yt : integer; +var x,y,DimX,DimY : integer; s : string; r : Trect; begin @@ -3211,7 +3218,6 @@ begin begin affiche_cellule(x,y); end; - end; //afficher les cellules des feux et les textes pour que les pieds recouvrent le reste et afficher les textes @@ -3384,7 +3390,7 @@ end; procedure zone_TCO(det1,det2,mode: integer); var i,j,x,y,xn,yn,ancienY,ancienX,Xdet1,Ydet1,Xdet2,Ydet2,Bimage,adresse, pos,pos2,ir : integer; - memtrouve,increment,sortir : boolean; + memtrouve,sortir : boolean; mdl : Tequipement; routeTCO : array[1..100] of record x,y : integer; @@ -3399,9 +3405,7 @@ begin trouve_det(det2,Xdet2,Ydet2); if (Xdet2=0) or (Ydet2=0) then exit; - increment:=true; // inverser coordonnées des détecteurs si à l'envers en X - if xDet20) and (ycoupe<>0) then begin for y:=TamponTCO_Org.y1 to TamponTCO_Org.y2 do // rectangle de la sélection @@ -4699,7 +4710,7 @@ end; // changement de l'adresse d'un élément procedure TFormTCO.EditAdrElementChange(Sender: TObject); -var Adr,erreur,index,aspect : integer; +var Adr,erreur,index : integer; begin //Affiche('Chgt adresse',clyellow); @@ -4737,7 +4748,7 @@ begin end; procedure TFormTCO.EditTypeImageKeyPress(Sender: TObject; var Key: Char); -var Bimage,erreur,i : integer; +var Bimage,erreur : integer; begin if actualize then exit; if ord(Key)=VK_RETURN then @@ -5496,9 +5507,239 @@ begin FormConfCellTCO.BringToFront; end; -procedure TFormTCO.Button3Click(Sender: TObject); + + + +procedure TFormTCO.LigneDessusClick(Sender: TObject); +var x,y : integer; begin - dessin_14(ImageTCO.canvas,6,1,1); + if NbreCellY>=MaxCellY then exit; + for y:=NbreCellY downto YClicCell do + begin + for x:=1 to NbreCellX do tco[x,y+1]:=tco[x,y]; + end; + for x:=1 to NbreCellX do + begin + tco[x,YClicCell].Adresse:=0; + tco[x,YClicCell].BImage:=0; + tco[x,YClicCell].inverse:=false; + tco[x,YClicCell].repr:=0; + tco[x,YClicCell].texte:=''; + tco[x,YClicCell].fonte:=''; + tco[x,YClicCell].Couleur:=fond; + tco[x,YClicCell].PiedFeu:=0; + tco[x,YClicCell].FeuOriente:=0; + end; + inc(NbreCellY); + affiche_TCO; +end; + +procedure TFormTCO.LigneDessousClick(Sender: TObject); +var x,y : integer; +begin + if NbreCellY>=MaxCellY then exit; + for y:=NbreCellY downto YClicCell+1 do + begin + for x:=1 to NbreCellX do tco[x,y+1]:=tco[x,y]; + end; + for x:=1 to NbreCellX do + begin + tco[x,YClicCell+1].Adresse:=0; + tco[x,YClicCell+1].BImage:=0; + tco[x,YClicCell+1].inverse:=false; + tco[x,YClicCell+1].repr:=0; + tco[x,YClicCell+1].texte:=''; + tco[x,YClicCell+1].fonte:=''; + tco[x,YClicCell+1].Couleur:=fond; + tco[x,YClicCell+1].PiedFeu:=0; + tco[x,YClicCell+1].FeuOriente:=0; + end; + inc(NbreCellY); + affiche_TCO; +end; + +procedure TFormTCO.SupprimeLigneClick(Sender: TObject); +var x,y : integer; +begin + if NbreCellY<=1 then exit; + + // tampon de sauvegarde + TamponTCO_Org.NbreCellX:=NbreCellX; + TamponTCO_Org.NbreCellY:=NbreCellY; + TamponTCO_Org.x1:=1; + TamponTCO_Org.x2:=NbreCellX; + TamponTCO_Org.y1:=1; + TamponTCO_Org.y2:=NbreCellY; + xcoupe:=1;ycoupe:=1; + for y:=TamponTCO_Org.y1 to TamponTCO_Org.y2 do + for x:=TamponTCO_Org.x1 to TamponTCO_Org.x2 do + tamponTCO[x,y]:=tco[x,y]; + TamponAffecte:=true; + + // supression ligne + for y:=YClicCell to NbreCellY do + begin + for x:=1 to NbreCellX do tco[x,y]:=tco[x,y+1]; + end; + for x:=1 to NbreCellX do + begin + tco[x,NbreCellY].Adresse:=0; + tco[x,NbreCellY].BImage:=0; + tco[x,NbreCellY].inverse:=false; + tco[x,NbreCellY].repr:=0; + tco[x,NbreCellY].texte:=''; + tco[x,NbreCellY].fonte:=''; + tco[x,NbreCellY].Couleur:=fond; + tco[x,NbreCellY].PiedFeu:=0; + tco[x,NbreCellY].FeuOriente:=0; + end; + dec(NbreCellY); + affiche_TCO; +end; + +procedure TFormTCO.Colonnegauche1Click(Sender: TObject); + var x,y : integer; +begin + if NbreCellX>=MaxCellX then exit; + for x:=NbreCellX downto XClicCell do + begin + for y:=1 to NbreCellY do tco[x+1,y]:=tco[x,y]; + end; + for y:=1 to NbreCellX do + begin + tco[XClicCell,y].Adresse:=0; + tco[XClicCell,y].BImage:=0; + tco[XClicCell,y].inverse:=false; + tco[XClicCell,y].repr:=0; + tco[XClicCell,y].texte:=''; + tco[XClicCell,y].fonte:=''; + tco[XClicCell,y].Couleur:=fond; + tco[XClicCell,y].PiedFeu:=0; + tco[XClicCell,y].FeuOriente:=0; + end; + inc(NbreCellX); + affiche_TCO; +end; + +procedure TFormTCO.Colonnedroite1Click(Sender: TObject); + var x,y : integer; +begin + if NbreCellX>=MaxCellX then exit; + for x:=NbreCellX downto XClicCell+1 do + begin + for y:=1 to NbreCellY do tco[x+1,y]:=tco[x,y]; + end; + for y:=1 to NbreCellX do + begin + tco[XClicCell+1,y].Adresse:=0; + tco[XClicCell+1,y].BImage:=0; + tco[XClicCell+1,y].inverse:=false; + tco[XClicCell+1,y].repr:=0; + tco[XClicCell+1,y].texte:=''; + tco[XClicCell+1,y].fonte:=''; + tco[XClicCell+1,y].Couleur:=fond; + tco[XClicCell+1,y].PiedFeu:=0; + tco[XClicCell+1,y].FeuOriente:=0; + end; + inc(NbreCellX); + affiche_TCO; +end; + +// suppression colonne +procedure TFormTCO.ColonneClick(Sender: TObject); +var x,y : integer; +begin + if NbreCellX<=1 then exit; + + // tampon de sauvegarde + TamponTCO_Org.NbreCellX:=NbreCellX; + TamponTCO_Org.NbreCellY:=NbreCellY; + TamponTCO_Org.x1:=1; + TamponTCO_Org.x2:=NbreCellX; + TamponTCO_Org.y1:=1; + TamponTCO_Org.y2:=NbreCellY; + xcoupe:=1;ycoupe:=1; + for y:=TamponTCO_Org.y1 to TamponTCO_Org.y2 do + for x:=TamponTCO_Org.x1 to TamponTCO_Org.x2 do + tamponTCO[x,y]:=tco[x,y]; + TamponAffecte:=true; + + // supression colonne + for x:=xClicCell to NbreCellx do + begin + for y:=1 to NbreCelly do tco[x,y]:=tco[x+1,y]; + end; + for y:=1 to NbreCellY do + begin + tco[NbreCellx,y].Adresse:=0; + tco[NbreCellx,y].BImage:=0; + tco[NbreCellx,y].inverse:=false; + tco[NbreCellx,y].repr:=0; + tco[NbreCellx,y].texte:=''; + tco[NbreCellx,y].fonte:=''; + tco[NbreCellx,y].Couleur:=fond; + tco[NbreCellx,y].PiedFeu:=0; + tco[NbreCellx,y].FeuOriente:=0; + end; + dec(NbreCellX); + affiche_TCO; +end; + +procedure TFormTCO.buttonRazClick(Sender: TObject); +var x,y : integer; +begin + for x:=1 to NbreCellx do + for y:=1 to NbreCelly do tco[x,y].mode:=0; + Affiche_TCO; +end; + +procedure TFormTCO.FormMouseWheel(Sender: TObject; Shift: TShiftState; + WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean); +var i,maxi,x,y : integer; +s : string; + position : tpoint; +begin + + i:=FormTCO.TrackBarZoom.Position; + + if WheelDelta>0 then + begin + if (i<=ZoomMin) then + begin + FormTCO.TrackBarZoom.Position:=ZoomMin; + exit; + end; + dec(i); + end + else + begin + if (i>=ZoomMax) then + begin + FormTCO.TrackBarZoom.Position:=ZoomMax; + exit; + end; + inc(i); + end; + + // positionner la trackbar zoom + FormTCO.TrackBarZoom.Position:=i; + calcul_cellules; + Affiche_TCO; + SelectionAffichee:=false; + + //positionner les trackbar du scrollbox sur la position cliquée de la souris + {GetCursorPos(Position); + x:=position.x div largeurCell +1 ; + y:=position.Y div HauteurCell +1 ; + } + maxi:=ScrollBox.HorzScrollBar.Range-ScrollBox.ClientWidth; + i:=round(xClicCell*maxi/NbreCellx); + ScrollBox.HorzScrollBar.position:=i; + + maxi:=ScrollBox.VertScrollBar.Range-ScrollBox.ClientHeight; + i:=round(yClicCell*maxi/NbreCelly); + ScrollBox.VertScrollBar.position:=i; + end; begin diff --git a/Unit_Pilote_aig.dcu b/Unit_Pilote_aig.dcu index 394d057..a384775 100644 Binary files a/Unit_Pilote_aig.dcu and b/Unit_Pilote_aig.dcu differ diff --git a/verif_version.dcu b/verif_version.dcu index c825609..e10b39d 100644 Binary files a/verif_version.dcu and b/verif_version.dcu differ diff --git a/verif_version.pas b/verif_version.pas index bfdeb60..7e44309 100644 --- a/verif_version.pas +++ b/verif_version.pas @@ -23,7 +23,7 @@ var Lance_verif : integer; verifVersion,notificationVersion : boolean; -Const Version='5.0'; // sert à la comparaison de la version publiée +Const Version='5.1'; // sert à la comparaison de la version publiée SousVersion=' '; // en cas d'absence de sous version mettre un espace implementation diff --git a/versions.txt b/versions.txt index bbcdaab..cc8b8b7 100644 --- a/versions.txt +++ b/versions.txt @@ -125,3 +125,8 @@ version 4.72 : Renforcement de la v version 4.73 : Pilotage des PN en impulsionnel ou non. version 5.0 : Gestion des sémaphores clignotants et voies libres clignotants. Gestion des actionneurs déclenchés par évènements aiguillages. +version 5.1 : Gestion décodeur DigiKeijs 4018 + Gestion ports COM>10 + Ajout fonctions ajouter/supprimer lignes/colonnes dans le TCO + Gestion protocole DCC++ +