| [637] | 1 | #include "diabolo.h"
 | 
|---|
 | 2 | #include "bolo.h"
 | 
|---|
 | 3 | #include "acqui.h"
 | 
|---|
 | 4 | #define main_nubus
 | 
|---|
 | 5 | #include "carte_acqui.h"
 | 
|---|
 | 6 | #include "trace.h"
 | 
|---|
 | 7 | #include "synchro.h"
 | 
|---|
 | 8 | #include "fichier.h"
 | 
|---|
 | 9 | #include "Serial.h"
 | 
|---|
 | 10 | #include "auto.h" 
 | 
|---|
 | 11 | #include "menu.h" 
 | 
|---|
 | 12 | #include "regul.h" 
 | 
|---|
 | 13 | #include "alarme.h" 
 | 
|---|
 | 14 | #include "controle.h" 
 | 
|---|
 | 15 | 
 | 
|---|
 | 16 | #include "comment.h" 
 | 
|---|
 | 17 | #include "corel.h" 
 | 
|---|
 | 18 | #include "version.h" 
 | 
|---|
 | 19 | #include "config_transputer.h" 
 | 
|---|
 | 20 | #include "dilution.h" 
 | 
|---|
| [649] | 21 | #include "recons_sst.h" 
 | 
|---|
 | 22 | #include "tm.h" 
 | 
|---|
| [637] | 23 | 
 | 
|---|
| [649] | 24 | void InitSimulMission(void);
 | 
|---|
| [637] | 25 | 
 | 
|---|
 | 26 | stglob* gg;                     // pointeur global  sur la structure 
 | 
|---|
 | 27 | 
 | 
|---|
 | 28 | 
 | 
|---|
 | 29 | 
 | 
|---|
 | 30 | 
 | 
|---|
 | 31 | main()
 | 
