Beispiel #1
0
int qhy9_setColorWheel(int Pos)
{
	unsigned char REG[2];

	REG[0] = 0x5A;                   //  Identity code
	REG[1] = (unsigned char) Pos;    //0,1,2,3,4
   	return (qhy_cameraIO(qhy_core_getendp()->write, qhy_core_getreq()->wheel, REG,  sizeof(REG), 0, 0));
}
Beispiel #2
0
void qhy10_init()
{
	qhy_core_init();

	qhy_core_getendp()->info   = 0xC2;
	qhy_core_getendp()->read   = 0xC0;
	qhy_core_getendp()->write  = 0x40;
	qhy_core_getendp()->iread  = 0x81;
	qhy_core_getendp()->iwrite = 0x01;
	qhy_core_getendp()->bulk   = 0x82;
	qhy_core_getendp()->aux    = 0;

	qhy_core_getreq()->sendregs  = 0xB5;
	qhy_core_getreq()->startexp  = 0xB3;
	qhy_core_getreq()->setdc201  = 0XC6;
	qhy_core_getreq()->getdc201  = 0XC5;
	qhy_core_getreq()->shutter   = 0;
	qhy_core_getreq()->wheel     = 0xC1;
	
	qhy_core_getcampars()->vid        = VENDOR_ID;
	qhy_core_getcampars()->pid        = PRODUCT_ID;
	qhy_core_getcampars()->shortexp   = SHORTEXP;
	qhy_core_getcampars()->buftimes   = 0;
	qhy_core_getcampars()->buftimef   = 0;
	
	// Positively yess tec
	imgcam_get_tecp()->istec      = 1;      // 0 = Not driveable tec or no tec 1 = Driveable tec
	imgcam_get_tecp()->tecerr     = 0;      // Error reading / setting tec; 
	imgcam_get_tecp()->tecpwr     = 5;      // Basically 0 - tecmax, value here is used for initial set on camera open 
	imgcam_get_tecp()->tecmax     = 255;    // 0-255
	imgcam_get_tecp()->tecauto    = 0;      // 0 = Manual, 1 = Seek target temp
	imgcam_get_tecp()->tectemp    = 0.;     // Only meaningful when tecauto = 1; 
	imgcam_get_tecp()->settemp    = 0.;     // Only meaningful when tecauto = 1; 
	
	imgcam_get_camui()->hasgain = 1;
	imgcam_get_camui()->hasoffset = 1;
	strcpy(imgcam_get_camui()->binstr, "1x1|2x2|4x4:0");
	/// Capture size values list, just translate "Full" (frame)
	strcpy(imgcam_get_camui()->roistr, C_("camio","Full|512x512|256x256|128x128:0"));
	/// Combo box values list, keep N-<desc> format. Just translate <desc>
	strcpy(imgcam_get_camui()->spdstr, C_("camio","0-Slow|1-Fast:0"));
	strcpy(imgcam_get_camui()->ampstr, C_("camio","0-AmpOff|1-AmpOn|2-Auto:2"));
	strcpy(imgcam_get_camui()->modstr, "");
	strcpy(imgcam_get_camui()->moddsc, "");
	strcpy(imgcam_get_camui()->snrstr, "");
	strcpy(imgcam_get_camui()->bppstr, "2-16Bit|:0");
	strcpy(imgcam_get_camui()->byrstr, "1");
	strcpy(imgcam_get_camui()->tecstr, "0:255:1:2");
	strcpy(imgcam_get_camui()->whlstr, "");
	// Header values
	imgcam_get_camui()->pszx = 6.05;
	imgcam_get_camui()->pszy = 6.05;
	
	imgcam_get_expar()->bitpix  = 16;	
	imgcam_get_expar()->bytepix = 2;	
	imgcam_get_expar()->tsize   = 0;
	imgcam_get_expar()->edit    = 0;	
}
Beispiel #3
0
void qhy5ii_init()
{
	qhy_core_init();

	qhy_core_getendp()->info   = 0xC2;
	qhy_core_getendp()->read   = 0xC0;
	qhy_core_getendp()->write  = 0x40;
	qhy_core_getendp()->iread  = 0x81;
	qhy_core_getendp()->iwrite = 0x01;
	qhy_core_getendp()->bulk   = 0x82;
	qhy_core_getendp()->aux    = 0;

	qhy_core_getreq()->sendregs  = 0xB5;
	qhy_core_getreq()->startexp  = 0xB3;
	qhy_core_getreq()->setdc201  = 0;
	qhy_core_getreq()->getdc201  = 0;
	qhy_core_getreq()->shutter   = 0;
	qhy_core_getreq()->wheel     = 0;
	
	qhy_core_getcampars()->vid        = VENDOR_ID;
	qhy_core_getcampars()->pid        = PRODUCT_ID;
	qhy_core_getcampars()->shortexp   = SHORTEXP;
	qhy_core_getcampars()->buftimes   = 0;
	qhy_core_getcampars()->buftimef   = 0;
	
	// Positively no tec
	imgcam_get_tecp()->istec      = 0;      // 0 = Not driveable tec or no tec 1 = Driveable tec
	imgcam_get_tecp()->tecerr     = 0;      // Error reading / setting tec; 
	imgcam_get_tecp()->tecpwr     = 0;      // Basically 0 - tecmax
	imgcam_get_tecp()->tecmax     = 0;      // 0-255
	imgcam_get_tecp()->tecauto    = 0;      // 0 = Manual, 1 = Seek target temp
	imgcam_get_tecp()->tectemp    = 0.;     // Only meaningful when tecauto = 1; 
	imgcam_get_tecp()->settemp    = 0.;     // Only meaningful when tecauto = 1; 
	
	strcpy(imgcam_get_camui()->binstr, "");
	strcpy(imgcam_get_camui()->roistr, "");
	/// Combo box values list, keep N-<desc> format. Just translate <desc>
	strcpy(imgcam_get_camui()->spdstr, C_("camio","0-Slow|1-Fast:0"));
	strcpy(imgcam_get_camui()->ampstr, "");
	strcpy(imgcam_get_camui()->modstr, "0:255:5:50");
	/// Descriptiopn for "mode" combo box
	strcpy(imgcam_get_camui()->moddsc, C_("camio","Usb bus speed"));
	strcpy(imgcam_get_camui()->snrstr, "");
	strcpy(imgcam_get_camui()->bppstr, "");
	strcpy(imgcam_get_camui()->byrstr, "-1");
	strcpy(imgcam_get_camui()->tecstr, "");
	strcpy(imgcam_get_camui()->whlstr, "");
	
	imgcam_get_expar()->bitpix  = 8;	
	imgcam_get_expar()->bytepix = 1;	
	imgcam_get_expar()->tsize   = 0;
	imgcam_get_expar()->edit    = 0;	
}
Beispiel #4
0
int  qhy7_setregisters(qhy_exposure *expar) 
{
	int retval = 1;	
	int time, Vbin, Hbin, ShortExp, antiamp, PatchNumber;
	int top_skip = 0, bot_skip = 0;
	int top_skip_pix = 0, top_skip_null = 10;
	unsigned char time_H,time_M,time_L;

	expar->wtime = expar->time;
	bin = expar->bin;
	if(expar->time < SHORTEXP) 
	{  
		ShortExp = 1;
		time = expar->time;
	}
	else                   
	{
		ShortExp = 0; 
		time = expar->time - SHORTEXP;
	}
	//account for general 1% error on exp time for all QHY camera tested so far
	time = (int) (time - (time / 100));
	
	antiamp = 0;
	switch ( expar->amp ) 
	{
		case 0: 
			antiamp = 1;
			break;
		case 1: 
			antiamp = 0;
			break;
		case 2: if (time > 550) 
			antiamp = 1;
			break;
		default:
			printf( "Error: Registers NOT set (amp)!\n");
			return 2;
	}
	// It looks like libusb1.0 is very picky about "transfer_size" value.
	// Please have a look at the complete comment near the bulk_read
	// Please notice width@bin3 && bin4
	
	//printf("ix: %d, iy %d\n", img_w, img_h);
	switch ( bin ) 
	{
		case 1: 
			i_width = 2112; height = 2072; width = i_width; Vbin = bin; Hbin = bin; //P_Size = 2849 * 1024;
			break;
		case 2: 
			i_width = 1056; height = 1036; width = i_width; Vbin = bin; Hbin = bin; 
			break;
		case 3: 
			i_width = 2112; height =  691; Vbin = bin; Hbin = 1; width = i_width / 3;
			break;
		case 4: 
			i_width = 1056; height =  518; Vbin = bin; Hbin = 2; width = i_width / 2; 
			break;
		default:
			printf( "Error: Registers NOT set (bin)!\n");
			return 2;
	}
	// Check for ROI (if valid)
	if (expar->width > 0 && expar->width < (i_width / (bin/Hbin)))
	{
		width = expar->width; 
	}
	else
	{
		expar->width = width;
	}
	if (expar->height > 0 && expar->height < height)
	{
		top_skip_null = 25;
		top_skip = (height - expar->height);
		if (bin == 1)
		{
			top_skip = (int)(top_skip / 2);
		}
		bot_skip = height - top_skip - expar->height;
		height = expar->height;
	}
	else
	{
		expar->height = height;
	}
	//printf("x: %d, y %d, tops %d, bots %d fx %d\n", i_width, height, top_skip, bot_skip, width);

	totalsize = i_width * 2 * height;
	expar->totsize = totalsize;
	
	// Looks like the actual transfer size is a multiple of 1024 or 512 (Camera dependent. QHY7=1024, QHY9=512)
	// Either is the nearest (round) or is the floor value (Again camera dependent QHY6=512 round)
	transfer_size = 1024 * (int)(totalsize / 1024);
	expar->tsize = transfer_size;
	
	PatchNumber = qhy_getPatch(totalsize, 1024, 0);

	time_L=fmod(time,256);
	time_M=(time-time_L)/256;
	time_H=(time-time_L-time_M*256)/65536;


	REG[0]=(int)((expar->gain * 63) / 100);  	//Camera gain   range 0-63  
	
	REG[1]=expar->offset;			//Offset : range 0-255 default is 120
	
	REG[2]=time_H;  				//unit is ms       24bit
	REG[3]=time_M;
	REG[4]=time_L;
	
	REG[5]=Hbin;					// Horizonal BINNING    0 = 1= No bin
	REG[6]=Vbin;					// Vertical Binning     0 = 1= No bin
	
	REG[7]=qhy_MSB(i_width);			// The readout X  Unit is pixel 16Bit
	REG[8]=qhy_LSB(i_width);
	
	REG[9]= qhy_MSB(height);			// The readout Y  unit is line 16Bit
	REG[10]=qhy_LSB(height);
	
	REG[11]=qhy_MSB(top_skip);		// use for subframe    Skip lines on top 16Bit
	REG[12]=qhy_LSB(top_skip);
	
	REG[13]=qhy_MSB(bot_skip);		// use for subframe    Skip lines on Buttom 16Bit
	REG[14]=qhy_LSB(bot_skip);		// VerticalSize + SKIP_TOP +  SKIP_BOTTOM  should be the actual CCD Y size 
	
	REG[15]=0;					// LiveVideo no use for QHY7-8-9   16Bit set to 0
	REG[16]=0;

	REG[17]=qhy_MSB(PatchNumber);		// PatchNumber 16Bit
	REG[18]=qhy_LSB(PatchNumber);
	
	REG[19]=0;					// AnitInterlace no use for QHY8-9-11  16Bit set to 0
	REG[20]=0;
	
	REG[22]=0;					// MultiFieldBIN no use for QHY9  set to 0
	
	REG[29]=0x0000;				// ClockADJ no use for QHY9-11  16Bit set to 0
	REG[30]=0;
	
	REG[32]=antiamp;				// 1: anti-amp light mode 
	
	REG[33]=expar->speed;			// 0: low speed     1: high speed
	
	REG[35]=0; 					// TgateMode if set to 1 , the camera will exposure forever, till the ForceStop command coming
	REG[36]=ShortExp;				// ShortExposure no use for QHY9 set to 0
	REG[37]=0;					// VSUB no use for QHY8-9-11   set to 0
	REG[38]=0;					// Unknown reg.CLAMP
	
	REG[42]=0;					// TransferBIT no use for QHY8-9-11 set to 0
	
	REG[46]=top_skip_null;			// TopSkipNull unit is line.
	
	REG[47]=qhy_MSB(top_skip_pix);	// TopSkipPix no use for QHY9-11 16Bit set to 0 
	REG[48]=qhy_LSB(top_skip_pix);
	
	REG[51]=0;					// QHY9 0: programme control mechanical shutter automaticly   1: programme will not control shutter. 
	REG[52]=0;					// DownloadCloseTEC no use for QHY9   set to 0
	
	REG[53]=0;					// Unknown: (reg.WindowHeater&~0xf0)*16+(reg.MotorHeating&~0xf0)
	
	
	REG[58]=100;					// SDRAM_MAXSIZE no use for QHY8-9-11   set to 0
	REG[63]=0;					// Unknown reg.Trig
		  
	if (memcmp(REG, REGBCK, sizeof(REG)) || expar->edit)
	{
		// If different from the last sent values
		if ((retval = qhy_cameraIO(qhy_core_getendp()->write, qhy_core_getreq()->sendregs, REG, sizeof(REG), 0, 0)) == 1)
		{
			expar->edit = 0;
		}
		// Store last sent values
		memcpy(REGBCK , REG, sizeof(REG) );
	}
	return retval;
}