source: Sophya/trunk/Poubelle/archediab.old/archediab.sources/c/trace_tout.c@ 643

Last change on this file since 643 was 639, checked in by ansari, 26 years ago

archediab 25

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