| 1 | #include "diabolo.h"
 | 
|---|
| 2 | #include "bolo.h"
 | 
|---|
| 3 | #include "acqui.h"
 | 
|---|
| 4 | #include "carte_acqui.h"
 | 
|---|
| 5 | #include "trace.h"
 | 
|---|
| 6 | #include "synchro.h"
 | 
|---|
| 7 | 
 | 
|---|
| 8 | //#define  scroll_courbe  0
 | 
|---|
| 9 | 
 | 
|---|
| 10 | 
 | 
|---|
| 11 | 
 | 
|---|
| 12 | 
 | 
|---|
| 13 | //----------------------------------  fenetre : lit_fifo  -----------------------------------
 | 
|---|
| 14 | 
 | 
|---|
| 15 | 
 | 
|---|
| 16 | 
 | 
|---|
| 17 | 
 | 
|---|
| 18 | void exec_trace_tout(int fen,int item,double valeur,...) 
 | 
|---|
| 19 | {
 | 
|---|
| 20 | static double y[nb_max_bolo+1];
 | 
|---|
| 21 | static double f1[nb_max_bolo+1];
 | 
|---|
| 22 | static double f2[nb_max_bolo+1];
 | 
|---|
| 23 | static double   fmin,fmax;
 | 
|---|
| 24 | 
 | 
|---|
| 25 | static int moyenne,ipas;
 | 
|---|
| 26 | static double fmini,fmaxi;
 | 
|---|
| 27 | 
 | 
|---|
| 28 | 
 | 
|---|
| 29 | int  j;
 | 
|---|
| 30 | double x,c1,c2;
 | 
|---|
| 31 | 
 | 
|---|
| 32 | switch(item)
 | 
|---|
| 33 |     {
 | 
|---|
| 34 |     case ouverture     :        gg->trace_ouvert=gg->trace_ouvert | 1 ; 
 | 
|---|
| 35 |                                                 graph->ymin=-120;
 | 
|---|
| 36 |                                                         graph->ymax=120;
 | 
|---|
| 37 |                                                 graph->ypas=20;
 | 
|---|
| 38 |                                                 graph->xmax=500;
 | 
|---|
| 39 |                                                 graph->xpas=50;
 | 
|---|
| 40 |                                                 graph->taille_graduations=8;
 | 
|---|
| 41 | //                                              graph->sans_image=1;
 | 
|---|
| 42 | //                                              graph->flag_tracen=0;
 | 
|---|
| 43 | //                                              for(j=0;j<parametr.nb_bolo+1;j++)       graph->flag_tracen+=(1<<j);
 | 
|---|
| 44 | //                                                      moyenne=10;ipas=1;
 | 
|---|
| 45 | //                                                      ecritD(fen,t_moyenne,"%d",moyenne);
 | 
|---|
| 46 |                                                         
 | 
|---|
| 47 | //                                                      fmini=0;ecritD(fen,t_fmini,"%g",fmini);
 | 
|---|
| 48 | //                                                      fmaxi=10;ecritD(fen,t_fmaxi,"%g",fmaxi);
 | 
|---|
| 49 |                                                         for(j=0;j<parametr.nb_bolo;j++)  f1[j]=0;
 | 
|---|
| 50 |                                                         for(j=0;j<parametr.nb_bolo;j++)  f2[j]=0;
 | 
|---|
| 51 |                                                         for(j=0;j<parametr.nb_bolo;j++)  y[j]=0;
 | 
|---|
| 52 | 
 | 
|---|
| 53 |                                         
 | 
|---|
| 54 |     case t_moyenne              :       
 | 
|---|
| 55 |     case t_moyenne+1000 :       
 | 
|---|
| 56 |     case t_fmini                :       
 | 
|---|
| 57 |     case t_fmini+1000   :       
 | 
|---|
| 58 |       case t_fmaxi              :       
 | 
|---|
| 59 |     case t_fmaxi+1000   :       moyenne=litD(fen,t_moyenne,0L);if(moyenne<1) moyenne=1;
 | 
|---|
| 60 |                                         fmini=litD(fen,t_fmini,0L);
 | 
|---|
| 61 |                                                 fmaxi=litD(fen,t_fmaxi,0L);
 | 
|---|
| 62 |                                                 for(j=0;j<parametr.nb_bolo;j++)  f1[j]=0;
 | 
|---|
| 63 | 
 | 
|---|
| 64 |                                                         c1=2*3.14*fmini*gg->periode_echantillonage;             c1=c1/(1+c1);   
 | 
|---|
| 65 |                                                         c2=2*3.14*fmaxi*gg->periode_echantillonage;             c2=c2/(1+c2);   
 | 
|---|
| 66 |                                                         
 | 
|---|
| 67 |                                                         printf("c1=%g   c2=%g  \n",c1,c2);              
 | 
|---|
| 68 |                                         break;
 | 
|---|
| 69 | 
 | 
|---|
| 70 |     case fermeture     :        gg->trace_ouvert=gg->trace_ouvert & (255-1);            // enleve le 1
 | 
|---|
| 71 |                                                 break;
 | 
|---|
| 72 | 
 | 
|---|
| 73 |     
 | 
|---|
| 74 |     case t_raz                  :       gg->temps_origine=gg->periode_echantillonage*(double)gg->temps_cntl;                            //break;    
 | 
|---|
| 75 |     case t_efface               :       efface(fen);
 | 
|---|
| 76 |                                                 break;
 | 
|---|
| 77 |                  
 | 
|---|
| 78 | 
 | 
|---|
| 79 |     case tache_de_fond          :       selectgra(fen);
 | 
|---|
| 80 |                                                 
 | 
|---|
| 81 |                                                         c1=2*3.14*fmini*gg->periode_echantillonage;             c1=c1/(1+c1);   
 | 
|---|
| 82 |                                                         c2=2*3.14*fmaxi*gg->periode_echantillonage;             c2=c2/(1+c2);   
 | 
|---|
| 83 |                                                         
 | 
|---|
| 84 |                                                 for(j=0;j<parametr.nb_bolo;j++)         
 | 
|---|
| 85 |                                                         {
 | 
|---|
| 86 |                                                         f1[j]= (1-c1) * f1[j]   + c1 * xbol(j); 
 | 
|---|
| 87 |                                                         f2[j]= (1-c2) * f2[j]   + c2 * xbol(j); 
 | 
|---|
| 88 |                                                                 y[j]+=f2[j]-f1[j];
 | 
|---|
| 89 |                                                                 }                                                       
 | 
|---|
| 90 |                                                         ipas--;
 | 
|---|
| 91 |                                                         if(ipas<=0)     
 | 
|---|
| 92 |                                                                 {
 | 
|---|
| 93 |                                                                 ipas=moyenne;
 | 
|---|
| 94 |                                                                 for(j=0;j<parametr.nb_bolo;j++) y[j]=y[j]/(double)moyenne;
 | 
|---|
| 95 |                                                                 
 | 
|---|
| 96 | //                                                              y[parametr.nb_bolo]=(0.95*graph->ymin+0.05*graph->ymax) + 
 | 
|---|
| 97 | //                                                                      +  ( (gg->don.sync[sync_subscan]!=0) et (gg->don.sync[sync_scan]!=0) )
 | 
|---|
| 98 | //                                                                              * 0.9 * (graph->ymax-graph->ymin);
 | 
|---|
| 99 | 
 | 
|---|
| 100 |                                                                 x=gg->periode_echantillonage*(double)gg->temps_cntl-gg->temps_origine;
 | 
|---|
| 101 | //                                                              printf("x=%g  x0=%g  \n",x,x0);
 | 
|---|
| 102 |                                                                 //if(x<0) {x0=gg->periode_echantillonage*(double)gg->temps_cntl;x=0;}
 | 
|---|
| 103 | 
 | 
|---|
| 104 |                                                                 montracen(fen,parametr.nb_bolo,x,y);    // SANS LA SYNCHRO
 | 
|---|
| 105 | //                                                              montracen(fen,parametr.nb_bolo+1,x,y);  // avec la synchro
 | 
|---|
| 106 | 
 | 
|---|
| 107 |                                                                 if(!(graph->scroll_courbe) && litD(fen,t_retour,0L) &&
 | 
|---|
| 108 |                                                                                  ( (x<graph->xmin) ou (x>graph->xmax) )) 
 | 
|---|
| 109 |                                                                                         {
 | 
|---|
| 110 |                                                                                         graph->xmax-=graph->xmin;graph->xmin=0;
 | 
|---|
| 111 |                                                                                         gg->temps_origine=gg->periode_echantillonage*(double)gg->temps_cntl;
 | 
|---|
| 112 |                                                                                         x=0;    
 | 
|---|
| 113 |                                                                                         }
 | 
|---|
| 114 | 
 | 
|---|
| 115 |                                                                 for(j=0;j<parametr.nb_bolo;j++) y[j]=0;
 | 
|---|
| 116 |                                                                 }
 | 
|---|
| 117 |                                 
 | 
|---|
| 118 |     default                      :   break;
 | 
|---|
| 119 |     }
 | 
|---|
| 120 | 
 | 
|---|
| 121 | }
 | 
|---|
| 122 | 
 | 
|---|
| 123 | 
 | 
|---|