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; }
int imgcam_gettec(double *tC, double *setTemp, int *power, int *enabled) { int retval = 0; double mV = 0; cammsg[0] = '\0'; switch (camid) { case 20: case 5: case 6: case 60: case 80: break; case 52: *tC = qhy5lii_GetTemp(); retval = 1; break; case 7: case 81: case 9: case 91: case 10: retval = qhy_getDC201_i(tC, &mV); break; case 11: case 12: retval = qhy_getDC201_i(tC, &mV); break; case 1000: *tC = dsi2pro_GetTemp(); retval = 1; break; #ifdef HAVE_SBIG case 2000: retval = (sbig_QueryTemperatureStatus(enabled, tC, setTemp, power) == 0); break; #endif #ifdef HAVE_URVC case 2100: retval = urvc_QueryTemperatureStatus(enabled, tC, setTemp, power); break; #endif } imgcam_get_tecp()->tecerr = ((retval == 1) ? 0 : 1); if ((retval == 0) && (strlen(cammsg) == 0)) { printf("%s\n", get_core_msg()); strcpy(cammsg, get_core_msg()); } return (retval); }
int imgcam_settec(double setValue, int setMode) { int retval = 0; cammsg[0] = '\0'; switch (camid) { case 20: case 5: case 52: case 6: case 60: case 80: break; case 7: case 81: case 9: case 91: case 10: retval = qhy_setDC201_i((int)setValue, 1); break; case 11: case 12: retval = qhy_setDC201_i((int)setValue, 1); break; #ifdef HAVE_SBIG case 2000: // Set val can be temp or pwm (0-255) depending on set mode retval = (sbig_SetTemperatureRegulation(setMode, setValue) == 0); if (setMode == 1) { // If in auto mode also set auto-freeze mode sbig_SetTemperatureRegulation(5, setValue); } break; #endif #ifdef HAVE_URVC case 2100: // Set val can be temp or pwm (0-255) depending on set mode retval = urvc_SetTemperatureRegulation(setMode, setValue); break; #endif } imgcam_get_tecp()->tecerr = (retval == 0) ? 1 : 0; if ((retval == 0) && (strlen(cammsg) == 0)) { printf("%s\n", get_core_msg()); strcpy(cammsg, qhy_core_msg()); } return (retval); }
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; }
int imgcam_connect() { int retval = 1; #if defined(HAVE_SBIG) || defined(HAVE_URVC) char *devName; #endif cammsg[0] = '\0'; if (camid > 0) { switch (camid) { case 5: // Trigger an initial exposure (we won't use this one) if ((retval = qhy_OpenCamera()) == 1) { retval = qhy5_bonjour(); } break; case 52: if ((retval = qhy_opencamera()) == 1) { retval = qhy5ii_bonjour(); } break; case 20: case 6: case 60: case 80: retval = qhy_OpenCamera(); break; case 7: case 81: case 9: case 10: case 11: case 12: if ((retval = qhy_OpenCamera()) == 1) { retval = imgcam_settec(tecp.tecpwr, -1); } break; case 91: if ((retval = qhy_OpenCamera()) == 1) { // TODO send oled //retval = imgcam_settec(tecp.tecpwr, -1); } break; case 1000: retval = dsi2pro_OpenCamera(); break; #ifdef HAVE_SBIG case 2000: //Sbig camera devName = strrchr(cammodel,' '); devName++; if ((retval = (sbig_OpenDevice(devName) == 0)) == 1) { if ((retval = (sbig_EstablishLink() == 0)) == 1) { //Set all UI related strcpy(imgcam_get_camui()->binstr, sbig_GetCameraDetails()->binList); strcpy(imgcam_get_camui()->roistr, C_("camio","Full|512x512|256x256:0")); strcpy(imgcam_get_camui()->spdstr, sbig_GetCameraDetails()->spdList); strcpy(imgcam_get_camui()->ampstr, sbig_GetCameraDetails()->ampList); strcpy(imgcam_get_camui()->modstr, sbig_GetCameraDetails()->modList); strcpy(imgcam_get_camui()->moddsc, sbig_GetCameraDetails()->modList[0] != '\0' ? C_("camio","Light/Dark mode") : ""); strcpy(imgcam_get_camui()->bppstr, "2-16Bit|:0"); sprintf(imgcam_get_camui()->byrstr, "%d", sbig_GetCameraDetails()->colorId); // Cfw strcpy(imgcam_get_camui()->whlstr, sbig_GetCameraDetails()->cfwList); // Tec imgcam_get_tecp()->istec = sbig_GetCameraDetails()->camTec * 3; // Mode see imgCamio.h imgcam_get_tecp()->tecerr = 0; // Error reading / setting tec; imgcam_get_tecp()->tecpwr = 5; // Basically 0 - tecmax 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; // Shutter imgcam_get_camui()->shutterMode = sbig_GetCameraDetails()->camShutter; // Header values imgcam_get_camui()->pszx = sbig_GetCameraDetails()->ccdpixW; imgcam_get_camui()->pszy = sbig_GetCameraDetails()->ccdpixH; // Basic expar imgcam_get_expar()->bitpix = 16; imgcam_get_expar()->bytepix = 2; imgcam_get_expar()->tsize = 0; imgcam_get_expar()->edit = 0; // Tec initial set if (imgcam_get_tecp()->istec) { retval = imgcam_settec(imgcam_get_tecp()->tecpwr, 2); } } else { sbig_CloseDevice(); } } break; #endif #ifdef HAVE_URVC case 2100: //Sbig parallel camera through urvc driver devName = strrchr(cammodel,' '); devName++; if ((retval = urvc_OpenCamera(devName)) == 1) { //Set all UI related strcpy(imgcam_get_camui()->binstr, urvc_GetCameraDetails()->binList); strcpy(imgcam_get_camui()->roistr, ""); strcpy(imgcam_get_camui()->spdstr, urvc_GetCameraDetails()->spdList); strcpy(imgcam_get_camui()->ampstr, urvc_GetCameraDetails()->ampList); strcpy(imgcam_get_camui()->modstr, urvc_GetCameraDetails()->modList); strcpy(imgcam_get_camui()->moddsc, urvc_GetCameraDetails()->modList[0] != '\0' ? C_("camio","Light/Dark mode") : ""); strcpy(imgcam_get_camui()->bppstr, "2-16Bit|:0"); sprintf(imgcam_get_camui()->byrstr, "-1"); // Cfw strcpy(imgcam_get_camui()->whlstr, urvc_GetCameraDetails()->cfwList); // Tec imgcam_get_tecp()->istec = urvc_GetCameraDetails()->camTec * 3; // Mode see imgCamio.h imgcam_get_tecp()->tecerr = 0; // Error reading / setting tec; imgcam_get_tecp()->tecpwr = 5; // Basically 0 - tecmax 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; // Shutter imgcam_get_camui()->shutterMode = urvc_GetCameraDetails()->camShutter; // Header values imgcam_get_camui()->pszx = urvc_GetCameraDetails()->ccdpixW; imgcam_get_camui()->pszy = urvc_GetCameraDetails()->ccdpixH; // Basic expar imgcam_get_expar()->bitpix = 16; imgcam_get_expar()->bytepix = 2; imgcam_get_expar()->tsize = 0; imgcam_get_expar()->edit = 0; // Tec initial set if (imgcam_get_tecp()->istec) { retval = imgcam_settec(imgcam_get_tecp()->tecpwr, 2); } } break; #endif } if ((retval == 0) && (strlen(cammsg) == 0)) { strcpy(cammsg, get_core_msg()); } connected = retval; } return (retval); }
void imgcam_init() { static int first_time = 1; qhy_core_init(); if (!first_time) { #ifdef HAVE_SBIG sbig_core_close(); #endif } #ifdef HAVE_SBIG sbig_core_init(imgBasePath); #endif #ifdef HAVE_URVC urvc_core_init(); #endif if (databuffer[0] != NULL) { free(databuffer[0]); databuffer[0] = NULL; } if (databuffer[1] != NULL) { free(databuffer[1]); databuffer[1] = NULL; } camid = 0; if (first_time) { cammodel = (char*)realloc(cammodel, 64); cammsg = (char*)realloc(cammsg, 1024); first_time = 0; } cammodel[0] = '\0'; cammsg[0] = '\0'; imgcam_init_list(0); strcpy(imgcam_get_camui()->binstr, ""); strcpy(imgcam_get_camui()->roistr, ""); strcpy(imgcam_get_camui()->spdstr, ""); strcpy(imgcam_get_camui()->modstr, ""); strcpy(imgcam_get_camui()->moddsc, ""); // This is the current label for multi-purpose modstr strcpy(imgcam_get_camui()->ampstr, ""); strcpy(imgcam_get_camui()->snrstr, ""); strcpy(imgcam_get_camui()->bppstr, ""); strcpy(imgcam_get_camui()->byrstr, "0"); strcpy(imgcam_get_camui()->tecstr, ""); strcpy(imgcam_get_camui()->whlstr, ""); imgcam_get_camui()->shutterMode = 0; imgcam_get_camui()->pszx = 0; imgcam_get_camui()->pszy = 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; imgcam_get_tecp()->tecedit = 0; loaded = 0; connected = 0; }