/* This guy handles all the dome stuff */ /* JSW 20Jan00 Port to Linux */ /* JSW 8Apr11 Add "dome ". Remove "dome */ /* right", "dome left" and "dome init" */ #include #include "wirotypes.h" #include "track.h" #include "wiro.h" void log_entry( char *comment ); struct wiro_memory *tinfo, *get_tinfo(); main( int argc, char *argv[] ) { double val; char log_message[ 64 ]; tinfo = get_tinfo(); if (argc < 2) { printf("\n%5.1f \n", tinfo -> dome_enc); exit(0); } if (argc == 2) { if ( strcmp( "on", argv[ 1 ] ) == 0 ) { if(!(tinfo->no_motion)) { tinfo -> dome_on = 1; log_entry( "dome on" ); exit(0); } printf("Telescope-off requires Dome-off.\n"); exit(1); } if ( strcmp( "off", argv[ 1 ] ) == 0 ) { tinfo -> dome_on = 0; log_entry( "dome off" ); exit(0); } if ( sscanf(argv[ 1 ], "%lf", &val) != 1) { printf("\nArgument not recognized: %s\n", argv[ 1 ]); help( ); exit(2); } if (( val < 0.0 ) || ( 360.0 < val )) { printf("\nArgument is out-of-range (0-360): %s\n", argv[ 1 ]); help( ); exit(3); } if(!(tinfo->no_motion)) { tinfo -> dome_des_pos = val; tinfo -> dome_on = 2; sprintf( log_message, "dome %5.1lf", val ); log_entry( log_message ); exit(0); } printf("Telescope-off requires Dome-off.\n"); exit(4); } if (argc > 2) { printf("Unknown dome command.\n"); help( ); } } /* end main */ help( ) { printf("\nCommand syntax: \"dome [on, off, ]\"\n"); printf("Description:\n"); printf(" \"dome\" displays the current dome azimuth and exits.\n"); printf(" \"dome on\" slaves the dome to the telescope's azimuth.\n"); printf(" \"dome off\" stops dome motion immediately.\n"); printf(" \"dome \" causes the dome to move to and\n"); printf(" remain at the specified azimuth.\n"); printf("Argument: The value of the specified azimuth must be\n"); printf(" between 0.0 and 360.0.\n"); }