Example #1
0
void GtoT_CameraStatusTCReply(
			      unsigned short ROIX,
			      unsigned short ROIY,
			      unsigned short ROIdX,
			      unsigned short ROIdY,
			      unsigned char binning,
			      unsigned short expt
			      ){

static  char logentry[128];
static   message m;





  m.length = 19;

  m.body[0]=0x55;
  
  _cnt = GtoT_Count();
  _pus = (unsigned short *) &m.body[1];
  *_pus = _cnt;
  
  _pus = (unsigned short *) &m.body[3];
  *_pus = 12;
  
  _pus = (unsigned short *) &m.body[5];
  *_puc = 130;

  _pus = (unsigned short *) &m.body[6];
  *_pus = ROIX;

  _pus = (unsigned short *) &m.body[8];
  *_pus = ROIY;

  _pus = (unsigned short *) &m.body[10];
  *_pus = ROIdX;

  _pus = (unsigned short *) &m.body[12];
  *_pus = ROIdY;

  m.body[14] = binning;

  _pus = (unsigned short *) &m.body[15];
  *_pus = expt;

  m.body[17] = m.FindCRC();
  m.body[18] = 0xAA;  
  
  SendToTMTC(m);

  sprintf(logentry,"GtoT,CameraStatusTCReply,%d,%d,%d,%d,%d,%d",ROIX, ROIY,ROIdX, ROIdY, binning, expt);
  
  WriteToLog(logentry);

  

  return;
}
Example #2
0
 char GtoM_AutoCollimationTC(
				  ){
static unsigned short *pUS;

static int err;

   
static    message m;
static    char logentry[128];
   err=0;
static unsigned short int cnt;

   m.length = 8;
   m.body[0]=0x55;
   cnt = GtoM_Count();
   pUS = (unsigned short *) &m.body[1];
   *pUS = cnt; 
   pUS = (unsigned short *) &m.body[3]; 
   *pUS = 1;
   
   m.body[5] = 100;
   
   m.body[6] = m.FindCRC();
   m.body[7] = 0xAA;
   
   if(SendToMPFNum(m)) return 2;

   sprintf(logentry,"GtoM,S,100,AutoCollimationTC");
   
   WriteToLog(logentry);
   
   
   return 0;
 };
Example #3
0
void GtoT_ELCETCReply(unsigned char success)
{
static  char logentry[128];
static   char err;
static   message m;

  err = 0;

  if(success == 0 || success == 1){
    
    m.length = 9;
    m.body[0]=0x55;
    
    _cnt = GtoT_Count();
    _pus = (unsigned short *) &m.body[1];
    *_pus = _cnt;

    _pus = (unsigned short *) &m.body[3];
    *_pus = 2;

    _pus = (unsigned short *) &m.body[5];
    *_puc = 123;
    
    m.body[6] = success;
    
    m.body[7]=m.FindCRC();
    m.body[8] = 0xAA;
    
    SendToTMTC(m);

    sprintf(logentry,"GtoT,ELCETCReply,%d",success);
    WriteToLog(logentry);
  }; 
  return;
};
Example #4
0
 char GtoM_SwitchingDTURequest(
				  ){
static unsigned short *pUS;
static int err;
static unsigned short    int cnt;   
static   message m;
static  char logentry[128];
   err = 0 ;

   m.length = 8;
   m.body[0]=0x55;
   cnt = GtoM_Count();
   pUS = (unsigned short *) &m.body[1];
   *pUS = cnt; 
   pUS = (unsigned short *) &m.body[3]; 
   *pUS = 1;
   
   m.body[5] = 4;
   
   m.body[6] = m.FindCRC();
   m.body[7] = 0xAA;
   
   if(SendToMPFNum(m)) return 2;

   sprintf(logentry,"GtoM,S,4,SwitchingDTURequest");
   
   WriteToLog(logentry);
   
   
   return 0;
 };
