1 | #include "diabolo.h"
|
---|
2 | #include "bolo.h"
|
---|
3 | #include "acqui.h"
|
---|
4 | #include "carte_acqui.h"
|
---|
5 | #include "trace_tout.h"
|
---|
6 | #include "synchro.h"
|
---|
7 |
|
---|
8 |
|
---|
9 | //---------------------------------- fenetre : lit_fifo -----------------------------------
|
---|
10 |
|
---|
11 | void montracen_tout(int fen,int n,double x,util_trace_tout *SS);
|
---|
12 |
|
---|
13 |
|
---|
14 |
|
---|
15 | void exec_trace_tout(int fen,int item,double valeur,...)
|
---|
16 | {
|
---|
17 | int i,j;
|
---|
18 | double x,c1,c2;
|
---|
19 | static int scan_tt;
|
---|
20 | util_trace_tout *SS;
|
---|
21 | SS=infos(fen)->util;
|
---|
22 | switch(item)
|
---|
23 | {
|
---|
24 | case fermeture : for(j=0;j<8;j++) if(gg->trace_tout[j]==fen) {gg->trace_tout[j]=0;}
|
---|
25 | free(SS);
|
---|
26 | break;
|
---|
27 | case ouverture :
|
---|
28 | for(j=0;j<8;j++) if(gg->trace_tout[j]==0) {gg->trace_tout[j]=fen;break;}
|
---|
29 | SS=malloc(sizeof(util_trace_tout));
|
---|
30 | infos(fen)->util=SS;
|
---|
31 |
|
---|
32 | graph->ymin=-120;
|
---|
33 | graph->ymax=120;
|
---|
34 | graph->ypas=20;
|
---|
35 | graph->xmax=500;
|
---|
36 | graph->xpas=50;
|
---|
37 | graph->taille_graduations=8;
|
---|
38 | for(j=0;j<nb_max_trace;j++) SS->f1[j]=0;
|
---|
39 | for(j=0;j<nb_max_trace;j++) SS->f2[j]=0;
|
---|
40 | for(j=0;j<nb_max_trace;j++) SS->y[j]=0;
|
---|
41 |
|
---|
42 |
|
---|
43 | case t_moyenne :
|
---|
44 | case t_moyenne+1000 :
|
---|
45 | case t_fmini :
|
---|
46 | case t_fmini+1000 :
|
---|
47 | case t_fmaxi :
|
---|
48 | case t_fmaxi+1000 : SS->moyenne=litD(fen,t_moyenne,0L);if(SS->moyenne<1) SS->moyenne=1;
|
---|
49 | SS->ipas=0;
|
---|
50 | SS->fmini=litD(fen,t_fmini,0L);
|
---|
51 | SS->fmaxi=litD(fen,t_fmaxi,0L);
|
---|
52 | for(j=0;j<nb_max_trace;j++) SS->f1[j]=0;
|
---|
53 |
|
---|
54 | c1=2*3.14*SS->fmini*gg->periode_echantillonage; c1=c1/(1+c1);
|
---|
55 | c2=2*3.14*SS->fmaxi*gg->periode_echantillonage; c2=c2/(1+c2);
|
---|
56 |
|
---|
57 | printf("c1=%g c2=%g \n",c1,c2);
|
---|
58 |
|
---|
59 |
|
---|
60 |
|
---|
61 |
|
---|
62 | case t_bolo_couleur :
|
---|
63 | case t_bolo_couleur+1 :
|
---|
64 | case t_bolo_couleur+2 :
|
---|
65 | case t_bolo_couleur+3 :
|
---|
66 | case t_bolo_couleur+4 :
|
---|
67 | case t_bolo_couleur+5 :
|
---|
68 | case t_bolo_couleur+6 :
|
---|
69 | case t_bolo_couleur+7 :
|
---|
70 | case t_bolo_couleur+8 :
|
---|
71 | case t_bolo_couleur+9 :
|
---|
72 |
|
---|
73 | for(i=0;i<max_couleur;i++)
|
---|
74 | {
|
---|
75 | SS->bolo_couleur[i]=litD(fen,t_bolo_couleur+i,0L)-1;
|
---|
76 | if( (SS->bolo_couleur[i]<1) ou (SS->bolo_couleur[i]>nb_max_trace) ) SS->bolo_couleur[i]=0;
|
---|
77 | printf(" i=%d bolo=%d ",i,SS->bolo_couleur[i]);
|
---|
78 | }
|
---|
79 | printf("\n");
|
---|
80 | break;
|
---|
81 |
|
---|
82 |
|
---|
83 | break;
|
---|
84 |
|
---|
85 |
|
---|
86 | case t_raz : gg->temps_origine=gg->periode_echantillonage*(double)gg->temps_cntl; //break;
|
---|
87 | case t_efface : efface(fen);
|
---|
88 | break;
|
---|
89 |
|
---|
90 |
|
---|
91 | case tache_de_fond : selectgra(fen);
|
---|
92 | c1=2*3.14*SS->fmini*gg->periode_echantillonage; if(c1>0) c1=c1/(1+c1);
|
---|
93 | c2=2*3.14*SS->fmaxi*gg->periode_echantillonage; if(c2>0) c2=c2/(1+c2);
|
---|
94 |
|
---|
95 | for(j=0;j<nb_max_trace;j++)
|
---|
96 | {
|
---|
97 | SS->f1[j]= (1-c1) * SS->f1[j] + c1 * xbol(j);
|
---|
98 | SS->f2[j]= (1-c2) * SS->f2[j] + c2 * xbol(j);
|
---|
99 | SS->y[j]+=SS->f2[j]-SS->f1[j];
|
---|
100 | }
|
---|
101 | SS->ipas--;
|
---|
102 | if(SS->ipas<=0)
|
---|
103 | {
|
---|
104 | SS->ipas=SS->moyenne;
|
---|
105 | if(SS->moyenne) for(j=0;j<nb_max_trace;j++) SS->y[j]=SS->y[j]/(double)SS->moyenne;
|
---|
106 | // printf("trace_tout un point \n");
|
---|
107 |
|
---|
108 | x=gg->periode_echantillonage*(double)gg->temps_cntl-gg->temps_origine;
|
---|
109 |
|
---|
110 | if(scan_tt != ( (gg->don.sync[sync_subscan]!=0) et (gg->don.sync[sync_scan]!=0) ) )
|
---|
111 | {
|
---|
112 | if(scan_tt) rectangle(fen,x,graph->ymin,x,graph->ymax,rouge); // trace le segment x1,y1 - x2,y2
|
---|
113 | else rectangle(fen,x,graph->ymin,x,graph->ymax,bleu); // trace le segment x1,y1 - x2,y2
|
---|
114 |
|
---|
115 | scan_tt = ( (gg->don.sync[sync_subscan]!=0) et (gg->don.sync[sync_scan]!=0) ) ;
|
---|
116 | }
|
---|
117 |
|
---|
118 | montracen_tout(fen,nb_max_trace,x,SS);
|
---|
119 |
|
---|
120 |
|
---|
121 | if(!(graph->scroll_courbe) && litD(fen,t_retour,0L) &&
|
---|
122 | ( (x<graph->xmin) ou (x>graph->xmax) ))
|
---|
123 | {
|
---|
124 | graph->xmax-=graph->xmin;graph->xmin=0;
|
---|
125 | gg->temps_origine=gg->periode_echantillonage*(double)gg->temps_cntl;
|
---|
126 | x=0;
|
---|
127 | }
|
---|
128 |
|
---|
129 | for(j=0;j<nb_max_trace;j++) SS->y[j]=0;
|
---|
130 | }
|
---|
131 |
|
---|
132 | default : break;
|
---|
133 | }
|
---|
134 |
|
---|
135 | }
|
---|
136 |
|
---|
137 |
|
---|
138 | void montracen_tout(int fen,int n,double x,util_trace_tout *SS)
|
---|
139 | {
|
---|
140 | int i;
|
---|
141 | double yy[max_couleur];
|
---|
142 | for(i=0;i<max_couleur;i++)
|
---|
143 | {
|
---|
144 | if( (SS->bolo_couleur[i]>=1) && (SS->bolo_couleur[i]<nb_max_trace+1) ) yy[i]=SS->y[SS->bolo_couleur[i]-1];
|
---|
145 | else yy[i]=0;
|
---|
146 | }
|
---|
147 | tracen(fen,max_couleur,x,yy);
|
---|
148 | // printf("0=%g 1=%g 2=%g \n",yy[0],yy[1],yy[2]);
|
---|
149 | }
|
---|