Skip to content. | Skip to navigation

Personal tools




//  Last updated: 10/16/2003
//  Part of the source code for the M3 Program
//  Contains routines for flipping the M3 Mirror up and down

// Mirror motion states
#define MMStop 0
#define MMDown 1
#define MMUp   2
#define MMBoth 3

// Mirror limits
#define MLNone 0		// Mirror midway between limits
#define MLDown 1		// Mirror all the way down (in the beam)
#define MLUp   2		// Mirror folded out of the beam
#define MLBoth 3		// An error reading the limits

// Mirror latch states
#define MLaUnknown 0		// Mirror latches in an unknown position
#define MLaClosed  1		// Mirror latches closed
#define MLaOpen		 2		// Mirror latches open
#define MLaClosing 3		// Mirror latches closing
#define MLaOpening 4		// Mirror latches opening

// Mirror motion steps
#define MMSNone 				0
#define MMSOpenThenUp 	1
#define MMSOpenThenDown 2

// Mirror latch motion steps
#define LMSNone  0
#define LMSClose 1
#define LMSOpen  2

// Mirror latch status bits
// Added during 8/2003 engineering
#define M3LLocked   31
#define M3LUnlocked 32
#define M3RLocked   34
#define M3RUnlocked 35

// CMirror - An object representing the M3 mirror
class CMirror {
	int Motion;			// Current motion of mirror (if any), one of the MM constants
	int Limit;			// Current limit status, one of the ML constants
  int Latch; 			// Current latch position, one of the MLa constants
  int MMotionStep;// Keeps track of current mirror motion status. One of the MMS constants
  int LMotionStep;// Keeps track of current latch motion status. One of the LMS constants
  int MMoving;		// Set to 1 if there's any mirror motion in progress
  int LMoving;		// Set to 1 if there's any latch motion in progress

	dword MotionTimer;		// Time mirror motion (ms), and abort move if a limit isn't reached
	dword MotionTimeout;	// Maximum time mirror should move before hitting a limit, from M3.INI
  dword LatchTimer;			// Time latches opening (ms)
  dword FullLatchMove;	// Time in milliseconds for latches to fully open/close

	void Init();  				// Initialize the object
	void Update();        // Update mirror motion/status
	void DisplayAll();		// Display all status on-screen
	void DisplayMotion();	// Display mirror motion bit onscreen
	void DisplayLimit();	// Display mirror limit bit onscreen
	void DisplayLatch();	// Display mirror latch status onscreen
	void Up(int force);		// Start mirror moving up
												// (set the force bit to 1 if you want to force the
												//  mirror to move up even if the ADC turret is in
												// a position that could cause mirror damage
	void Down();					// Start mirror moving down
	void Stop();					// Stop mirror motion
  void CloseLatches();  // Close mirror latches
  void OpenLatches();   // Open mirror latches
} Mirror;

Generated by GNU Enscript
Document Actions