Example #5
0
void GtoT_MessageRcvd(unsigned char msg){
  static message m;
  m.length = 9;
  
  m.body[0]=0x55;

    _cnt = GtoT_Count();
    _pus = (unsigned short *) &m.body[1];
    *_pus = _cnt;

    _pus = (unsigned short *) &m.body[3];
    *_pus = 2;

    m.body[5] = 254;
    
    m.body[6] = msg;
    
    m.body[7]=m.FindCRC();
    m.body[8] = 0xAA;
    
    SendToTMTC(m);

    //    sprintf(logentry,"GtoT,AutoCollimationTCReply,%d",success);
    //    WriteToLog(logentry);
}; 
Example #6
0
void GtoT_PointingErrors(float el, float ce){
  static message m;

  
  m.length = 16;
  m.body[0] = 0x55;
  _cnt = GtoT_Count();
  _pus = (unsigned short *) &m.body[1];
  *_pus = _cnt;  
  _pus = (unsigned short *) &m.body[3];
  *_pus = 9;  
  
  m.body[5] = 255;
  
  _pf = (float *) &m.body[6];
  *_pf = el;
  
  _pf = (float *) &m.body[10];
  *_pf = ce;
  
  m.body[14]=m.FindCRC();
  m.body[15] = 0xAA;
  
  SendToTMTC(m);
  //  WriteToLog("Sent out pointint errors!\0");  
  return;
};
Example #7
0
void GtoT_AutocollimationOffsets(float x, float y, float r){//251
  static message m;
  m.length = 20;
  m.body[0] = 0x55;
  _cnt = GtoT_Count();
  _pus = (unsigned short *) &m.body[1];
  *_pus = _cnt;  
  _pus = (unsigned short *) &m.body[3];
  *_pus = 13;  
  
  m.body[5] = 251;
  
  _pf = (float *) &m.body[6];
  *_pf = x;
  
  _pf = (float *) &m.body[10];
  *_pf = y;

  _pf=(float*) &m.body[14];
  *_pf = r;
  
  m.body[18]=m.FindCRC();
  m.body[19] = 0xAA;
  
  SendToTMTC(m);
  //  WriteToLog("Sent out pointint errors!\0");  
  return;
};
Example #8
0
void GtoT_FrameBlobs(frameblob *fb){
  bloblist *pblob;
  unsigned short x[10],y[10];
  unsigned int flux[10];
  double cx, cy;
  unsigned char blobs;
  unsigned char currentblob;
  static message m;

  currentblob = 0;
  blobs = 0;

  pblob = fb->getblobs();
  m.length = 89;
  m.body[0] = 0x55;
  _cnt = GtoT_Count();
    _pus = (unsigned short *) &m.body[1];
  *_pus = _cnt;  
  _pus = (unsigned short *) &m.body[3];
  *_pus = 82;  
  
  m.body[5] = 250;
  
  static int i;
  for(i=0;i<10;i++){
    x[i] = 0;
    y[i] = 0;
  };

  while(pblob!=NULL && currentblob<10){
    x[currentblob]=(unsigned short) floor(pblob->getx()+0.5);
    y[currentblob]=(unsigned short) floor(pblob->gety()+0.5);
    flux[currentblob] = (unsigned int) pblob->getflux();
    pblob = pblob->getnextblob();
    currentblob++;
  };

  blobs = currentblob;
  m.body[6] = blobs;
  for(i=0;i<10;i++){
    _pus= (unsigned short *) &m.body[7+8*i];
    *_pus = x[i];
    _pus= (unsigned short *) &m.body[9+8*i];
    *_pus = y[i];
    _pui = (unsigned int *) &m.body[11+8*i];
    *_pui = flux[i];
  };
  m.body[87]=m.FindCRC();
  m.body[88] = 0xAA;

  SendToTMTC(m);
  

};
Example #9
0
 char GtoM_TrackingRequest(
			   double ra,
			   double dec,
			   unsigned char config
			   ){
static unsigned short *pUS;
static  double *pd;
static int err;
static  unsigned short int cnt;   
static   message m;
static    char logentry[128];
   err = 0 ;

   if(config > 2) err++;
   
   if(err >0) return 1;

   m.length = 25; 

   m.body[0] = 0x55;
   cnt = GtoM_Count();
   pUS = (unsigned short *) &m.body[1];
   *pUS = cnt; 
   pUS = (unsigned short *) &m.body[3]; 
   *pUS = 18;
   
   m.body[5] = 5;
   
   pd = (double *) &m.body[6];
   *pd = ra;
   
   pd = (double *) &m.body[14];
   *pd = dec;

   m.body[22] = config;
   
   m.body[23] = m.FindCRC();
   

   m.body[24] = 0xAA;
   

   if(SendToMPFNum(m)) return 2;

   sprintf(logentry,"GtoM:TrackingRequest:%.5f,%.5f,%d",ra,dec,config);
   
   WriteToLog(logentry);

   
   return 0;
 };
