#include #include #include #include #include #include "mirror.h" #include "tcs.h" double ra, dec; time_t tloc, oldtloc; struct tm *hst; main( int argc, char *argv[] ) { int i, load; double pos; double altitude, azimuth; char buf[200]; FILE * fp = NULL; oldtloc = tloc = 0; get_tcspos( &ra, &dec ); printf( "%lf %lf\n", ra, dec ); mropen( "/dev/ttyS0" ); /* mropen("/dev/ttyC0"); */ printf( "\nDate Time Altitude Azimuth Gauge1 Gauge2 Gauge3 Gauge4 Gauge5 LoadNW LoadNE LoadS\n" ); while(1) { get_tcsaltaz( &altitude, &azimuth ); tloc = time(0); if ( tloc-oldtloc > 60 ) { printf( "\n" ); oldtloc = tloc; } hst = localtime(&tloc); printf( "%2d %02d %02d %2d %02d %02d ", hst->tm_year, hst->tm_mon, hst->tm_mday, hst->tm_hour, hst->tm_min, hst->tm_sec ); printf( "%6.3lf %7.3lf ", altitude, azimuth ); /* Gets the 5 mirror gauge positions */ for ( i = 0; i < 5; i++ ) { pos = mrpos(i); printf( "%8.3lf ", pos ); } /* Gets the 3 loadcell readings */ if( 1 ) { /* this part doesn't work anymore - rsh disable on duke - TD 3/24/2010 */ /* installed rsh-server on duke and configured, this works now - MHO 3/31/2010 */ for ( i = 2010; i < 2013; i++ ) { sprintf( buf, "rsh duke -l iqup /benchmark/mirror/miranda/get_loadcell.tcl digimim %i", i ); if( (fp = popen( buf, "r")) == NULL ) { printf( "popen() error\n" ); } fgets( buf, sizeof(buf), fp ); pclose(fp); load = atoi( buf ); printf( "%6i ", load ); } } printf( "\n" ); /* fflush( stdout ); */ } mrclose(); }