Skip to content. | Skip to navigation

Personal tools




//  Last updated: 3/16/2007
//  Part of the source code for the M3 Program
//  Contains routines for updating the on-screen display

// Global variables for the blinking cursor
int Cursor = 0;                 // Flag for a blinking cursor
unsigned long CursorTimer = 0; // Time since last blink
int CursorBlinkRate = 200;      // Time in milliseconds between blinks
int MaxCmdLine = 19;            // Maximum number of characters displayed on
                                // the command line

// Center of left cartoon
#define LCX 75
#define LCY 75

// Tip of arrow, right side of arrow, left side of arrow, back of arrow,
// front right line, front left line, all in x,y format
int MTurretCoords[5][12] = {
{-15+LCX,  0+LCY,   0+LCX,-15+LCY,   0+LCX, 15+LCY,  15+LCX,  0+LCY, -10+LCX,-10+LCY, -10+LCX, 10+LCY},
{-10+LCX, 10+LCY, -10+LCX,-10+LCY,  10+LCX, 10+LCY,  10+LCX,-10+LCY, -14+LCX,  0+LCY,   0+LCX, 14+LCY},
{  0+LCX, 15+LCY, -15+LCX,  0+LCY,  15+LCX,  0+LCY,   0+LCX,-15+LCY, -10+LCX, 10+LCY,  10+LCX, 10+LCY},
{ 10+LCX, 10+LCY, -10+LCX, 10+LCY,  10+LCX,-10+LCY, -10+LCX,-10+LCY,   0+LCX, 14+LCY,  14+LCX,  0+LCY},
{ 15+LCX,  0+LCY,   0+LCX, 15+LCY,   0+LCX,-15+LCY, -15+LCX,  0+LCY,  10+LCX, 10+LCY,  10+LCX,-10+LCY}};

// ADC turret coords, ADC box and no-ADC line.
int ATurretCoords[7][12] = {
{ 25+LCX,-53+LCY, -25+LCX,-53+LCY, -25+LCX,-63+LCY,  25+LCX,-63+LCY, -50+LCX, 33+LCY, -50+LCX,-33+LCY},
{-19+LCX,-55+LCY, -55+LCX,-19+LCY, -63+LCX,-27+LCY, -27+LCX,-63+LCY, -12+LCX, 58+LCY, -58+LCX, 12+LCY},
{-53+LCX,-25+LCY, -53+LCX, 25+LCY, -63+LCX, 25+LCY, -63+LCX,-25+LCY, -33+LCX, 50+LCY,  33+LCX, 50+LCY},
{-19+LCX, 55+LCY, -55+LCX, 19+LCY, -63+LCX, 27+LCY, -27+LCX, 63+LCY,  12+LCX, 58+LCY,  58+LCX, 12+LCY},
{ 25+LCX, 53+LCY, -25+LCX, 53+LCY, -25+LCX, 63+LCY,  25+LCX, 63+LCY,  50+LCX, 33+LCY,  50+LCX,-33+LCY},
{ 19+LCX, 55+LCY,  55+LCX, 19+LCY,  63+LCX, 27+LCY,  27+LCX, 63+LCY,  12+LCX,-58+LCY,  58+LCX,-12+LCY},
{ 53+LCX,-25+LCY,  53+LCX, 25+LCY,  63+LCX, 25+LCY,  63+LCX,-25+LCY, -33+LCX,-50+LCY,  33+LCX,-50+LCY}};

// Angle in degrees from +X axis onscreen to ADC Index mark
#define ADCAAngle 305.0
#define ADCBAngle 235.0
#define ADCX 195
#define ADCY 75
#define ADCAR1 31
#define ADCAR2 33
#define ADCBR1 37
#define ADCBR2 39

// Center of Tilt Cartoon area
#define TiltX 300
#define TiltY 75

// Global variables for time and elapsed time
double et,oldet; // Elapsed time since program startup
double maxdword = 4294967295.0;
struct time t,oldt; // t is used to display the time

// Global variables for main loop cycle rate
// MainLoopTimer measures how many milliseconds pass during each
// cycle of the main loop.
// This is used to measure the speed of the program
dword MainLoopTimer;
#define CycleHistorySize 100
dword CycleHistory[CycleHistorySize];
int CycleIndex = 0,CycleMax,CycleAv,OldCycleAv,OldCycleMax;

// Up arrow symbol
#define CUp 30
// Down arrow symbol
#define CDown 31
// Up/Down arrow symbol
#define CUpDown 18
// Left arrow symbol
#define CLeft 17
// Right arrow symbol
#define CRight 16
// Left/Right arrow symbol
#define CLeftRight 29

// Online help

#define NumHelpLines 29
char HelpText[NumHelpLines][80] =
  "                þ M3 Program Online Help þ",
  "M <cmd>: Mirror commands UP,DOWN,STOP",
  "AT <cmd>: ADC Turret HOME,ADC,NOADC,LOCK,UNLOCK,<steps>",
  "ADCA/ADCB <cmd>: ADC Rotators HOME,S<steps>, or <degrees>",
  "ADC <deg>: ADC Rotators combined motion, A/B to +/-<deg>",
  "ADC <cmd>: ADC Rotators motion mode <cmd>= MAN or AUTO", 
  "SP: Toggle power to Tilt, M3 Turret and ADC Turret Steppers",
  "ASP: Toggle power to the ADC Rotators",
  "TILTS <Volts> <Volts> <Volts>: Servo tilts to positions",
  "TENASW <elevation>: Adjust Tilts according to elevation value",
  "NASW/NASE/AUX1/AUX2/AUX3: Move M3 turret to port adjusting tilts",
  "TA/TB/TC <steps>: Move tilt A, B or C stepper <steps>",
  "PISTON <mm>: Tilt M3 in a piston type movement",
  "TH/TV <arcsec>: Tilt M3 horizontally/vertically",
  "TBRKON/TBRKOFF: Engage/Disengage tilt stepper brakes",
  "PVM: Toggle pres/vac control mode on/off",
  "T1/T2: Open a terminal to COM 1/2 at 19.2k",
  "T3: Open a terminal to COM 2: at 300 baud for DGH setup",
  "VERB #: Set verbose level of log to # (0=brief..2=verbose)",
  "<F1>: Display this help screen",
  "<F2>: Dump system log to a file TEMP.LOG",
  "<F3>: Dump screen to a file SCREEN.BMP",
  "<SCROLL LOCK>: Pause log",
  "Up,Down,PageUp,PageDown,Home,End: Scroll selected log",
  "Q/EXIT: Quit",
  "              * Hit <SPACE> key to exit *"

// CmdLine - display a string on the command line
void CmdLine(char *data);
// Displays the string in data on the command line.

// UpdateCursor - Make the cursor blink when it's supposed to.
void UpdateCursor(char *data);

// UpdateTime - Update the onscreen UT and ET times
void UpdateTime(int UpdateAll);
// Pass a 1 in UpdateAll to display every digit,
// otherwise UpdateTime will only display digits that have changed

// InitDisplay - Draw the intial screen (all windows, static text, etc.
void InitDisplay();

// DisplayHelp - Display a list of all keyboard commands
void DisplayHelp();

// ScreenDump - Copy the screen image to the file SCREEN.BMP
void ScreenDump();
// Copies the screen to the Windows BMP file SCREEN.BMP

Generated by GNU Enscript
Document Actions