Example #10
0
void GtoT_VideoStatusTCReply(
			     unsigned char freq,
			     unsigned char cross,
			     unsigned char GPSt,
			     unsigned char GPScoord,
			     unsigned char RADEC,
			     unsigned char contrast,
			     unsigned char brightness,
			     unsigned char gamma
			     ){

static   char logentry[128];
static   message m;



  m.length = 16;

  m.body[0]=0x55;
  
  _cnt = GtoT_Count();
  _pus = (unsigned short *) &m.body[1];
  *_pus = _cnt;
  
  _pus = (unsigned short *) &m.body[3];
  *_pus = 9;
  
  _pus = (unsigned short *) &m.body[5];
  *_puc = 131;

  m.body[6] = freq;
  m.body[7] = cross;
  m.body[8] = GPSt;
  m.body[9] = GPScoord;
  m.body[10] = RADEC;
  m.body[11] = contrast;
  m.body[12] = brightness;
  m.body[13] = gamma;

  m.body[14] = m.FindCRC();
  m.body[15] = 0xAA;
  
  SendToTMTC(m);
  
  sprintf(logentry,"GtoT,VideoStatusTCReply,%d,%d,%d,%d,%d,%d,%d,%d",freq,cross,GPSt,GPScoord,RADEC,contrast,brightness,gamma);
  
  return;
};
Example #11
0
 char GtoM_SlewingRequest(
			  double ra,
			  double dec
			   ){
static  unsigned short *pUS;
static  double *pd;
 
static int err;
static unsigned short cnt;   
static    message m;
static   char logentry[128];
   err = 0;

   
   if(err >0) return 1;

   m.length = 24; 

   m.body[0] = 0x55;
   cnt = GtoM_Count();
   pUS = (unsigned short *) &m.body[1];
   *pUS = cnt; 
   pUS = (unsigned short *) &m.body[3]; 
   *pUS = 17;
   
   m.body[5] = 6;
   
   pd = (double *) &m.body[6];
   *pd = ra;
 

   pd = (double *) &m.body[14];
   *pd = dec;


   m.body[22] = m.FindCRC();
   
   m.body[23] = 0xAA;
   

   if(SendToMPFNum(m)) return 2;
   
   sprintf(logentry,"GtoM:SlewingRequest:%.5lf,%.5lf",ra,dec);
   
   WriteToLog(logentry);
   
   return 0;
 };