|---|
 | 32 | {
 | 
|---|
 | 33 | int j,flag;
 | 
|---|
 | 34 | char ss[255];
 | 
|---|
 | 35 | 
 | 
|---|
| [656] | 36 | sprintf(ss,"%s:archediab.rsrc",chemin_ressource);
 | 
|---|
| [637] | 37 | if(!ouvrirR(ss))        
 | 
|---|
 | 38 |         {
 | 
|---|
 | 39 |         if(alerte(2,"ne trouve pas le fichier ressource  Diabolo    voulez vous en ouvrir un autre ?")==1)
 | 
|---|
 | 40 |                         ouvrirR("");
 | 
|---|
 | 41 |         else    return(option_quit);
 | 
|---|
 | 42 |         }
 | 
|---|
 | 43 | #ifdef _diabolo
 | 
|---|
 | 44 | flag=alerte(3,"        DIABOLO    \r\r acquisition avec carte PCI ??"); // vaut 1 pour acquisition PCI
 | 
|---|
 | 45 | #else
 | 
|---|
 | 46 | //flag=alerte(3,"   Archeops ou Planck  \r\r acquisition avec carte PCI ??"); // vaut 1 pour acquisition PCI
 | 
|---|
 | 47 | //flag=2;       // en mode simulation
 | 
|---|
| [651] | 48 | flag=2;
 | 
|---|
 | 49 | if(clavier(touche_alt) ) flag=1;                                        // en mode acquisition
 | 
|---|
| [649] | 50 | if(clavier(touche_controle) ) flag=4;                           // avec emission des telecommandes au demarrage
 | 
|---|
 | 51 | if(clavier(touche_alt) && clavier(touche_controle) ) {
 | 
|---|
 | 52 |   flag=3;               // en mode simulateur de donnees mission
 | 
|---|
 | 53 |   InitSimulMission();
 | 
|---|
 | 54 |   }
 | 
|---|
| [637] | 55 | #endif
 | 
|---|
 | 56 | 
 | 
|---|
| [651] | 57 | //alerte(1,"on a flag=%d ",flag);
 | 
|---|
| [637] | 58 | 
 | 
|---|
 | 59 | init_struct(flag);
 | 
|---|
 | 60 | 
 | 
|---|
| [649] | 61 | init_recons_sst();
 | 
|---|
 | 62 | 
 | 
|---|
| [637] | 63 | //printf(" long_entete          = %ld \n",      sizeof(F_entete));
 | 
|---|
 | 64 | //printf(" long_entete_part     = %ld \n",      sizeof(F_entete_part));
 | 
|---|
 | 65 | //printf(" long_donne           = %ld \n\n",    sizeof(F_donne));
 | 
|---|
 | 66 | //return(0);
 | 
|---|
 | 67 | 
 | 
|---|
 | 68 | 
 | 
|---|
 | 69 | nouveauD(fenetre_alarme,alarme_id,"alarme",exec_alarme);
 | 
|---|
 | 70 | nouveauD(fenetre_controle,controle_id,"controle",exec_controle);
 | 
|---|
 | 71 | 
 | 
|---|
 | 72 | nouveautypefichier('DIA2',exec_DIA2);
 | 
|---|
 | 73 | nouveautypefichier('ARCH',exec_ARCH);
 | 
|---|
| [651] | 74 | nouveautypefichier('TEXT',exec_ARCH);
 | 
|---|
| [637] | 75 | 
 | 
|---|
 | 76 | //nouveautypefichier('TEXT',exec_DIA2);
 | 
|---|
 | 77 | 
 | 
|---|
 | 78 | nouveauM(0,diabolo_id,exec_menu_diabolo);
 | 
|---|
| [649] | 79 | nouveauSM(0,menu_trace_tout_id,exec_menu_trace_tout);
 | 
|---|
| [637] | 80 | 
 | 
|---|
 | 81 | ouvreD(fenetre_acquisition,acquisition_id,"acquisition",exec_acquisition);
 | 
|---|
 | 82 | 
 | 
|---|
 | 83 | ouvreD(fenetre_synchro,synchro_id,"synchro",exec_synchro);
 | 
|---|
 | 84 | ouvreD(fenetre_fichier,fichier_id,"fichier",exec_fichier);
 | 
|---|
 | 85 | //ouvreD(fenetre_auto,auto_id,"auto",exec_auto);
 | 
|---|
 | 86 | 
 | 
|---|
 | 87 | 
 | 
|---|
 | 88 | ouvre('WIND',fenetre_liste_bolos,liste_bolos_id,"liste_des_bolos",exec_cache,0L);
 | 
|---|
 | 89 | #ifndef _archeops
 | 
|---|
 | 90 | ouvreD(fenetre_choix_corel,choix_corel_id,"choix_corel",exec_choix_corel);
 | 
|---|
 | 91 | ouvreD(fenetre_regul,regul_id,"regul",exec_regul);
 | 
|---|
 | 92 | #endif
 | 
|---|
 | 93 | 
 | 
|---|
| [657] | 94 | 
 | 
|---|
| [637] | 95 | #ifdef _archeops
 | 
|---|
| [643] | 96 | //nouveauD(fenetre_vitesse_block,config_transputer_id,"config_transputer",exec_config_transputer);
 | 
|---|
| [637] | 97 | 
 | 
|---|
 | 98 | printf(" acquisition  Archeops  \n\n");
 | 
|---|
 | 99 | #endif
 | 
|---|
 | 100 | 
 | 
|---|
| [649] | 101 | initRS(port_A,baud1200+data8+stop10+noParity,0);        
 | 
|---|
| [637] | 102 | 
 | 
|---|
 | 103 | #ifdef lire_les_donnees_POM2
 | 
|---|
 | 104 | initRS(port_A,baud19200+data8+stop20+noParity,Xon_Xoff);
 | 
|---|
 | 105 | printf(" avec lecture des données POM2 sur la RS232  \n");
 | 
|---|
 | 106 | #endif 
 | 
|---|
 | 107 | 
 | 
|---|
 | 108 | #ifdef  lire_les_noms_sources_IRAM
 | 
|---|
 | 109 | printf(" avec recherche lecture des noms de source IRAM \n");
 | 
|---|
 | 110 | #ifdef  lire_les_data_telescope_IRAM
 | 
|---|
 | 111 | printf("et lecture de tous les fichiers th tp de l'IRAM  \n");
 | 
|---|
 | 112 | #endif                  
 | 
|---|
 | 113 | #endif                  
 | 
|---|
| [656] | 114 | parametr.nb_bolo=0;
 | 
|---|
| [637] | 115 | for(j=0;j<nb_max_bolo;j++)       
 | 
|---|
 | 116 |                         {
 | 
|---|
 | 117 |                         printf(" cherche a ouvrir bolo %d ",j+1);
 | 
|---|
 | 118 |                         printf(" capa=%g ",capa(j+1));
 | 
|---|
| [643] | 119 |                         printf(" boloutil = %d  bolonom = %s  \n",parametr.bolo[j].bolo_code_util,parametr.nom_coef[parametr.bolo[j].numero_nom_coef].bolo_nom);
 | 
|---|
| [657] | 120 |                         if( parametr.bolo[j].bolo_code_util&bolo_transmis_comprime)             parametr.nb_bolo++;
 | 
|---|
| [637] | 121 |                         if(parametr.bolo[j].bolo_code_util)
 | 
|---|
 | 122 |                                 {
 | 
|---|
| [643] | 123 |                                 sprintf(ss,"%d: %s",j+1,parametr.nom_coef[parametr.bolo[j].numero_nom_coef].bolo_nom);
 | 
|---|
| [637] | 124 |                                 ouvreD(j+1,bolo_id,ss,exec_bolo);
 | 
|---|
 | 125 |                                 }
 | 
|---|
 | 126 |                         }
 | 
|---|
 | 127 | ouvreA(tache_acqui,10,"acquisition",acqui);     // ouvre la tache de fond                                  
 | 
|---|
 | 128 | 
 | 
|---|
 | 129 | /*
 | 
|---|
 | 130 | ouvreA(tache_acqui,-1,"acquisition",acqui);     // ouvre la tache de fond sans la mettre en marche                                 
 | 
|---|
 | 131 | relit_liste();                                  // c'est relit_liste qui demarre la tache de fond d'acquisition
 | 
|---|
 | 132 | */
 | 
|---|
 | 133 | 
 | 
|---|
| [639] | 134 | 
 | 
|---|
| [649] | 135 | if( (flag==1) ou        (flag==4) )                             //  mets en route les interruptions
 | 
|---|
| [637] | 136 |         {
 | 
|---|
 | 137 |         ecritD(fenetre_acquisition,e_tache_inter,1);
 | 
|---|
 | 138 |         exec_acquisition(fenetre_acquisition,e_tache_inter,1);
 | 
|---|
 | 139 |         }       
 | 
|---|
 | 140 | 
 | 
|---|
 | 141 | select(fenetre_controle);
 | 
|---|
 | 142 | select(fenetre_acquisition);
 | 
|---|
 | 143 | 
 | 
|---|
| [649] | 144 | // $CHECK$ on est toujours en mode 4 avec la derniere modif AB ???
 | 
|---|
 | 145 | tt->PCI_actif=4;
 | 
|---|
 | 146 | if (flag==3) tt->PCI_actif=3;
 | 
|---|
 | 147 | 
 | 
|---|
| [637] | 148 | return(option_texte+option_unclick);
 | 
|---|
 | 149 | }
 | 
