@@ -77,6 +77,8 | |||
|
77 | 77 | |
|
78 | 78 | |
|
79 | 79 | char *buff_experimento= NULL; |
|
80 | //char *cbeam = malloc(7); | |
|
81 | char *cbeam = NULL; | |
|
80 | 82 | |
|
81 | 83 | AT91S_PIO *pioc; |
|
82 | 84 | AT91S_PIO *piob; |
@@ -116,6 +118,7 | |||
|
116 | 118 | int cambia_apuntamiento(char *puntero_char); |
|
117 | 119 | int carga_experimento(char *nombre_archivo); |
|
118 | 120 | char *chequeo_sistema(char *filename, char *numero_muestras); |
|
121 | char *chequeo_sistema2(); | |
|
119 | 122 | void escribe_experimento(char *data, char filename[]); |
|
120 | 123 | char *Lee_experimento(char *filename); |
|
121 | 124 | void consigue_nombre_experimento(char *rx_data, char filename[]); |
@@ -422,6 +425,51 | |||
|
422 | 425 | strcpy(tx_data,parameters.ID); |
|
423 | 426 | printf("%s\n",tx_data); |
|
424 | 427 | } |
|
428 | else if(strcmp(cmd,"MNTR") == 0){ | |
|
429 | if(strcmp(rx_data,"0") == 0){ | |
|
430 | //Only current beam is requested | |
|
431 | tx_data = malloc(50); | |
|
432 | strcpy(tx_data,parameters.ID); | |
|
433 | strcat(tx_data,"\n-------\n"); | |
|
434 | strcat(tx_data,cbeam); | |
|
435 | printf("%s\n",tx_data); | |
|
436 | } | |
|
437 | else if(strcmp(rx_data,"1") == 0){ | |
|
438 | //Only relay status is requested | |
|
439 | tx_data = malloc(50); | |
|
440 | strcpy(tx_data,parameters.ID); | |
|
441 | strcat(tx_data,"\n-------\n"); | |
|
442 | strcat(tx_data,chequeo_sistema2()); | |
|
443 | printf("%s\n",tx_data); | |
|
444 | } | |
|
445 | else if(strcmp(rx_data,"2") == 0){ | |
|
446 | //Only phase is requested | |
|
447 | tx_data = malloc(100); | |
|
448 | strcpy(tx_data,parameters.ID); | |
|
449 | strcat(tx_data,"\n-------\n"); | |
|
450 | strcat(tx_data,ABS_monitoreo(1, 0, 50, 10)); | |
|
451 | printf("%s\n",tx_data); | |
|
452 | } | |
|
453 | else if(strcmp(rx_data,"3") == 0){ | |
|
454 | //Current beam and relay status is requested | |
|
455 | tx_data = malloc(100); | |
|
456 | strcpy(tx_data,parameters.ID); | |
|
457 | strcat(tx_data,"\n-------\n"); | |
|
458 | strcat(tx_data,cbeam); | |
|
459 | strcat(tx_data,chequeo_sistema2()); | |
|
460 | printf("%s\n",tx_data); | |
|
461 | } | |
|
462 | else{ | |
|
463 | //Current beam, relays status and phase is requested | |
|
464 | tx_data = malloc(100); | |
|
465 | strcpy(tx_data,parameters.ID); | |
|
466 | strcat(tx_data,"\n-------\n"); | |
|
467 | strcat(tx_data,cbeam); | |
|
468 | strcat(tx_data,chequeo_sistema2()); | |
|
469 | strcat(tx_data,ABS_monitoreo(1, 0, 50, 10)); | |
|
470 | printf("%s\n",tx_data); | |
|
471 | } | |
|
472 | } | |
|
425 | 473 | else{ |
|
426 | 474 | tx_data = (char*)malloc(6); |
|
427 | 475 | tx_data = "Error"; |
@@ -559,7 +607,7 | |||
|
559 | 607 | |
|
560 | 608 | int base= 7*puntero; // base= cantidad_bytes del dato x puntero |
|
561 | 609 | // cantidad de bytes es el numero de bytes que |
|
562 |
|
|
|
610 | // contiene cada dato, para este caso es 7 | |
|
563 | 611 | // porque es 6 bits de datos + 1 bit del cambio |
|
564 | 612 | // de linea. |
|
565 | 613 | char valor_char; |
@@ -580,6 +628,13 | |||
|
580 | 628 | acumulado_unos= acumulado_unos + (1 << desplazamiento[offset]); |
|
581 | 629 | } |
|
582 | 630 | } |
|
631 | // | |
|
632 | ||
|
633 | char cero = '\0'; | |
|
634 | char enter = '\n'; | |
|
635 | cbeam = malloc(8); | |
|
636 | sprintf(cbeam,"%c%c%c%c%c%c%c%c",buff_experimento[base],buff_experimento[base+1],buff_experimento[base+2],buff_experimento[base+3],buff_experimento[base+4],buff_experimento[base+5],enter,cero); | |
|
637 | printf("Beam: %s : %s\n",puntero_char,cbeam); | |
|
583 | 638 | pio_out(pioc, maskc_out_beam, acumulado_unos, 1); |
|
584 | 639 | pio_out(pioc, maskc_out_beam, acumulado_ceros, 0); |
|
585 | 640 | |
@@ -641,6 +696,40 | |||
|
641 | 696 | return all_pages; |
|
642 | 697 | } |
|
643 | 698 | |
|
699 | char* chequeo_sistema2(){ | |
|
700 | ||
|
701 | int i; | |
|
702 | unsigned int entradac= 0; | |
|
703 | char page1[8]; | |
|
704 | ||
|
705 | //Inicializando arreglo | |
|
706 | for(i=0;i<6;i++) | |
|
707 | page1[i]='0'; | |
|
708 | page1[6] = '\n'; | |
|
709 | page1[7] = '\0'; | |
|
710 | //Lectura de puerto | |
|
711 | entradac= pio_in(piob,maskb_in); | |
|
712 | //Dandole formato al dato | |
|
713 | if (!(entradac & bit_up_2)) | |
|
714 | page1[0] = '1'; | |
|
715 | if (!(entradac & bit_up_1)) | |
|
716 | page1[1] = '1'; | |
|
717 | if (!(entradac & bit_up_0)) | |
|
718 | page1[2] = '1'; | |
|
719 | if (!(entradac & bit_dow_2)) | |
|
720 | page1[3] = '1'; | |
|
721 | if (!(entradac & bit_dow_1)) | |
|
722 | page1[4] = '1'; | |
|
723 | if (!(entradac & bit_dow_0)) | |
|
724 | page1[5] = '1'; | |
|
725 | ||
|
726 | char *all_pages = malloc(strlen(page1)+1); | |
|
727 | strcpy(all_pages, page1); | |
|
728 | ||
|
729 | return all_pages; | |
|
730 | } | |
|
731 | ||
|
732 | ||
|
644 | 733 | int update_app(char *filename, char *ip_number){ |
|
645 | 734 | |
|
646 | 735 | char cmd[80]; |
@@ -745,7 +834,7 | |||
|
745 | 834 | FILE *archivo; |
|
746 | 835 | float phase1; |
|
747 | 836 | float phase2; |
|
748 | char page0[30]; | |
|
837 | //char page0[30]; | |
|
749 | 838 | char page1[20]; |
|
750 | 839 | |
|
751 | 840 | int cnt = 0; |
@@ -896,14 +985,16 | |||
|
896 | 985 | |
|
897 | 986 | sleep(1); |
|
898 | 987 | |
|
899 | strcpy(page0,parameters.ID); | |
|
900 | strcat(page0,"\n-------\n"); | |
|
988 | // strcpy(page0,parameters.ID); | |
|
989 | // strcat(page0,"\n-------\n"); | |
|
901 | 990 | |
|
902 | 991 | //sprintf(page1,"UP:%1.2f DW:%1.2f\n",phase1, phase2); |
|
903 |
sprintf(page1,"%1.2f |
|
|
904 | strcat(page0,page1); | |
|
905 | char *all_pages = malloc(strlen(page0)+1); | |
|
906 | strcpy(all_pages, page0); | |
|
992 | sprintf(page1,"%1.2f\n%1.2f\n",phase1, phase2); | |
|
993 | page1[strlen(page1)]='\0'; | |
|
994 | // strcat(page0,page1); | |
|
995 | // char *all_pages = malloc(strlen(page0)+1); | |
|
996 | char *all_pages = malloc(strlen(page1)+1); | |
|
997 | strcpy(all_pages, page1); | |
|
907 | 998 | return all_pages; |
|
908 | 999 | |
|
909 | 1000 | // } |
General Comments 0
You need to be logged in to leave comments.
Login now