Example #12
0
void GtoT_TextError(char *str){
static   char logentry[255];
static  int i;
static   unsigned short msglng;
static   message m;

  msglng = strlen(str);

  //  sprintf(logentry,"STRINGLENGTH %d",msglng);
  //  WriteToLog(logentry);

  m.length= msglng + 8;


  m.body[0]=0x55;
  
  _cnt = GtoT_Count();
  _pus = (unsigned short *) &m.body[1];
  *_pus = _cnt;


  _pus = (unsigned short *) &m.body[3];
  *_pus = msglng+1;

  _puc = (unsigned char *) &m.body[5];
  *_puc = 124;


  sprintf(logentry,"GtoT:");


  for(i=0;i<msglng;i++){
    m.body[6+i] = str[i];
    logentry[13+i]= str[i];
  };
  logentry[13+msglng]=0;
  m.body[m.length-2] = m.FindCRC();
  m.body[m.length-1] = 0xAA;
  

  SendToTMTC(m);
  //  sprintf(logentry,"GTT:233");
  //  WriteToLog(logentry);  

  return;
};
Example #13
0
char GtoM_ELCEOffsetsRequest(
			    float EL,
			    float CE
			    ){
#ifdef MEMCHECK
mtrace();
#endif
static unsigned short *pUS;
static float *pF;
static   char elceor_lgntr[128];
static   message elceor_m;
static   char *logentry;
static unsigned short int cnt;
  logentry = elceor_lgntr;
  
  elceor_m.length=16;
  
  elceor_m.body[0] = 0x55;

  cnt = GtoM_Count();
  pUS = (unsigned short *) &elceor_m.body[1];
  *pUS = cnt;   
  
  pUS = (unsigned short *) &elceor_m.body[3];
  *pUS = 9;
  
  elceor_m.body[5] = 7;
  
  pF = (float *) &elceor_m.body[6];
  *pF = EL;

  pF = (float *) &elceor_m.body[10];
  *pF = CE;
  
  elceor_m.body[14] = elceor_m.FindCRC();
  elceor_m.body[15] = 0xAA;
  
  if(SendToMPFNum(elceor_m)) return 2;
  
    sprintf(logentry,"GtoM,S,7,%.2f,%.2f",EL,CE);
    WriteToLog(logentry);
  
  return 0; 
};
Example #14
0
void GtoT_CameraError(unsigned char err){ //253
  static message m;

  m.length = 9;
  m.body[0] = 0x55;
  _cnt = GtoT_Count();
  _pus = (unsigned short *) &m.body[1];
  *_pus = _cnt;  
  _pus = (unsigned short *) &m.body[3];
  *_pus = 2;  

  m.body[5] = 253;
  m.body[6] = err;
  m.body[7] = m.FindCRC();
  m.body[8] = 0xAA;

  SendToTMTC(m);
  return;
};
Example #15
0
void GtoT_TextError(message msg){
static  char logentry[128];
static   message m;
static   int i;
static   unsigned short msglng;

  msglng = msg.length;

  m.length = msglng+8;

  m.body[0]=0x55;
  
  _cnt = GtoT_Count();
  _pus = (unsigned short *) &m.body[1];
  *_pus = _cnt;
  
  _pus = (unsigned short *) &m.body[3];
  *_pus = msglng+1;
  
  _pus = (unsigned short *) &m.body[5];
  *_puc = 124;

  sprintf(logentry,"GtoM,Message:");

  for(i=0;i<msglng;i++){
    m.body[6+i] = msg.body[i];
    logentry[13+i]=msg.body[i];
  };
  logentry[13+msglng]=0;
  m.body[m.length-2] = m.FindCRC();
  m.body[m.length-1] = 0xAA;
  
  
  SendToTMTC(m);
  
  WriteToLog(logentry);

  
  return;
};
Example #16
0
char GtoM_GuiderStatusData(
			   unsigned char OpState,
			   unsigned char FPController
			   ){
static unsigned short *pUS;
static int err;
static unsigned short int cnt;
static message m_gsd; 

  err=0;

  m_gsd.length = 10;
  
  m_gsd.body[0] = 0x55;
  
  cnt = GtoM_Count();
  pUS = (unsigned short *) &m_gsd.body[1];
  *pUS = cnt;   
  
  pUS = (unsigned short *) &m_gsd.body[3];
  *pUS = 3;
  
  m_gsd.body[5] = 8;
  
  m_gsd.body[6] = OpState;
  m_gsd.body[7] = FPController;
  
  m_gsd.body[8] = m_gsd.FindCRC();
  m_gsd.body[9] = 0xAA;
  
  if(SendToMPFNum(m_gsd)) return 2;
  
  sprintf(logentr,"GtoM,S,8,%d,%d",OpState, FPController);
  WriteToLog(logentr);
  return 0;
};
Example #17
0
 char GtoM_GuiderPointingErrorsData(
				    float EL,
				    float CE,
				    unsigned char validELCE,
				    double ra,
				    double dec,
				    unsigned char validRADEC
				    ){
static  unsigned short *pUS;
static  float *pF;
 
static  double *pd; 
 
static  int err;
 


   
static  char logentry[128];
static unsigned short int cnt;   
static  message m;

   err = 0;
   
   
    m.length = 34; 

    
   if (err > 0) return 1;
   
   m.body[0] = 0x55;

   // needs a lock here
   
   cnt = GtoM_Count();
   pUS = (unsigned short *) &m.body[1];
   *pUS = cnt;
   
   
   pUS = (unsigned short *) &m.body[3];
   *pUS = 27;

   m.body[5] = 1;

   pF = (float *) &m.body[6];
   *pF = EL;
   pF = (float *) &m.body[10];
   *pF = CE;

   m.body[14] = validELCE;

   pd = (double *) &m.body[15];
   *pd = ra;

   pd = (double *) &m.body[23];
   *pd = dec;

   m.body[31] = validRADEC;


   m.body[32] = m.FindCRC();
   m.body[33]=0xAA;
   
   // 
  
   if(SendToMPFNum(m)) return 2;
   
   
   sprintf(logentry,"GuiderPED:%d,%.2f,%.2f,%1d,%.5lf,%.5lf,%d",
	   m.body[1],
	   EL,CE,validELCE,
	   ra,dec,validRADEC);

   WriteToLog(logentry); 
   

   return 0;
};
Example #18
0
void GtoT_StatusUpdate(
		       unsigned long gpst,
		       unsigned short gpslond,
		       unsigned short gpslonm,
		       float gpslons,
		       unsigned char gpslonc,
		       unsigned short gpslatd,
		       unsigned short gpslatm,
		       float gpslats,
		       unsigned char gpslatc,
		       double GSra,
		       double GSdec,
		       double GRra,
		       double GRdec,
		       unsigned char GRvalid,
		       unsigned char Gmode,
		       unsigned char MPFmode,
		       unsigned char GSensor,
		       unsigned char MPFsensor,
		       unsigned short expt
		       ){
  //  char logentry[128];
static  message m;
  //  int i;
  //  unsigned short msglng;



  m.length = 73;

  m.body[0]=0x55;
  
  _cnt = GtoT_Count();
  _pus = (unsigned short *) &m.body[1];
  *_pus = _cnt;
  
  _pus = (unsigned short *) &m.body[3];
  *_pus = 66;
  
  _pus = (unsigned short *) &m.body[5];
  *_puc = 140;

  
  _pul = (unsigned long *) &m.body[6];
  *_pul = gpst;

  _pus = (unsigned short *) &m.body[14];
  *_pus = gpslond;
  
  _pus = (unsigned short *) &m.body[16];
  *_pus = gpslonm
;
  _pf = (float *) &m.body[18];
  *_pf = gpslons;

  _puc = (unsigned char *) &m.body[22];
  *_puc = gpslonc;

  _pus = (unsigned short *) &m.body[23];
  *_pus = gpslatd;

  _pus = (unsigned short *) &m.body[25];
  *_pus = gpslatm;
  _pf = (float *) &m.body[27];
  *_pf = gpslats;
  _puc = (unsigned char *) &m.body[31];
  *_puc = gpslatc;

  _pd = (double *) &m.body[32];
  *_pd = GSra;

  _pd = (double *) &m.body[40];
  *_pd = GSdec;

  _pd = (double *) &m.body[48];
  *_pd = GRra;

  _pd = (double *) &m.body[56];
  *_pd = GRdec;

  m.body[64] = GRvalid;
  m.body[65] = Gmode;
  m.body[66] = MPFmode;
  m.body[67] = GSensor;
  m.body[68] = MPFsensor;

  _pus = (unsigned short *) &m.body[69];
  *_pus = expt;

  m.body[71] = m.FindCRC();
  m.body[72] = 0xAA;
  
};
Example #19
0
void GtoT_GuiderStatus(QCamera *cam){//252
  static message m;
  GuiderStatus *gs;
  

  gs = (GuiderStatus *) &m.body[0];
  (*gs).mid = 252;
  m.length = 58;
    
  (*gs).startb = 0x55;

  _cnt = GtoT_Count();
  (*gs).count = _cnt;
  (*gs).length = m.length - 7;
  // ---------------------------------------
  (*gs).guidermode = (char) cam->getModeID();
  (*gs).guidersubmode = (char) cam->getSubModeID();
  (*gs).activesensor = (char) cam->getActiveSensor();

  (*gs).frame = (unsigned int) cam->onlyGetFrame();


  (*gs).roix = cam->getRoiX();
  (*gs).roiy = cam->getRoiY();
  (*gs).roidx = cam->getRoiDX();
  (*gs).roidy = cam->getRoiDY();

  (*gs).tt = cam->getTrigT();
  (*gs).et = cam->getExpT();

  (*gs).wx = cam->getWinX();
  (*gs).wy = cam->getWinY();
  (*gs).wdx = cam->getWinDX();
  (*gs).wdy = cam->getWinDY();
  (*gs).tx = trackpointCE;
  (*gs).ty = trackpointEL;

  (*gs).lvdt = leakylvdt;

  if(getOutput()){
    (*gs).dacstatus= 0;
  } else {
    (*gs).dacstatus= 1;
  };

  if(ledstatus){
    (*gs).lightstatus = 1; 
  } else { 
    (*gs).lightstatus = 0;
  };

  (*gs).gpslat = gps_latitude;
  (*gs).gpslon = gps_longitude;
  (*gs).gpsalt = gps_altitude;

  (*gs).crc = m.FindCRC();
  (*gs).endb = 0xAA;

  SendToTMTC(m);

  return;
};