#!/bin/csh -f #+ # domelamps -- turn spectral or imaging dome lamps on or off, or show status # # Purpose: # With no arguments, report the current status of the dome flatfield # lamps ("imaging", "spectral", or "off"). With an argument, set the # lamps to the specified mode. Each set of lamps may be turned on or # off by issuing the appropriate command. The two sets of lamps cannot # be turned on at the same time, however. # # Usage: # domelamps [status] # # Arguments: # status = [ imaging | spectral | both | off ] # Specify the new setting for the dome lamps # imaging = imaging lamps ON, spectral OFF # spectral = spectral lamps ON, imaging OFF # both = spectral and imaging lamps ON # off = all lamps OFF # # Output: # None # # Restrictions: # None # # Exit values: # 0 = normal completion # 1 = wrong number of arguments # # Example: # 1. Show the status of the dome flat lamps: # domelamps # # 2. Turn on the imaging flatfield lamps: # domelamps im # # 3. Turn on the spectral flatfield lamps: # domelamps spec # # 4. Turn off all dome lamps: # domelamps off # #- # Modification history: # 2001-Oct-27 RWG Original version # 2001-Nov-18 GDW Changed values for flimagin/flspectr to 0 and 1 # 2003-Aug-01 GDW Added "both" option #----------------------------------------------------------------------- set buf = $0 set cmd = $buf:t set usage = "Usage: $cmd spec|im|both|off" # verify args... if ( $#argv > 1 ) then printf "$usage\n" exit 1 endif # if no args. show status... if ( $#argv == 0 ) then set buf = ( `show -s dcs -terse flimagin flspectr` ) set flimagin = $buf[1] set flspectr = $buf[2] if ( "$flimagin" == "on" && "$flspectr" == "off" ) then set mode = "imaging" else if ( "$flimagin" == "off" && "$flspectr" == "on" ) then set mode = "spectral" else if ( "$flimagin" == "on" && "$flspectr" == "on" ) then set mode = "both" else if ( "$flimagin" == "off" && "$flspectr" == "off" ) then set mode = "off" else printf "ERROR $cmd -- invalid mode!\n" exit 2 endif printf "%s\n" $mode exit endif # grab argument and convert to lowercase... set mode = `tolower $1` # act on the specified mode... switch ($mode) case spec: case spectr: case spectral: modify -s dcs2 flimagin=0 flspectr=1 breaksw case im: case imaging: case image: modify -s dcs2 flimagin=1 flspectr=0 breaksw case both: modify -s dcs2 flimagin=1 flspectr=1 breaksw case off: modify -s dcs2 flimagin=0 flspectr=0 breaksw default: printf "$usage\n" breaksw endsw