|---|
 | 150 | 
 | 
|---|
 | 151 | 
 | 
|---|
 | 152 | 
 | 
|---|
 | 153 | 
 | 
|---|
 | 154 | 
 | 
|---|
 | 155 | 
 | 
|---|
 | 156 | //------  fonction  exec  de traitement des alarmes  ------------
 | 
|---|
 | 157 | 
 | 
|---|
 | 158 | 
 | 
|---|
 | 159 | void exec_alarme(int fen,int item,double valeur,...) 
 | 
|---|
 | 160 | {
 | 
|---|
 | 161 | if(item==caseferme)  {cache(fen);stop_exec(fen);}
 | 
|---|
 | 162 | if(item==ouverture)  {tachedefond(fen,1800);cache(fen);}        //  30 sec
 | 
|---|
 | 163 | if(item==tache_de_fond) 
 | 
|---|
 | 164 |         {
 | 
|---|
 | 165 |         if( (litD(fenetre_alarme,a_fin_scan,0) ) && (!gg->scan_en_cours) )
 | 
|---|
 | 166 |                 {son(5);son(6);son(7);son(8);son(133);son(135);son(133);}
 | 
|---|
 | 167 |         }
 | 
|---|
 | 168 |                                         
 | 
|---|
 | 169 | }
 | 
|---|
 | 170 | 
 | 
|---|
 | 171 | //------  fonction  exec  qui interdit la fermeture de la fenetre  ------------
 | 
|---|
 | 172 | 
 | 
|---|
 | 173 | 
 | 
|---|
 | 174 | void exec_controle(int fen,int item,double valeur,...) 
 | 
|---|
 | 175 | {
 | 
|---|
| [649] | 176 | switch(item)
 | 
|---|
 | 177 |     {
 | 
|---|
 | 178 |     case caseferme      :  stop_exec(fen);break;
 | 
|---|
 | 179 |     case con_reset_epld :       reset_epld();   break;
 | 
|---|
 | 180 |     case con_reset_trp  :       reset_trp();    break;
 | 
|---|
 | 181 |     default     :       break;
 | 
|---|
 | 182 |     }   
 | 
|---|
| [637] | 183 | }
 | 
|---|
 | 184 | 
 | 
|---|
 | 185 | 
 | 
|---|
 | 186 | //------  fonction  exec  qui cache la fenetre quand on la ferme  ------------
 | 
|---|
 | 187 | 
 | 
|---|
 | 188 | void exec_cache(int fen,int item,double valeur,...) 
 | 
|---|
 | 189 | {
 | 
|---|
 | 190 | if(item==ouverture)  cache(fen);
 | 
|---|
 | 191 | if(item==caseferme)  {cache(fen);stop_exec(fen);}
 | 
|---|
 | 192 | }
 | 
|---|
 | 193 | 
 | 
|---|
 | 194 | 
 | 
|---|