STRUCTURES: ----------- Bstruct: this holds all the information needed to describe a bench on the telescopes. It includes: int bnum bench number: The old bench code #- each bench has a unique bench code- the PDP-11 DR11s used this code- it is how I index a bench since each bench name (ex. 26e1) corresponds to one and only one bench code. int lnum LBC number: The code which the corresponding LBC calls to go to that bench. For the 10" benches, they are: 10E->3, 10C->2,10W->1. for the 26", they are: 26E2->5 26E1->4, 26C->3, 26W->2, SF->1. This is the code that is output to each LBC to tell it to go to a bench on that telescope. char bench[9] bench name - 26e1, 26e2, etc. which bench is assigned to which lnum and bnum can be changed by editing bench.params and bench.save char camera[31] camera name - what camera is on that bench. I do nothing with this now but keep track of it for display purposes int ct cycle time- how long to wait before coming back to this bench. int dt dwell time- how long to sit on this bench once the light is there. A value of zero means the bench is controlled by a host computer, so wait for it to say it's done. A non-zero value means after you go to the bench, remain there for dt seconds, then go to the next bench. char host[9] host computer name: name of the computer which is hosting the camera on that bench. I need this to establish the right communication between the control and host computers. int lr; light released flag: 1 means yet, the light has been released either by the host computer or the dwell time clock, and 0 means no it hasn't. VARIABLES: ---------- All global variables start with a capital letter. Variables that are #defined are in all caps. all other variables are entirely lower case. #Defined -------- ELBA Error code for Light Beam Available Error. That is, the error resulting from when the telescope flip mirror in-position switch does not indicate a mirror is in position after it has been told to move. EDWL Error code for Done With Light Error. That is, the error resulting from when the host computer does not tell the control computer (Ingrid, in this case) that it is done with the light (ie. taken its picture). The program waits up to one cycle time for that bench before setting this time-out error. I.E., the host computer said it was ready for the light, Ingrid sent the light there and told the host the light was there, but after one full cycle time for that bench, the host computer still has not yet released the light. ERFL Error code for Ready For Light Error. That is, the error resulting from when the host computer does not tell the control computer (Ingrid, in this case) that it is ready to get the light again. The program waits up to one cycle time for that bench before setting this time-out error. I.E., the error is produced when Ingrid's bench timer is up, but for one full cycle time, she does not get the RFL signal from the bench's host computer. Global ------ int Enotify[Error_Code][Bench] in an array of flags like Ignore[][] that tells when the user has been notifed about an Error Code on a given Bench. 1 means user has been notified this time, so don't notify again. It is reset to 0 once the user has taken appropriate action in the error popup box. int Erfltime[Bench] holds timers for how long computer has been waiting for the RFL (Ready for Light) signal after it has decided to go there. That is, if the cycle timer is up, the computer checks that bench's serial port for a RFL command- if it's not found, it puts the current time plus the cycle time in Erfltime and waits at most until that time for the RFL signal to come in. In the meantime, it will go on to the next bench, checking back with this bench periodically for the RFL signal. int Ignore[Error_Code][Bench] is an array of flags (1=yes, 0=no) that tells which Error_Codes on which Bench to ignore. The first index is the error code, and the second is the bench number. The error codes are #defined at the beginning of the program. int Sfd[8] These are the serial port file descriptors. Index 0 is that for port /dev/ttyC0, 1 for /dev/ttyC1, etc. The /dev/ttyC* ports are from the Cyclades serial card we are using (see Hardware.notes). int Srfl[8] int Sdwl[8] the check_serial routine runs in the main() event loop and checks the serial ports for incoming commands. If it finds an RFL (ready for light), DWL (done with light), IFR (Information request - from Vax only currently), or end (host program sequence terminated- currently only sent from Vaxes), it sets the SPORT (which serial port we are checking) index of the appropriate one of these arrays to 1. The array entry is then cleared when the value is used elsewhere in the program. int Rflto Stands for Ready For Light TimeOut - I set this when an RFL error box is being displayed so that we don't continue to cycle until the user does something about the error. It is unset when the user does something with the Error box. Local ----- int gberr is used many places as a return value from goto_bench. The name stands for "goto_bench error". It is designed to indicate a successful (or not) mirror flip. Its values are: 0 - everything ok. -1 - light beam availalble signal not received. this corresponds to error code ELBA in the Ignore array