diff --git a/Notice d'utilisation des signaux_complexes_GL_V3.7.pdf b/Notice d'utilisation des signaux_complexes_GL_V3.8.pdf similarity index 75% rename from Notice d'utilisation des signaux_complexes_GL_V3.7.pdf rename to Notice d'utilisation des signaux_complexes_GL_V3.8.pdf index 0567394..9d63045 100644 Binary files a/Notice d'utilisation des signaux_complexes_GL_V3.7.pdf and b/Notice d'utilisation des signaux_complexes_GL_V3.8.pdf differ diff --git a/UnitConfig.dcu b/UnitConfig.dcu index 2c54ee3..d27ba28 100644 Binary files a/UnitConfig.dcu and b/UnitConfig.dcu differ diff --git a/UnitConfig.dfm b/UnitConfig.dfm index aceecd2..f6df718 100644 --- a/UnitConfig.dfm +++ b/UnitConfig.dfm @@ -1,12 +1,12 @@ object FormConfig: TFormConfig - Left = 281 - Top = 124 + Left = 230 + Top = 226 Hint = 'Modifie les fichiers de configuration selon les s'#233'lections chois' + 'ies' BorderStyle = bsDialog Caption = 'Configuration g'#233'n'#233'rale' - ClientHeight = 526 + ClientHeight = 543 ClientWidth = 902 Color = clBtnFace Font.Charset = DEFAULT_CHARSET @@ -1555,7 +1555,7 @@ object FormConfig: TFormConfig end object ButtonAppliquerEtFermer: TButton Left = 384 - Top = 496 + Top = 512 Width = 201 Height = 25 Caption = 'Enregistre la configuration et Fermer' @@ -1566,7 +1566,7 @@ object FormConfig: TFormConfig end object Button2: TButton Left = 24 - Top = 496 + Top = 512 Width = 201 Height = 25 Caption = 'Fermer sans enregistrer la configuration' @@ -1577,8 +1577,8 @@ object FormConfig: TFormConfig Left = 8 Top = 8 Width = 633 - Height = 481 - ActivePage = TabSheetAig + Height = 497 + ActivePage = TabSheetBranches Font.Charset = DEFAULT_CHARSET Font.Color = clBlack Font.Height = -11 @@ -2213,7 +2213,7 @@ object FormConfig: TFormConfig Left = 328 Top = 32 Width = 289 - Height = 393 + Height = 417 Caption = 'Description de l'#39'aiguillage' TabOrder = 0 object LabelAdresse: TLabel @@ -2266,7 +2266,7 @@ object FormConfig: TFormConfig end object CheckInverse: TCheckBox Left = 16 - Top = 261 + Top = 277 Width = 137 Height = 17 Hint = 'Cocher si l'#39'aiguillage est invers'#233' dans CDM rail' @@ -2303,7 +2303,7 @@ object FormConfig: TFormConfig Left = 8 Top = 160 Width = 273 - Height = 97 + Height = 113 Caption = 'Repr'#233'sentation' TabOrder = 4 object LabelHG: TLabel @@ -2525,7 +2525,7 @@ object FormConfig: TFormConfig end object GroupBox21: TGroupBox Left = 8 - Top = 288 + Top = 304 Width = 273 Height = 97 Caption = 'Initialisation de l'#39'aiguillage en mode autonome' @@ -2665,6 +2665,13 @@ object FormConfig: TFormConfig Caption = 'Tapez CTRL-Z pour annuler une modification r'#233'cente' WordWrap = True end + object LabelNumBranche: TLabel + Left = 464 + Top = 424 + Width = 56 + Height = 13 + Caption = 'Branche n'#176' ' + end object GroupBox20: TGroupBox Left = 464 Top = 24 @@ -2712,7 +2719,7 @@ object FormConfig: TFormConfig Left = 0 Top = 24 Width = 457 - Height = 401 + Height = 417 Color = clBlack Font.Charset = DEFAULT_CHARSET Font.Color = clGreen @@ -2751,7 +2758,7 @@ object FormConfig: TFormConfig Left = 336 Top = 32 Width = 281 - Height = 393 + Height = 425 Caption = 'Description du signal' TabOrder = 0 object ImageSignal: TImage @@ -2796,7 +2803,7 @@ object FormConfig: TFormConfig end object Label17: TLabel Left = 8 - Top = 264 + Top = 288 Width = 228 Height = 26 Caption = @@ -2873,7 +2880,7 @@ object FormConfig: TFormConfig end object MemoCarre: TMemo Left = 8 - Top = 296 + Top = 320 Width = 265 Height = 89 ScrollBars = ssBoth @@ -2886,7 +2893,7 @@ object FormConfig: TFormConfig Top = 48 Width = 129 Height = 21 - ItemHeight = 0 + ItemHeight = 13 TabOrder = 1 OnChange = ComboBoxDecChange end @@ -2964,7 +2971,7 @@ object FormConfig: TFormConfig end object CheckVerrouCarre: TCheckBox Left = 120 - Top = 224 + Top = 232 Width = 145 Height = 17 Hint = @@ -3016,7 +3023,7 @@ object FormConfig: TFormConfig end object Buttonrestaure: TButton Left = 8 - Top = 200 + Top = 216 Width = 75 Height = 25 Hint = 'Restaure la configuration du feu d'#39'avant sa modification' @@ -3028,7 +3035,7 @@ object FormConfig: TFormConfig end object CheckBoxFB: TCheckBox Left = 120 - Top = 240 + Top = 256 Width = 153 Height = 17 Caption = 'Avec demande feu blanc' @@ -3037,7 +3044,7 @@ object FormConfig: TFormConfig end object ButtonConfigSR: TButton Left = 8 - Top = 232 + Top = 248 Width = 75 Height = 25 Caption = 'Configuration' @@ -3129,12 +3136,12 @@ object FormConfig: TFormConfig Left = 360 Top = 32 Width = 257 - Height = 385 + Height = 433 Caption = 'Description de l'#39'actionneur ' TabOrder = 0 object Label40: TLabel Left = 16 - Top = 328 + Top = 384 Width = 222 Height = 39 Caption = @@ -3144,9 +3151,9 @@ object FormConfig: TFormConfig end object GroupBoxPN: TGroupBox Left = 8 - Top = 24 + Top = 16 Width = 225 - Height = 289 + Height = 321 Caption = 'Actionneurs gestion passage '#224' niveau' TabOrder = 2 object Label21: TLabel @@ -3312,14 +3319,14 @@ object FormConfig: TFormConfig end object GroupBoxRadio: TGroupBox Left = 16 - Top = 24 + Top = 16 Width = 225 - Height = 81 + Height = 73 Caption = 'Type d'#39'actionneur ' TabOrder = 0 object RadioButtonLoc: TRadioButton Left = 24 - Top = 24 + Top = 16 Width = 193 Height = 17 Caption = 'Fonction F pour locomotive' @@ -3328,16 +3335,16 @@ object FormConfig: TFormConfig end object RadioButtonAccess: TRadioButton Left = 24 - Top = 40 + Top = 32 Width = 161 Height = 17 - Caption = 'Fonction F pour accessoire' + Caption = 'Accessoire' TabOrder = 1 OnClick = RadioButtonAccessClick end object RadioButtonSon: TRadioButton Left = 24 - Top = 56 + Top = 48 Width = 161 Height = 17 Caption = 'Son' @@ -3347,43 +3354,43 @@ object FormConfig: TFormConfig end object GroupBoxAct: TGroupBox Left = 16 - Top = 80 + Top = 92 Width = 225 - Height = 225 + Height = 293 Caption = 'Actionneur fonction de locomotive ' TabOrder = 1 object GroupBox18: TGroupBox Left = 8 - Top = 24 + Top = 16 Width = 209 - Height = 81 + Height = 137 Caption = 'D'#233'clencheur ' TabOrder = 0 object LabelActionneur: TLabel - Left = 16 - Top = 16 + Left = 8 + Top = 80 Width = 54 Height = 26 Caption = 'Actionneur D'#233'tecteurZ' WordWrap = True end object Label30: TLabel - Left = 136 - Top = 24 + Left = 168 + Top = 88 Width = 6 Height = 13 Caption = #224 end object LabelTrain: TLabel Left = 56 - Top = 54 + Top = 110 Width = 24 Height = 13 Caption = 'Train' end object EditAct: TEdit - Left = 88 - Top = 20 + Left = 72 + Top = 84 Width = 41 Height = 21 ParentShowHint = False @@ -3392,8 +3399,8 @@ object FormConfig: TFormConfig OnChange = EditActChange end object EditEtatActionneur: TEdit - Left = 152 - Top = 20 + Left = 184 + Top = 84 Width = 17 Height = 21 TabOrder = 1 @@ -3401,7 +3408,7 @@ object FormConfig: TFormConfig end object EditTrain: TEdit Left = 88 - Top = 52 + Top = 108 Width = 105 Height = 21 Hint = @@ -3412,12 +3419,46 @@ object FormConfig: TFormConfig TabOrder = 2 OnChange = EditTrainChange end + object RadioGroup1: TRadioGroup + Left = 8 + Top = 16 + Width = 193 + Height = 57 + Caption = 'Type de d'#233'clenchement' + TabOrder = 3 + end + object RadioButtonActDet: TRadioButton + Left = 32 + Top = 32 + Width = 161 + Height = 17 + Caption = 'Actionneur/D'#233'tecteur' + TabOrder = 4 + OnClick = RadioButtonActDetClick + end + object RadioButtonZones: TRadioButton + Left = 32 + Top = 48 + Width = 161 + Height = 17 + Caption = 'Zones de d'#233'tection' + TabOrder = 5 + OnClick = RadioButtonZonesClick + end + object EditAct2: TEdit + Left = 120 + Top = 84 + Width = 41 + Height = 21 + TabOrder = 6 + OnChange = EditAct2Change + end end object GroupBox19: TGroupBox Left = 8 - Top = 112 + Top = 160 Width = 209 - Height = 105 + Height = 97 Caption = 'Action ' TabOrder = 1 object LabelTempo: TLabel @@ -3446,14 +3487,14 @@ object FormConfig: TFormConfig end object LabelNomSon: TLabel Left = 16 - Top = 40 + Top = 32 Width = 91 Height = 13 Caption = 'Nom du fichier son:' end object SpeedButtonJoue: TSpeedButton - Left = 80 - Top = 64 + Left = 40 + Top = 56 Width = 41 Height = 33 Flat = True @@ -3471,6 +3512,69 @@ object FormConfig: TFormConfig 0000FFFFFFFFC0000000FFFFFFFFC0000000} OnClick = SpeedButtonJoueClick end + object SpeedButtonCharger: TSpeedButton + Left = 136 + Top = 60 + Width = 41 + Height = 30 + Flat = True + Glyph.Data = { + BA060000424DBA06000000000000360400002800000019000000170000000100 + 0800000000008402000000000000000000000001000000000000000000000000 + 80000080000000808000800000008000800080800000C0C0C000C0DCC000F0CA + A6000020400000206000002080000020A0000020C0000020E000004000000040 + 20000040400000406000004080000040A0000040C0000040E000006000000060 + 20000060400000606000006080000060A0000060C0000060E000008000000080 + 20000080400000806000008080000080A0000080C0000080E00000A0000000A0 + 200000A0400000A0600000A0800000A0A00000A0C00000A0E00000C0000000C0 + 200000C0400000C0600000C0800000C0A00000C0C00000C0E00000E0000000E0 + 200000E0400000E0600000E0800000E0A00000E0C00000E0E000400000004000 + 20004000400040006000400080004000A0004000C0004000E000402000004020 + 20004020400040206000402080004020A0004020C0004020E000404000004040 + 20004040400040406000404080004040A0004040C0004040E000406000004060 + 20004060400040606000406080004060A0004060C0004060E000408000004080 + 20004080400040806000408080004080A0004080C0004080E00040A0000040A0 + 200040A0400040A0600040A0800040A0A00040A0C00040A0E00040C0000040C0 + 200040C0400040C0600040C0800040C0A00040C0C00040C0E00040E0000040E0 + 200040E0400040E0600040E0800040E0A00040E0C00040E0E000800000008000 + 20008000400080006000800080008000A0008000C0008000E000802000008020 + 20008020400080206000802080008020A0008020C0008020E000804000008040 + 20008040400080406000804080008040A0008040C0008040E000806000008060 + 20008060400080606000806080008060A0008060C0008060E000808000008080 + 20008080400080806000808080008080A0008080C0008080E00080A0000080A0 + 200080A0400080A0600080A0800080A0A00080A0C00080A0E00080C0000080C0 + 200080C0400080C0600080C0800080C0A00080C0C00080C0E00080E0000080E0 + 200080E0400080E0600080E0800080E0A00080E0C00080E0E000C0000000C000 + 2000C0004000C0006000C0008000C000A000C000C000C000E000C0200000C020 + 2000C0204000C0206000C0208000C020A000C020C000C020E000C0400000C040 + 2000C0404000C0406000C0408000C040A000C040C000C040E000C0600000C060 + 2000C0604000C0606000C0608000C060A000C060C000C060E000C0800000C080 + 2000C0804000C0806000C0808000C080A000C080C000C080E000C0A00000C0A0 + 2000C0A04000C0A06000C0A08000C0A0A000C0A0C000C0A0E000C0C00000C0C0 + 2000C0C04000C0C06000C0C08000C0C0A000F0FBFF00A4A0A000808080000000 + FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00FFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000FF0A0A00FFFFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000FF272727271C120A00FFFFFFFFFF + FFFFFFFFFFFFFFFFFFFFFF000000FF27BF7F77776F2727271D130A0000FFFFFF + FFFFFFFFFFFFFF000000FF26F6BFBFBF7F7F7F77776F2F27271D130A0000FFFF + FFFFFF000000FF2F6FF6BFBFBFBFBF7F7F7F7F7F7F6F2F2F270AFFFFFFFFFF00 + 0000FF2727F6BFBFBFBFBFBF7F7F7F7F7F7F7F7F7726FFFFFFFFFF000000FF27 + 6FF6BFBFBFBFBFBFBF7F7F7F7F7F7F7F7F2F00FFFFFFFF000000FF27BF6FF6BF + BFBFBFBFBFBF7F7F7F7F7F7F7F771CFFFFFFFF000000FF27BF27F6BFBFBFBFBF + BFBFBF7F7F7F7F7F7FBF2F00FFFFFF000000FF27BF2FF6BFBFBFBFBFBFBFBFBF + 7F7F7F7F7FBF7713FFFFFF000000FF277F376FF6BFBFBFBFBFBFBFBFBF7F7F7F + 7F7FBF2F00FFFF000000FF277F3727F6BFBFBFBFBFBFBFBFBFBF7F7F7F7FBF77 + 0AFFFF000000FF277F372F27276FF6F6F6F6F6BFBFBFBFBF7F7F7FBF2700FF00 + 0000FF277F37373737372F2F27276F77BFBFBFBFBFBFBFBF6F0AFF000000FF27 + 7F373737373737373737372F2F276F6F7777777F7F1DFF000000FF277F373737 + 3737373737373737373737372F6F2F272727FF000000FF277F37373737373737 + 3737373737373737377FBF270A0AFF000000FF277F373737373737377FBFBFBF + BFBFBFBFBFF6270AFFFFFF000000FF277F373737373737372666272727272727 + 272752FFFFFFFF000000FF27BFBFBFBFBFBFBFBF25FFFFFFFFFFFFFFFFFFFFFF + FFFFFF000000FF266F2727272727276F13FFFFFFFFFFFFFFFFFFFFFFFFFFFF00 + 0000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000} + OnClick = SpeedButtonChargerClick + end object EditTempo: TEdit Left = 112 Top = 46 @@ -3481,7 +3585,7 @@ object FormConfig: TFormConfig end object CheckRAZ: TCheckBox Left = 32 - Top = 80 + Top = 40 Width = 145 Height = 17 Caption = 'Remise '#224' 0 apr'#232's pilotage' @@ -3493,7 +3597,7 @@ object FormConfig: TFormConfig Top = 18 Width = 25 Height = 21 - Hint = 'Num'#233'ro de fonction du d'#233'codeur du train' + Hint = 'Num'#233'ro de fonction du d'#233'codeur du train (0 '#224' 12 ou 28)' ParentShowHint = False ShowHint = True TabOrder = 2 @@ -3508,14 +3612,26 @@ object FormConfig: TFormConfig OnChange = EditEtatFoncSortieChange end object EditSon: TEdit - Left = 16 - Top = 48 + Left = 8 + Top = 64 Width = 177 Height = 21 TabOrder = 4 OnChange = EditSonChange end end + object ButtonTestAct: TButton + Left = 64 + Top = 264 + Width = 89 + Height = 25 + Hint = 'Test de l'#39'actionneur/d'#233'tecteur en mode RUN' + Caption = 'Test actionneur' + ParentShowHint = False + ShowHint = True + TabOrder = 2 + OnClick = ButtonTestActClick + end end end object GroupBox14: TGroupBox @@ -3614,4 +3730,8 @@ object FormConfig: TFormConfig end end end + object OpenDialogSon: TOpenDialog + Left = 708 + Top = 500 + end end diff --git a/UnitConfig.pas b/UnitConfig.pas index 6f3e1cc..9a3f57a 100644 --- a/UnitConfig.pas +++ b/UnitConfig.pas @@ -241,6 +241,14 @@ type EditTempoFeu: TEdit; Label35: TLabel; Label36: TLabel; + ButtonTestAct: TButton; + RadioGroup1: TRadioGroup; + RadioButtonActDet: TRadioButton; + RadioButtonZones: TRadioButton; + EditAct2: TEdit; + OpenDialogSon: TOpenDialog; + SpeedButtonCharger: TSpeedButton; + LabelNumBranche: TLabel; procedure ButtonAppliquerEtFermerClick(Sender: TObject); procedure FormActivate(Sender: TObject); procedure FormCreate(Sender: TObject); @@ -334,6 +342,11 @@ type procedure EditSonChange(Sender: TObject); procedure SpeedButtonJoueClick(Sender: TObject); procedure EditTempoFeuChange(Sender: TObject); + procedure ButtonTestActClick(Sender: TObject); + procedure RadioButtonActDetClick(Sender: TObject); + procedure RadioButtonZonesClick(Sender: TObject); + procedure EditAct2Change(Sender: TObject); + procedure SpeedButtonChargerClick(Sender: TObject); private { Déclarations privées } public @@ -373,11 +386,11 @@ section_branches_ch='[section_branches]'; var FormConfig: TFormConfig; - AdresseIPCDM,AdresseIP,PortCom,recuCDM,residuCDM : string; + AdresseIPCDM,AdresseIP,PortCom,recuCDM,residuCDM,trainsauve : string; portCDM,TempoOctet,TimoutMaxInterface,Valeur_entete,Port,protocole,NumPort, LigneCliqueePN,AncLigneCliqueePN,clicMemo, ligneclicAig,AncLigneClicAig,ligneClicSig,AncligneClicSig, - ligneClicBr,AncligneClicBr,ligneClicAct,AncLigneClicAct,indexfeuclic : integer; + ligneClicBr,AncligneClicBr,ligneClicAct,AncLigneClicAct,indexfeuclic,NumTrameCDM : integer; ack_cdm,clicliste,entreeTCO,affevt,config_modifie,clicproprietes : boolean; fichier : text; @@ -794,7 +807,7 @@ var s,chaine,sa : string; c : char; multiple,fini : boolean; begin - if i=0 then + if i=0 then begin AfficheDebug('Erreur 670 : index nul',clred); exit; @@ -890,6 +903,11 @@ begin begin val(s,adr,erreur); // extraire l'adresse Delete(s,1,k); + if Adr>NbMemZone then + begin + Affiche('Erreur 677A : ligne '+chaine_signal+' : adresse détecteur trop grand',clred); + Adr:=NbMemZone; + end; end; inc(j); if (j=1) then feux[i].Adr_det1:=adr; @@ -1029,8 +1047,18 @@ var s : string; begin // adresse adresse:=Tablo_Actionneur[i].adresse; - s:=IntToSTR(adresse); - if tablo_actionneur[i].det then s:=s+'Z'; + + + if Tablo_Actionneur[i].typActMemZone=0 then + begin + s:=IntToSTR(adresse); if tablo_actionneur[i].det then s:=s+'Z'; + end + else + begin + s:='Mem['+IntToSTR(adresse)+','+IntToSTR(Tablo_Actionneur[i].adresse2)+']'; + end; + + if Tablo_Actionneur[i].loco then s:=s+','+IntToSTR(Tablo_Actionneur[i].Etat)+','+Tablo_Actionneur[i].train+',F'+IntToSTR(Tablo_Actionneur[i].fonction)+','+intToSTR(Tablo_Actionneur[i].tempo); @@ -1262,7 +1290,9 @@ var s,sa,chaine,SOrigine: string; postjd,postjs,nv,it,Num_Champ,asp,adraig : integer; function lit_ligne : string ; - var esp : integer; + var esp,l1,l2,k : integer; + guim : boolean; + sp : string; begin repeat readln(fichier,s); @@ -1270,11 +1300,13 @@ var s,sa,chaine,SOrigine: string; s:=uppercase(s); if length(s)>0 then c:=s[1]; until ((c<>'/') and (s<>'')) or eof(fichier) ; - // supprime les espaces éventuels + // supprime les espaces éventuels sauf entre les guillements + esp:=0; repeat - esp:=pos(' ',s); - if esp<>0 then delete(s,esp,1); - until esp=0; + l1:=pos('"',s);l2:=posEx('"',s,l1+1); + esp:=posEx(' ',s,Esp+1); + if (esp<>0) and (espl2) then delete(s,esp,1); + until esp=0; lit_ligne:=s; end; @@ -1297,11 +1329,11 @@ end; procedure compile_branches; begin - // branches - NDetecteurs:=0; + // branches + NDetecteurs:=0; Nligne:=1; i_detect:=1; - i:=1; + i:=1; Affiche('Définition des branches',clyellow); repeat @@ -1312,12 +1344,12 @@ begin j:=1;offset:=1; inc(Nligne); compile_branche(s,i); - inc(i); + inc(i); end; until (s='0') or eof(fichier); NbreBranches:=i-1; end; - + procedure compile_actionneurs; var i : integer; begin @@ -1327,6 +1359,8 @@ begin Tablo_actionneur[i].train:=''; Tablo_actionneur[i].etat:=0; Tablo_actionneur[i].adresse:=0; + Tablo_actionneur[i].adresse2:=0; + Tablo_Actionneur[i].typActMemZone:=0; Tablo_actionneur[i].accessoire:=0; Tablo_actionneur[i].sortie:=0; Tablo_actionneur[i].fichierSon:=''; @@ -1343,10 +1377,38 @@ begin // définition des actionneurs repeat s:=lit_ligne; - // vérifier si F ou A ou " au 4eme champ sa:=s; sOrigine:=s; - i:=pos(',',sa); - if i>0 then delete(sa,1,i) else s:='0'; + + i:=pos('MEM[',sOrigine); + if i>0 then + begin + Tablo_actionneur[maxtablo_act].typActMemZone:=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 (pos('MEM[',sOrigine)=0) then // si pas détecteur de PN + begin + Tablo_actionneur[maxtablo_act].typActMemZone:=0; // type actionneur + val(sa,j,erreur); + Tablo_actionneur[maxtablo_act].adresse:=j; + Tablo_actionneur[maxTablo_act].det:=sa[erreur]='Z'; + 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); @@ -1363,17 +1425,9 @@ begin i:=pos(',',s); if i<>0 then begin - val(copy(s,1,i-1),j,erreur); - Tablo_actionneur[maxTablo_act].det:=s[erreur]='Z'; - Tablo_actionneur[maxTablo_act].adresse:=j; - Delete(s,1,i); - i:=pos(',',s); - if i<>0 then - begin - i:=pos(',',s); - val(copy(s,1,i-1),j,erreur); + val(s,j,erreur); Tablo_actionneur[maxTablo_act].etat:=j; - Delete(s,1,i); + Delete(s,1,erreur); i:=pos(',',s); Tablo_actionneur[maxTablo_act].train:=copy(s,1,i-1); @@ -1384,7 +1438,6 @@ begin i:=pos('"',s); Tablo_actionneur[maxTablo_act].fichierSon:=copy(s,1,i-1); inc(maxTablo_act); - end; end; end; @@ -1398,17 +1451,9 @@ begin i:=pos(',',s); if i<>0 then begin - val(copy(s,1,i-1),j,erreur); - Tablo_actionneur[maxTablo_act].det:=s[erreur]='Z'; - Tablo_actionneur[maxTablo_act].adresse:=j; - Delete(s,1,i); - i:=pos(',',s); - if i<>0 then - begin - i:=pos(',',s); - val(copy(s,1,i-1),j,erreur); + val(s,j,erreur); Tablo_actionneur[maxTablo_act].etat:=j; - Delete(s,1,i); + Delete(s,1,erreur); i:=pos(',',s); Tablo_actionneur[maxTablo_act].train:=copy(s,1,i-1); @@ -1440,7 +1485,6 @@ begin end; s:='';i:=0; end; - end; end; @@ -1455,17 +1499,9 @@ begin i:=pos(',',s); if i<>0 then begin - val(copy(s,1,i-1),j,erreur); - Tablo_actionneur[maxTablo_act].det:=s[erreur]='Z'; - Tablo_actionneur[maxTablo_act].adresse:=j; - Delete(s,1,i); - i:=pos(',',s); - if i<>0 then - begin - i:=pos(',',s); - val(copy(s,1,i-1),j,erreur); + val(s,j,erreur); Tablo_actionneur[maxTablo_act].etat:=j; - Delete(s,1,i); + Delete(s,1,erreur); i:=pos(',',s); Tablo_actionneur[maxTablo_act].train:=copy(s,1,i-1); @@ -1489,7 +1525,6 @@ begin end; s:='';i:=0; end; - end; end; // Passage à niveau @@ -2500,8 +2535,8 @@ begin LabelInfo.Width:=253;LabelInfo.Height:=25; LabelResult.width:=137;LabelResult.Height:=25; LabelNomSon.top:=16;LabelNomSon.Left:=48; - SpeedButtonJoue.Top:=64; SpeedButtonJoue.Left:=80; - EditSon.Top:=44;EditSon.Left:=16; + SpeedButtonJoue.Top:=60; SpeedButtonCharger.Top:=60; + EditSon.Top:=38;EditSon.Left:=16; CheckVerifVersion.Checked:=verifVersion; CheckFenEt.Checked:=Fenetre=1; @@ -2903,19 +2938,35 @@ begin RadioButtonSon.Checked:=false; EditSon.Visible:=false; SpeedButtonJoue.Visible:=false; + SpeedButtonCharger.Visible:=false; + LabelNomSon.Visible:=false; end; end; +procedure positionne; +begin + with formconfig do + begin + GroupBoxRadio.Visible:=true; + GroupBoxRadio.top:=16; + GroupBoxRadio.Left:=16; + GroupBoxAct.Top:=92; + GroupBoxAct.Left:=16; + GroupBoxAct.Height:=292; + GroupBox18.Top:=16; + GroupBox18.Height:=136; + GroupBox19.Top:=160; + GroupBox19.Height:=96; + end; +end; + procedure champs_type_loco; begin with formconfig do begin - GroupBoxRadio.Visible:=true; - GroupBoxRadio.top:=20; - GroupBoxRadio.Left:=16; - GroupBoxAct.Top:=104; - GroupBoxAct.Left:=16; + positionne; + CheckRaz.Visible:=false; GroupBoxAct.Caption:='Actionneur de fonction F de locomotive'; LabelTempo.Visible:=true; EditTempo.visible:=true; editEtatFoncSortie.visible:=false;LabelA.Visible:=false; @@ -2928,6 +2979,7 @@ begin GroupBoxPN.Visible:=false; EditSon.Visible:=false; SpeedButtonJoue.Visible:=false; + SpeedButtonCharger.Visible:=false; EditFonctionAccess.Visible:=true; LabelNomSon.Visible:=false; end; @@ -2937,11 +2989,8 @@ procedure champs_type_act; begin with formconfig do begin - GroupBoxRadio.Visible:=true; - GroupBoxRadio.top:=20; - GroupBoxRadio.Left:=16; - GroupBoxAct.Top:=104; - GroupBoxAct.Left:=16; + positionne; + GroupBoxAct.Caption:='Actionneur d''accessoire'; CheckRaz.Visible:=true; LabelTempo.Visible:=false; EditTempo.visible:=false;editEtatFoncSortie.visible:=true;LabelA.Visible:=true; @@ -2954,6 +3003,7 @@ begin GroupBoxPN.Visible:=false; EditSon.Visible:=false; SpeedButtonJoue.Visible:=false; + SpeedButtonCharger.Visible:=false; EditFonctionAccess.Visible:=true; LabelNomSon.Visible:=false; end; @@ -2963,11 +3013,7 @@ procedure champs_type_son; begin with formconfig do begin - GroupBoxRadio.Visible:=true; - GroupBoxRadio.top:=20; - GroupBoxRadio.Left:=16; - GroupBoxAct.Top:=104; - GroupBoxAct.Left:=16; + Positionne; GroupBoxAct.Caption:='Actionneur d''accessoire'; CheckRaz.Visible:=true; @@ -2980,6 +3026,7 @@ begin CheckRaz.Visible:=false; EditSon.Visible:=true; SpeedButtonJoue.Visible:=true; + SpeedButtonCharger.Visible:=true; LabelNomSon.Visible:=true; RadioButtonLoc.Checked:=false; @@ -3147,7 +3194,7 @@ end; // mise à jour des champs graphiques des actionneurs d'après l'index du richAct Procedure aff_champs_act(i : integer); -var etatact, adresse,sortie,fonction,tempo,access : integer; +var etatact, adresse,sortie,fonction,tempo,access,typ : integer; s,s2,adr : string; det : boolean; begin @@ -3159,6 +3206,22 @@ begin fonction:=Tablo_actionneur[i].fonction; Access:=Tablo_actionneur[i].accessoire; det:=Tablo_actionneur[i].det; + typ:=Tablo_actionneur[i].typActMemZone; + + with formconfig do + begin + if typ=0 then + begin + EditTrain.Visible:=true ; + LabelTrain.Visible:=true ; + end + else + begin + EditTrain.Visible:=false; + LabelTrain.Visible:=false; + end; + end; + if det then s2:='Détecteur ' else s2:='Actionneur '; s2:=s2+intToSTR(Tablo_actionneur[i].adresse); FormConfig.EditAct.Hint:=s2; @@ -3167,15 +3230,34 @@ begin if Tablo_actionneur[i].loco then begin champs_type_loco; + + if typ=0 then with formconfig do + begin + radioButtonActDet.Checked:=true; + radioButtonZones.Checked:=false; + editAct2.Visible:=false; + LabelActionneur.Caption:='Actionneur DétecteurZ'; + end; + if typ=1 then with formconfig do + begin + radioButtonActDet.Checked:=false; + radioButtonZones.Checked:=true; + editAct2.Visible:=true; + LabelActionneur.Caption:='Mémoire de Zone'; + editAct2.Text:=IntToSTR(Tablo_actionneur[i].adresse2); + end; + etatAct:=Tablo_actionneur[i].etat; Adresse:=Tablo_actionneur[i].adresse; s2:=Tablo_actionneur[i].train; + trainsauve:=s2; tempo:=tablo_actionneur[i].Tempo; with formconfig do begin champs_type_loco; adr:=IntToSTR(Adresse); if det then adr:=adr+'Z'; EditAct.text:=adr; + EditAct2.Text:=inttostr(Tablo_actionneur[i].adresse2); editEtatActionneur.Text:=IntToSTR(etatAct); EditTrain.Text:=s2; editFonctionAccess.Text:=intToSTR(fonction); @@ -3187,15 +3269,32 @@ begin if Tablo_actionneur[i].act then begin champs_type_act; + if typ=0 then with formconfig do + begin + radioButtonActDet.Checked:=true; + radioButtonZones.Checked:=false; + editAct2.Visible:=false; + LabelActionneur.Caption:='Actionneur DétecteurZ'; + end; + if typ=1 then with formconfig do + begin + radioButtonActDet.Checked:=false; + radioButtonZones.Checked:=true; + editAct2.Visible:=true; + LabelActionneur.Caption:='Mémoire de Zone'; + end; + etatAct:=Tablo_actionneur[i].etat ; Adresse:=Tablo_actionneur[i].adresse; sortie:=Tablo_actionneur[i].sortie; s2:=Tablo_actionneur[i].train; + trainsauve:=s2; tempo:=tablo_actionneur[i].Tempo; with formconfig do begin adr:=IntToSTR(Adresse); if det then adr:=adr+'Z'; EditAct.text:=adr; + EditAct2.Text:=inttostr(Tablo_actionneur[i].adresse2); CheckRaz.Checked:=Tablo_actionneur[i].Raz; EditTrain.Text:=s2; EditEtatActionneur.Text:=IntToSTR(etatAct); @@ -3209,14 +3308,31 @@ begin if Tablo_actionneur[i].son then begin champs_type_son; + if typ=0 then with formconfig do + begin + radioButtonActDet.Checked:=true; + radioButtonZones.Checked:=false; + editAct2.Visible:=false; + LabelActionneur.Caption:='Actionneur DétecteurZ'; + end; + if typ=1 then with formconfig do + begin + radioButtonActDet.Checked:=false; + radioButtonZones.Checked:=true; + editAct2.Visible:=true; + LabelActionneur.Caption:='Mémoire de Zone'; + end; + etatAct:=Tablo_actionneur[i].etat ; Adresse:=Tablo_actionneur[i].adresse; s2:=Tablo_actionneur[i].train; + trainsauve:=s2; s:=Tablo_actionneur[i].FichierSon; with formconfig do begin adr:=IntToSTR(Adresse); if det then adr:=adr+'Z'; EditAct.text:=adr; + EditAct2.Text:=inttostr(Tablo_actionneur[i].adresse2); //CheckRaz.Checked:=Tablo_actionneur[i].Raz; EditTrain.Text:=s2; EditSon.Text:=s; @@ -4177,6 +4293,35 @@ begin end; end; + +procedure TFormConfig.EditAct2Change(Sender: TObject); +var s,s2 : string; + det2,erreur : integer; + det : boolean; +begin + if clicliste then exit; + if affevt then affiche('Evt Edit act2 Change',clyellow); + if FormConfig.PageControl.ActivePage=FormConfig.TabSheetAct then + with Formconfig do + begin + s:=EditAct2.Text; + if radioButtonLoc.Checked or RadioButtonAccess.Checked or RadioButtonSon.Checked then + begin + Val(s,det2,erreur); + if s='' then exit; + if erreur<>0 then + begin + LabelInfo.caption:='Erreur adresse détecteur';exit + end else LabelInfo.caption:=' '; + + tablo_actionneur[ligneClicAct+1].adresse2:=det2; + tablo_actionneur[ligneClicAct+1].det:=det; + s:=encode_act_loc_son(ligneClicAct+1); + RichAct.Lines[ligneClicAct]:=s; + end; + end; +end; + procedure TFormConfig.RichActMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); var ligne : integer; @@ -4516,7 +4661,8 @@ begin dessine_feu_mx(Feux[index].Img.Canvas,0,0,1,1,feux[index].adresse,1); // dessine les feux du signal end; -procedure Uni; + +procedure TFormConfig.EditSpecUniChange(Sender: TObject); var erreur,i,Adr : integer ; s : string ; begin @@ -4540,12 +4686,6 @@ begin s:=encode_sig_feux(ligneClicSig+1); RichSig.Lines[ligneClicSig]:=s; end; -end; - -procedure TFormConfig.EditSpecUniChange(Sender: TObject); -begin - if clicliste or (ligneClicSig<0) then exit; - uni; end; @@ -5233,10 +5373,39 @@ begin end; end; +// renvoie le numéro de branche en défaut +// si ok, renvoie 0 +Function verif_extr_branches : integer; +var i,j,detect,erreur : integer; + model,AncModel : Tequipement; +begin + Erreur:=0; + for i:=1 to NbreBranches do + begin + j:=1; + repeat + detect:=BrancheN[i][j].Adresse; + AncModel:=model; + model:=BrancheN[i][j].BType; + if (j=1) and (model<>Aig) and (Model<>Buttoir) then + begin + Affiche('Erreur 3.1 branche '+intToSTR(i)+' : le premier élément d''une branche doit être un buttoir ou un aiguillage',clred); + erreur:=i; + end; + inc(j); + until((model=rien) and (detect=0)); + if (Ancmodel<>Aig) and (AncModel<>Buttoir) then + begin + Affiche('Erreur 3.2 branche '+intToSTR(i)+' : le dernier élément d''une branche doit être un buttoir ou un aiguillage',clred); + erreur:=i; + end; + end; + verif_extr_branches:=Erreur; +end; function verif_coherence : boolean; var i,j,k,l,Indexaig,adr,adr2,detect,condcarre,nc,index2 : integer; - modAig,model,km: TEquipement; + modAig,AncModel,model,km: TEquipement; c : char; ok : boolean; begin @@ -5248,21 +5417,34 @@ begin j:=1; repeat detect:=BrancheN[i][j].Adresse; + + if detect>NbMemZone then + begin + Affiche('Erreur 1: adresse détecteur trop grand: '+intToSTR(detect),clred); + ok:=false; + end; + + AncModel:=model; model:=BrancheN[i][j].BType; // 1= détecteur 2= aiguillage 4=Buttoir + if (model=aig) then begin //affiche('trouvé aig '+intToSTR(detect),clyellow); modAig:=aiguillage[Index_Aig(detect)].modele; if (model=rien) then begin - Affiche('Erreur 1: Aiguillage '+intToStr(detect)+' non décrit mais présent en branche '+intToStr(i)+' pos. '+intToSTR(j),clred); + Affiche('Erreur 2: Aiguillage '+intToStr(detect)+' non décrit mais présent en branche '+intToStr(i)+' pos. '+intToSTR(j),clred); ok:=false; end; end; j:=j+1; until((model=rien) and (detect=0)); + if (Ancmodel<>Aig) and (AncModel<>Buttoir) then + Affiche('Erreur 3.2 branche '+intToSTR(i)+' : le dernier élément d''une branche doit être un buttoir ou un aiguillage',clred); end; + if verif_extr_branches<>0 then ok:=false; + // vérification de la cohérence2 // parcoure les aiguillages pour voir si les détecteurs sont en branches des détecteurs // et les tjd pour voir si pb de cohérence @@ -5555,7 +5737,11 @@ begin for Indexaig:=1 to maxaiguillage do begin adr:=aiguillage[indexaig].Adresse; - + if adr>NbMemZone then + begin + Affiche('Erreur 9.11: adresse aiguillage trop grand: '+intToSTR(adr),clred); + ok:=false; + end; adr2:=aiguillage[indexaig].ADroit; c:=aiguillage[indexaig].AdroitB; if (c='D') or (c='S') or (c='P') then @@ -6068,10 +6254,7 @@ begin 3 : aiguillage[i].modele:=triple; else aiguillage[i].modele:=rien; end; - - - ; - + s:=encode_aig(i); formconfig.RichAig.Lines[ligneclicAig]:=s; clicliste:=true; @@ -6099,14 +6282,13 @@ begin begin RichBranche.Lines[ligne-1]:=s; branche[ligne]:=s; // stocker la ligne dans la branche pour la compiler - if compile_branche(s,ligne) then + if compile_branche(s,ligne) then begin RE_ColorLine(RichBranche,Ligne-1,ClLime); end else begin RE_ColorLine(RichBranche,Ligne-1,ClRed); - labelResult.Caption:='Erreur de syntaxe'; ok:=false; end; inc(ligne); @@ -6117,7 +6299,16 @@ begin until ligne>RichBranche.Lines.count; NbreBranches:=ligne-1; - if ok then labelResult.Caption:='Syntaxe correcte'; + + ligne:=verif_extr_branches; + if ligne<>0 then + begin + ok:=false; + RE_ColorLine(RichBranche,Ligne-1,ClRed); + end; + + if ok then labelResult.Caption:='Syntaxe correcte' + else labelResult.Caption:='Erreur de syntaxe'; end; function virgule_suiv(sl : string;o : integer) : integer; @@ -6183,19 +6374,31 @@ begin Affiche('Erreur 17 champ '+se+' ligne '+s,clred); code:=false; end; + if adresse>NbMemZone then + begin + Affiche('Erreur 18 ligne '+s+' : adresse aiguillage trop grand: '+intToSTR(adresse),clred); + adresse:=NbMemZone; + code:=false; + end; BrancheN[i,j].adresse:=adresse; BrancheN[i,j].btype:=aig; // ident aiguillage end - else + else begin - Affiche('Erreur 18 champ '+se+' ligne '+s,clred); + Affiche('Erreur 19 champ '+se+' ligne '+s,clred); code:=false; erreur:=0; // forcer erreur à 0 pour obliger à passer sur un détecteur - end; + end; end; // détecteur if erreur=0 then begin + if detect>NbMemZone then + begin + Affiche('Erreur 20 ligne '+s+' : adresse détecteur trop grand: '+intToSTR(detect),clred); + detect:=NbMemZone; + code:=false; + end; BrancheN[i,j].adresse:=detect; // adresse BrancheN[i,j].btype:=det;// ident détecteur if detect=0 then begin BrancheN[i,j].btype:=buttoir;end; // buttoir @@ -6203,8 +6406,14 @@ begin bd:=0; repeat inc(bd); - trouve:=Adresse_detecteur[bd]=detect; - until ((bd=NDetecteurs+1) or trouve) ; + if bd>NbMaxDet then + begin + Affiche('Nombre maximal de détecteurs dépassé ('+IntToSTR(NbMaxDet)+')',clred); + code:=false; + end + else + trouve:=Adresse_detecteur[bd]=detect; + until ((bd=NDetecteurs+1) or trouve) or (bd>NbMaxDet) ; if not(trouve) then begin Adresse_detecteur[bd]:=detect; @@ -6216,6 +6425,11 @@ begin BrancheN[i,j].BType:=rien; //Affiche('branche '+intToSTR(i)+' index='+intToStr(j),clGreen); until (offset=0); + if j=2 then + begin + Affiche('Une branche doit contenir au moins deux éléments',clred); + code:=false; + end; compile_branche:=code; end; @@ -6229,6 +6443,7 @@ begin with Formconfig.RichBranche do begin lc:=Perform(EM_LINEFROMCHAR,-1,0); // numéro de la lignée cliquée + LabelNumBranche.Caption:='Branche n°'+intToSTR(lc+1); AncligneClicBr:=ligneClicBr; ligneClicBr:=lc; curseur:=SelStart; // position initiale du curseur @@ -6576,17 +6791,109 @@ end; procedure TFormConfig.SpeedButtonJoueClick(Sender: TObject); begin - if sndPlaySound(pchar(EditSon.Text),0)=false then + if PlaySound(pchar(EditSon.Text),0,SND_ASYNC)=false then labelInfo.Caption:='Erreur'; end; +procedure TFormConfig.ButtonTestActClick(Sender: TObject); +Var Adr,adr2,erreur,etat : integer; + train : string; begin + etat:=0; + val(EditEtatActionneur.Text,Etat,erreur); + val(EditAct.Text,Adr,erreur); + val(EditAct2.Text,Adr2,erreur); + if erreur=0 then + begin + train:=EditTrain.Text; + Event_act(adr,adr2,etat,train); + end; +end; + +procedure TFormConfig.RadioButtonActDetClick(Sender: TObject); +var i,champ,erreur : integer; + s : string; +begin + if clicListe then exit; + i:=ligneClicAct+1; + if AffEvt then Affiche('RadioBoutonActDet '+IntToSTR(i),clyellow); + Tablo_Actionneur[i].typActMemZone:=0; + LabelActionneur.Caption:='Actionneur DétecteurZ'; + editAct2.Visible:=false; + EditTrain.Visible:=true; + LabelTrain.Visible:=true; + + Tablo_Actionneur[i].train:=trainSauve; + EditTrain.Text:=trainSauve; + + val(editact.Text,champ,erreur); + Tablo_actionneur[i].adresse:=champ ; + val(editEtatActionneur.Text,champ,erreur); + Tablo_actionneur[i].etat:=champ; + Tablo_actionneur[i].train:=editTrain.Text; + val(editFonctionAccess.Text,champ,erreur); + Tablo_actionneur[i].fonction:=champ; + val(editEtatFoncSortie.Text,champ,erreur); + Tablo_actionneur[i].sortie:=champ; + val(editTempo.Text,champ,erreur); + Tablo_actionneur[i].tempo:=champ; + tablo_actionneur[i].Raz:=checkRaz.checked; + s:=encode_act_loc_son(i); + RichAct.Lines[ligneClicAct]:=s; + +end; +procedure TFormConfig.RadioButtonZonesClick(Sender: TObject); +var i,champ,erreur : integer; + s : string; +begin + if clicListe then exit; + i:=ligneClicAct+1; + if AffEvt then Affiche('RadioBoutonZones '+IntToSTR(i),clyellow); + Tablo_Actionneur[i].typActMemZone:=1; + LabelActionneur.Caption:='Mémoire de Zone'; + EditTrain.Visible:=false; + LabelTrain.Visible:=false; + editAct2.Visible:=true; + //editact.Text:=intToSTR(Tablo_actionneur[i].adresse2); + + Tablo_actionneur[i].train:='X'; + val(editact.Text,champ,erreur); + Tablo_actionneur[i].adresse:=champ ; + val(editEtatActionneur.Text,champ,erreur); + Tablo_actionneur[i].etat:=champ; + val(editFonctionAccess.Text,champ,erreur); + Tablo_actionneur[i].fonction:=champ; + val(editEtatFoncSortie.Text,champ,erreur); + Tablo_actionneur[i].sortie:=champ; + val(editTempo.Text,champ,erreur); + Tablo_actionneur[i].tempo:=champ; + tablo_actionneur[i].Raz:=checkRaz.checked; + s:=encode_act_loc_son(i); + RichAct.Lines[ligneClicAct]:=s; +end; +procedure TFormConfig.SpeedButtonChargerClick(Sender: TObject); +var s: string; +begin + s:=GetCurrentDir; + OpenDialogSon.InitialDir:=s; + OpenDialogSon.DefaultExt:='wav'; + OpenDialogSon.Title:='Ouvrir un fichier son'; + OpenDialogSon.Filter:='Fichiers wav (*.wav)|*.wav|Tous fichiers (*.*)|*.*'; + if openDialogSon.Execute then + begin + s:=openDialogSon.FileName; + editson.Text:=s; + end; +end; + +begin + end. diff --git a/UnitDebug.dcu b/UnitDebug.dcu index 0bca89d..02b74b7 100644 Binary files a/UnitDebug.dcu and b/UnitDebug.dcu differ diff --git a/UnitDebug.pas b/UnitDebug.pas index aaf8fbd..4739c63 100644 --- a/UnitDebug.pas +++ b/UnitDebug.pas @@ -98,19 +98,12 @@ type Const Max_Event_det_tick=30000; -Max_event_det=400; -Max_Trains=50; var FormDebug: TFormDebug; NivDebug,signalDebug : integer; AffSignal,AffAffect,initform,AffFD,debug_dec_sig : boolean; N_event_det : integer; // index du dernier évènement (de 1 à 20) - event_det : array[1..Max_event_det] of integer; - event_det_train : array[1..Max_Trains] of record - NbEl : integer; - Det : array[1..3] of integer; // tableau des evts détecteurs par train - end; N_Event_tick : integer ; // dernier index // tableau des évènements détecteurs et aiguillages @@ -453,9 +446,10 @@ procedure TFormDebug.ButtonSimuAct1Click(Sender: TObject); var det,erreur : integer; begin val(EditSimuDet.Text,det,erreur); + if erreur=0 then begin - Event_Act(det,1,''); + Event_Act(det,0,1,''); end; end; @@ -465,7 +459,7 @@ begin val(EditSimuDet.Text,det,erreur); if erreur=0 then begin - Event_Act(det,0,''); + Event_Act(det,0,0,''); end; end; diff --git a/UnitPrinc.dcu b/UnitPrinc.dcu index 1d608b1..ef59693 100644 Binary files a/UnitPrinc.dcu and b/UnitPrinc.dcu differ diff --git a/UnitPrinc.dfm b/UnitPrinc.dfm index 3fee47c..62eaa08 100644 --- a/UnitPrinc.dfm +++ b/UnitPrinc.dfm @@ -1440,8 +1440,8 @@ object FormPrinc: TFormPrinc OnMouseDown = FenRichMouseDown end object GroupBox2: TGroupBox - Left = 681 - Top = 64 + Left = 697 + Top = 56 Width = 265 Height = 105 Anchors = [akTop, akRight] @@ -1457,7 +1457,7 @@ object FormPrinc: TFormPrinc end object LabelVCV: TLabel Left = 208 - Top = 15 + Top = 55 Width = 47 Height = 13 Caption = 'Valeur CV' @@ -1507,41 +1507,56 @@ object FormPrinc: TFormPrinc Width = 265 Height = 105 Anchors = [akTop, akRight] - Caption = 'Commande vitesse trains' + Caption = 'Commande aux trains' TabOrder = 9 object Label4: TLabel Left = 8 - Top = 30 + Top = 22 Width = 67 Height = 13 Caption = 'Adresse train :' end object Label5: TLabel Left = 8 - Top = 68 + Top = 44 Width = 74 Height = 13 Caption = 'Vitesse train % :' end + object LabelFonction: TLabel + Left = 144 + Top = 44 + Width = 47 + Height = 13 + Caption = 'Fonction: ' + end + object Label6: TLabel + Left = 224 + Top = 44 + Width = 9 + Height = 13 + Caption = #224' ' + end object loco: TButton - Left = 142 - Top = 56 + Left = 6 + Top = 64 Width = 83 Height = 33 - Caption = 'Envoi '#224' loco' + Caption = 'Envoi vitesse '#224' loco' TabOrder = 0 + WordWrap = True OnClick = locoClick end object EditAdrTrain: TEdit Left = 80 - Top = 24 + Top = 16 Width = 25 Height = 21 TabOrder = 1 end object EditVitesse: TEdit Left = 80 - Top = 64 + Top = 40 Width = 25 Height = 21 TabOrder = 2 @@ -1549,13 +1564,48 @@ object FormPrinc: TFormPrinc end object ComboTrains: TComboBox Left = 112 - Top = 24 + Top = 16 Width = 145 Height = 21 ItemHeight = 13 TabOrder = 3 OnChange = ComboTrainsChange end + object EditNumFonction: TEdit + Left = 192 + Top = 40 + Width = 25 + Height = 21 + Hint = 'Fonction de 0 '#224' 12 ou 28' + TabOrder = 4 + end + object ButtonFonction: TButton + Left = 176 + Top = 64 + Width = 81 + Height = 33 + Caption = 'Envoi fonction '#224' loco' + TabOrder = 6 + WordWrap = True + OnClick = ButtonFonctionClick + end + object EditFonc01: TEdit + Left = 240 + Top = 40 + Width = 17 + Height = 21 + TabOrder = 5 + end + object Button1: TButton + Left = 96 + Top = 72 + Width = 75 + Height = 25 + Caption = 'Button1' + TabOrder = 7 + Visible = False + OnClick = Button1Click + end end object Timer1: TTimer Interval = 100 @@ -1726,7 +1776,7 @@ object FormPrinc: TFormPrinc end end object PopupMenuFeu: TPopupMenu - Left = 856 + Left = 760 Top = 144 object Proprits1: TMenuItem Caption = 'Propri'#233't'#233's' diff --git a/UnitPrinc.pas b/UnitPrinc.pas index 8e4222c..d772156 100644 --- a/UnitPrinc.pas +++ b/UnitPrinc.pas @@ -3,7 +3,7 @@ Unit UnitPrinc; programme signaux complexes Graphique Lenz delphi 7 + activeX Tmscomm + clientSocket ******************************************** - 21/2/2022 14h00 + 27/2/2022 10h note sur le pilotage des accessoires: raquette octet sortie + 2 = aiguillage droit = sortie 2 de l'adresse d'accessoire @@ -111,6 +111,12 @@ type Label5: TLabel; EditVitesse: TEdit; ComboTrains: TComboBox; + LabelFonction: TLabel; + EditNumFonction: TEdit; + ButtonFonction: TButton; + EditFonc01: TEdit; + Label6: TLabel; + Button1: TButton; procedure FormCreate(Sender: TObject); procedure MSCommUSBLenzComm(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); @@ -171,8 +177,9 @@ type procedure FenRichMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); procedure ButtonLocCVClick(Sender: TObject); - procedure Button1Click(Sender: TObject); procedure ComboTrainsChange(Sender: TObject); + procedure ButtonFonctionClick(Sender: TObject); + procedure Button1Click(Sender: TObject); private { Déclarations privées } procedure DoHint(Sender : Tobject); @@ -187,6 +194,10 @@ const titre='Signaux complexes GL '; espY = 15; // espacement Y entre deux lignes de feux MaxAcc=2048; // adresse maxi d'accessoire XpressNet +NbMaxDet=100; // nombre maximal de détecteurs d'un réseau +NbMemZone=2048; // adresse maximale des détecteurs +Max_Trains=100; +Max_event_det=400; LargImg=50;HtImg=91; // Dimensions image des feux const_droit=2; // positions aiguillages transmises par la centrale LENZ const_devie=1; // positions aiguillages transmises par la centrale LENZ @@ -211,7 +222,7 @@ Etats : array[0..19] of string[30]=('Non command '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 +type Taccessoire = (aigP,feu); // aiguillage ou feu TMA = (valide,devalide); TEquipement = (rien,aig,tjd,tjs,triple,det,buttoir,voie); // voie uniquement pour le tco @@ -279,7 +290,7 @@ TFeu = record Btype_suiv4 : TEquipement ; // VerrouCarre : boolean ; // si vrai, le feu se verrouille au carré si pas de train avant le signal modifie : boolean; // feu modifié - EtatSignal : word ; // comme EtatSignalCplx + EtatSignal : word ; // comme EtatSignalCplx (doublon) UniSemaf : integer ; // définition supplémentaire de la cible pour les décodeurs UNISEMAF AigDirection : array[1..6] 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 @@ -290,18 +301,18 @@ TFeu = record Adresse : integer; // aiguillage posAig : char; end; - SR : array[1..8] of record // décodeur Stéphane Ravaut + SR : array[1..8] of record // configuration du décodeur Stéphane Ravaut sortie1,sortie0 : integer; end; end; - + var - ancien_tablo_signalCplx,EtatsignalCplx : array[0..MaxAcc] of word; + ancien_tablo_signalCplx,EtatsignalCplx : array[0..MaxAcc] of word; // attention tableau indicé par l'adresse du signal et non son index!! tempsCli,NbreFeux,pasreponse,AdrDevie,fenetre,Tempo_Aig,Tempo_feu, NombreImages,signalCpx,branche_trouve,Indexbranche_trouve,Actuel,Signal_suivant, Nbre_recu_cdm,Tempo_chgt_feux,Adj1,Adj2,NbrePN,ServeurInterfaceCDM, - ServeurRetroCDM,TailleFonte,Nb_Det_Dist,Tdoubleclic,algo_Unisemaf : integer; + ServeurRetroCDM,TailleFonte,Nb_Det_Dist,Tdoubleclic,algo_Unisemaf,fA,fB,AdrTrain : integer; Hors_tension2,traceSign,TraceZone,Ferme,parSocketLenz,ackCdm,PremierFD,doubleclic, NackCDM,MsgSim,succes,recu_cv,AffActionneur,AffAigDet,Option_demarrage,AffTiers, @@ -319,8 +330,8 @@ var maxaiguillage,detecteur_chgt,Temps,Tempo_init,Suivant,ntrains, NbreImagePligne,NbreBranches,Index2_det,Index2_aig,branche_det,Index_det, I_simule,maxTablo_act,NbreVoies,AdresseFeuSuivant,El_suivant : integer; - Ancien_detecteur : array[0..1024] of boolean; // anciens état des détecteurs et adresses des détecteurs et leur état - detecteur : array[0..1024] of + Ancien_detecteur : array[0..NbMemZone] of boolean; // anciens état des détecteurs et adresses des détecteurs et leur état + detecteur : array[0..NbMemZone] of record etat : boolean; tempo : integer; @@ -328,17 +339,22 @@ var end; TypeGen : TEquipement; - Adresse_detecteur : array[0..60] of integer; // adresses des détecteurs par index - MemZone : array[0..1024,0..1024] of boolean ; // mémoires de zones des détecteurs + Adresse_detecteur : array[0..NbMaxDet] of integer; // adresses des détecteurs par index + + MemZone : array[0..NbMemZone,0..NbMemZone] of boolean ; // mémoires de zones des détecteurs + Tablo_actionneur : array[1..100] of record - loco,act,son : boolean; // type loco actionneur ou son - adresse,etat,fonction,tempo,TempoCourante, - accessoire,sortie : integer; + loco,act,son: boolean; // type loco actionneur ou son + adresse,adresse2, // adresse: adresse de base ; adresse2=cas d'une Zone + etat,fonction,tempo,TempoCourante, + accessoire,sortie, + typActMemZone : integer; // 0=actioneur 1=MemZone Raz : boolean; det : boolean; // désigne un détecteur FichierSon,train : string; end; + KeyInputs: array of TInput; Tablo_PN : array[1..20] of record @@ -368,10 +384,15 @@ var aiguillage : array[0..MaxAcc] of Taiguillage; // signaux - L'index du tableau n'est pas son adresse feux : array[1..MaxAcc] of Tfeu; - trains : array[1..100] of record + trains : array[1..Max_Trains] of record nom_train : string; adresse,vitmax : integer; end; + event_det : array[1..Max_event_det] of integer; + event_det_train : array[1..Max_Trains] of record + NbEl : integer; + Det : array[1..3] of integer; // tableau des evts détecteurs par train + end; Feu_supprime,Feu_sauve : Tfeu; Aig_supprime,Aig_sauve : TAiguillage; @@ -412,7 +433,7 @@ function PresTrainPrec(Adresse : integer) : boolean; function cond_carre(adresse : integer) : boolean; function carre_signal(adresse : integer) : boolean; procedure Event_Detecteur(Adresse : integer;etat : boolean;train : string); -procedure Event_act(adr,etat : integer;train : string); +procedure Event_act(adr,adr2,etat : integer;train : string); function verif_UniSemaf(adresse,UniSem : integer) : integer; function Select_dessin_feu(TypeFeu : integer) : TBitmap; procedure cree_image(rang : integer); @@ -1453,7 +1474,7 @@ var i,timeout,valto : integer; begin // com:=formprinc.MSCommUSBLenz; s:=entete+s+suffixe; - if traceTrames then AfficheDebug('Tick='+IntToSTR(tick)+'/Env '+chaine_Hex(s),ClGreen); + if traceTrames then AfficheDebug('Tick='+IntToSTR(tick)+'/Env '+chaine_Hex(s),ClLime); // par port com-usb if portCommOuvert then @@ -1531,23 +1552,22 @@ Function chaine_CDM_Func(fonction,etat : integer;train : string) : string; var so,sx,s : string; begin { exemple de commande envoyée au serveur pour une fonction - C-C-00-0002-CMDTRN-DCCSF|029|03|NAME=nomdutrain;CSTEP=0;FXnumfonction=etat; + C-C-00-0002-CMDTRN-DCCSF|029|02|NAME=nomdutrain;FXnumfonction=etat; - C-C-00-0002-CMDTRN-DCCSF|029|03|NAME=train;CSTEP=0;FX0=0; - C-C-00-0002-CMDTRN-DCCSF|029|03|NAME=train;CSTEP=0;FX1=0; - C-C-00-0002-CMDTRN-DCCSF|047|06|NAME=train;CSTEP=0;FX0=1;FX1=1;FX2=1;FX3=1; - maxi=C-C-00-0002-CMDTRN-DCCSF|111|16|NAME=train;CSTEP=0;FX0=1;FX1=1;FX2=1;FX3=1;FX4=0;FX5=0;FX6=0;FX7=0;FX8=0;FX9=0;FX10=0;FX11=0;FX12=0;FX13=0; + C-C-00-0002-CMDTRN-DCCSF|029|02|NAME=train;FX0=0; + C-C-00-0002-CMDTRN-DCCSF|029|02|NAME=train;FX1=0; + C-C-00-0002-CMDTRN-DCCSF|047|02|NAME=train;FX0=1;FX1=1;FX2=1;FX3=1; + maxi=C-C-00-0002-CMDTRN-DCCSF|111|15|NAME=train;FX0=1;FX1=1;FX2=1;FX3=1;FX4=0;FX5=0;FX6=0;FX7=0;FX8=0;FX9=0;FX10=0;FX11=0;FX12=0;FX13=0; } so:=place_id('C-C-01-0004-CMDTRN-DCCSF'); s:=s+'NAME='+train+';'; - s:=s+'CSTEP=0;'; s:=s+'FX'+intToSTR(fonction)+'='+intToSTR(etat)+';'; - sx:=format('%.*d',[2,3])+'|'; // 3 paramètres + sx:=format('%.*d',[2,2])+'|'; // 2 paramètres so:=so+ '|'+format('%.*d',[3,length(s)+length(sx)])+'|'+sx; chaine_CDM_Func:=so+s; end; -// chaîne pour vitesse train string +// chaîne pour vitesse train par son nom string function chaine_CDM_vitesseST(vitesse:integer;train:string) : string; var s,so,sx: string; begin @@ -1561,7 +1581,7 @@ begin chaine_CDM_vitesseST:=so+s; end; -// chaîne pour vitesse train INT (adresse) +// chaîne pour vitesse train INT par son adresse function chaine_CDM_vitesseINT(vitesse:integer;train:integer) : string; var s,so,sx: string; begin @@ -1651,6 +1671,119 @@ begin end; +procedure demande_etat_loco(loco : integer); +var ah,al,i : integer; + s : string; +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); + end; +end; + + +// loco=adresse de la loco fonction de 0 à 20 état 0/1 +procedure Fonction_Loco_Operation(loco,fonction,etat : integer); +var s : string ; + ah,al : integer; + b : 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 + 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 + 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; + s:=s+char(b); + s:=checksum(s); + envoi(s); + end; + end; +end; + +// loco=adresse de la loco fonction de 0 à 12 état 0/1 +procedure Fonction_Loco_state(loco,fonction,etat : integer); +var s : string ; + ah,al : integer; + b : byte ; +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 + 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; +end; + +// envoie une vitesse à une loco par XpressNet ou par CDM procedure vitesse_loco(nom_train :string;loco : integer;vitesse : integer;sens : boolean); var s : string; begin @@ -2932,7 +3065,7 @@ end; function verif_UniSemaf(adresse,UniSem : integer) : integer; var aspect : integer; begin - if UniSem=0 then begin verif_unisemaf:=0;exit;end; + if UniSem=0 then begin verif_unisemaf:=1;exit;end; if (UniSem<>2) and (UniSem<>3) and (UniSem<>4) and (UniSem<>51) and (UniSem<>52) and (UniSem<>71) and (UniSem<>72) and (UniSem<>73) and ((UniSem<90) or (UniSem>99)) then begin verif_UniSemaf:=1;exit;end; @@ -2997,7 +3130,7 @@ end; // attention, si les éléments ne sont pas contigus, le résultat est erronné!!! // et en variables globales: typeGen le type de l'élément // s'ils ne sont pas contigus, on aura une erreur -// alg= algorithme : +// alg= algorithme 1 à 3: // 1=arret sur suivant qu'il soit un détecteur ou un aiguillage // 2=arret sur aiguillage en talon mal positionné // 3=arret sur un aiguillage pris en pointe dévié et AdrDevie contient l'adresse de l'aiguillage dévié ainsi que typeGen @@ -5226,8 +5359,15 @@ begin Affiche(s,clyellow); if AffAigDet then AfficheDebug(s,clyellow); - MemZone[det2,det3]:=FALSE; // efface zone précédente - MemZone[det3,AdrSuiv]:=TRUE; // valide la nouveau zone + if (det23 then + begin + if copy(trame_CDM,1,3)='S-E' then + begin + // numéro de la trame + i:=pos('-',trame_CDM); + if i<>0 then + begin + i:=posEx('-',trame_CDM,i+1); + if i<>0 then + begin + i:=posEx('-',trame_CDM,i+1); + if i<>0 then + begin + j:=posEx('-',trame_CDM,i+1); + AncNumTrameCDM:=NumTrameCDM; + val(copy(trame_CDM,i+1,j-1),NumTrameCDM,erreur); + if AncNumTrameCDM=0 then AncNumTrameCDM:=NumTrameCDM-1; + affiche(IntToSTR(NumTrameCDM),clLime); + if AncNumTrameCDM+1<>NumTrameCDM then + begin + s:='Erreur trames CDM perdues: #dernière='+intToSTR(AncNumTrameCDM)+' #Nouvelle='+intToSTR(NumTrameCDM); + Affiche(s,clred); + AfficheDebug(s,clred); + end; + end; + end; + end; + end; + end;} + // trouver la longueur de la chaîne de paramètres entre les 2 premiers |xxx| i:=pos('|',trame_CDM); if i=0 then @@ -7437,7 +7646,7 @@ begin val(ss,etat,erreur); s:='SignalCDM '+intToSTR(adr)+'='+IntToStr(etat); if afftiers then AfficheDebug(s,ClSkyBlue); - end ; + end; // évènement actionneur // attention un actionneur qui repasse à 0 ne contient pas de nom de train @@ -7459,7 +7668,7 @@ begin if i<>0 then Delete(commandeCDM,1,i); if AfficheDet then Affiche('Actionneur AD='+intToSTR(adr)+' Nom='+intToSTR(name)+' Train='+train+' Etat='+IntToSTR(etat),clyellow); - Event_act(adr,etat,train); // déclenche évent actionneur + Event_act(adr,0,etat,train); // déclenche évent actionneur end; // évènement position des trains - non stocké ni interprété @@ -7516,7 +7725,7 @@ begin //Affiche('k='+intToSTR(k),clyellow); end; - sort:=(length(trame_CDM)<10) or (k>=2000);// or (posST=0) and (posDT=0) and (posAC=0) and (posSG=0); + sort:=(length(trame_CDM)<10) or (k>=2000); until (sort); //Affiche('k='+IntToSTR(k)+' Ligne traitée '+recuCDM,clLime); @@ -7531,7 +7740,7 @@ procedure TFormPrinc.ClientSocketCDMRead(Sender: TObject;Socket: TCustomWinSocke begin inc(Nbre_recu_cdm); //if Nbre_recu_cdm>1 then Affiche('Empilement de trames CDM: '+intToSTR(Nbre_recu_cdm),clred); - recuCDM:=ClientSocketCDM.Socket.ReceiveText; // commandeCDM est le morceau tronqué de la fin de la réception précédente + recuCDM:=ClientSocketCDM.Socket.ReceiveText; if traceTrames then AfficheDebug(recuCDM,clWhite); @@ -7544,7 +7753,7 @@ begin inc(i); until l'') then begin if fonction<>0 then - s:='FonctionF Déclencheur='+intToSTR(adrAct)+':'+intToSTR(etatAct)+' Train='+s2+' F'+IntToSTR(fonction)+ + s:='FonctionF Déclencheur='+s+' :'+intToSTR(etatAct)+' Train='+s2+' F'+IntToSTR(fonction)+ ' Temporisation='+intToSTR(tablo_actionneur[i].Tempo); if acc<>0 then - s:='Accessoire Déclencheur='+intToSTR(adrAct)+':'+intToSTR(etatAct)+' Train='+s2+' A'+IntToSTR(acc)+ + s:='Accessoire Déclencheur='+s+' :'+intToSTR(etatAct)+' Train='+s2+' A'+IntToSTR(acc)+ ' sortie='+intToSTR(sortie); if son then - s:='Son Déclencheur='+intToSTR(adrAct)+':'+intToSTR(etatAct)+' Train='+s2+' Fichier:'+ Tablo_actionneur[i].FichierSon; + s:='Son Déclencheur='+s+' :'+intToSTR(etatAct)+' Train='+s2+' Fichier:'+ Tablo_actionneur[i].FichierSon; Affiche(s,clYellow); end; @@ -7875,6 +8089,7 @@ begin s:=GetCurrentDir; s:='C:\Program Files (x86)\Borland\Delphi7\Projects\Signaux_complexes_GL'; OpenDialog.InitialDir:=s; + OpenDialog.Title:='Ouvrir un fichier de trames CDM (protocole COM-IPC)'; OpenDialog.DefaultExt:='txt'; OpenDialog.Filter:='Fichiers texte (*.txt)|*.txt|Tous fichiers (*.*)|*.*'; if openDialog.Execute then @@ -8032,11 +8247,6 @@ begin end; -procedure TFormPrinc.Button1Click(Sender: TObject); -begin - zone_TCO(513,515,1); -end; - procedure TFormPrinc.ComboTrainsChange(Sender: TObject); var i : integer; begin @@ -8044,5 +8254,63 @@ begin EditAdrTrain.Text:=intToSTR(trains[i+1].adresse); end; +procedure TFormPrinc.ButtonFonctionClick(Sender: TObject); +var erreur,fonction,etat,loco : integer; + s : string; +begin + val(editNumFonction.Text,fonction,erreur); + if erreur<>0 then exit; + val(editFonc01.Text,etat,erreur); + if erreur<>0 then exit; + val(editAdrTrain.Text,loco,erreur); + s:=trains[combotrains.itemindex+1].nom_train; + if CDM_connecte then + begin + if s='' then begin Affiche('Sélectionnez un train',clOrange);exit;end; + if fonction>12 then + begin + Affiche('Avec CDM Rail, F12 maxi',clOrange); + exit; + end; + envoie_fonction_CDM(fonction,etat,s); + Affiche('Train='+s+' F'+IntToSTR(fonction)+':'+intToSTR(etat),clyellow); + end; + if portCommOuvert or parSocketLenz then + begin + if erreur<>0 then begin Affiche('Sélectionnez un train',clOrange);exit;end; + if fonction>28 then + begin + Affiche('F28 maxi',clOrange); + exit; + end; + Affiche('Train adresse '+intToStr(loco)+' F'+IntToSTR(fonction)+':'+intToSTR(etat),clyellow); + Fonction_Loco_operation(loco,fonction,etat); + end; +end; + + +procedure TFormPrinc.Button1Click(Sender: TObject); +var erreur,fonction,etat,loco : integer; + s : string; +begin + val(editNumFonction.Text,fonction,erreur); + if erreur<>0 then exit; + val(editFonc01.Text,etat,erreur); + if erreur<>0 then exit; + val(editAdrTrain.Text,loco,erreur); + s:=trains[combotrains.itemindex+1].nom_train; + if CDM_connecte then + begin + envoie_fonction_CDM(fonction,etat,s); + Affiche('Train='+s+' F'+IntToSTR(fonction)+':'+intToSTR(etat),clyellow); + end; + //if portCommOuvert or parSocketLenz then + begin + if erreur<>0 then exit; + Affiche('Train adresse '+intToStr(loco)+' F'+IntToSTR(fonction)+':'+intToSTR(etat),clyellow); + Fonction_Loco_State(loco,fonction,etat); + end; +end; + begin end. diff --git a/UnitSR.dcu b/UnitSR.dcu index 3e03169..1b26ecb 100644 Binary files a/UnitSR.dcu and b/UnitSR.dcu differ diff --git a/UnitSimule.dcu b/UnitSimule.dcu index f5bee2a..ecbfd14 100644 Binary files a/UnitSimule.dcu and b/UnitSimule.dcu differ diff --git a/UnitTCO.dcu b/UnitTCO.dcu index cfb547c..796ce98 100644 Binary files a/UnitTCO.dcu and b/UnitTCO.dcu differ diff --git a/verif_version.dcu b/verif_version.dcu index ade75f8..3761799 100644 Binary files a/verif_version.dcu and b/verif_version.dcu differ diff --git a/verif_version.pas b/verif_version.pas index 0f1a6c7..099e741 100644 --- a/verif_version.pas +++ b/verif_version.pas @@ -23,7 +23,7 @@ var Lance_verif : integer; verifVersion,notificationVersion : boolean; -Const Version='3.7'; // sert à la comparaison de la version publiée +Const Version='3.8'; // 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 f2b46b8..4ede101 100644 --- a/versions.txt +++ b/versions.txt @@ -80,9 +80,13 @@ version 3.6 : Am Changement des vitesses courantes des trains. version 3.61 : Correction de la non présentation de certains signaux s'ils sont séparés par plus d'un détecteur. version 3.62 : Correction présence trains 3 cantons avant signaux et 1 canton après signaux. -version 3.7 : Gestion améliorée du décodeur Unisemaf - Présentation du rappel30/60 sur TJD déviées - Correction erreur 1000 au TCO +version 3.7 : Gestion améliorée du décodeur Unisemaf. + Présentation du rappel30/60 sur TJD déviées. + Correction erreur 1000 au TCO. +version 3.71 : Suppression vitesse train à 0 lors d'une commande de fonction F train. + Ajout d'un bouton de test des actionneurs dans la page de configuration des actionneurs. +version 3.8 : Possibilité de déclencher les actions depuis une zone deux détecteurs contigus. + Gestion des fonctions F de train de F0 à F28 en mode autonome.