bool QSICCD::manageDefaults() { /* X horizontal binning */ try { QSICam.put_BinX(PrimaryCCD.getBinX()); } catch (std::runtime_error err) { DEBUGF(INDI::Logger::DBG_ERROR, "Error: put_BinX() failed. %s.", err.what()); return false; } /* Y vertical binning */ try { QSICam.put_BinY(PrimaryCCD.getBinY()); } catch (std::runtime_error err) { DEBUGF(INDI::Logger::DBG_ERROR, "Error: put_BinY() failed. %s.", err.what()); return false; } DEBUGF(INDI::Logger::DBG_DEBUG, "Setting default binning %d x %d.\n", PrimaryCCD.getBinX(), PrimaryCCD.getBinY()); UpdateCCDFrame(PrimaryCCD.getSubX(), PrimaryCCD.getSubY(), PrimaryCCD.getXRes(), PrimaryCCD.getYRes()); /* Success */ return true; }
bool ASICCD::StartStreaming() { ASI_IMG_TYPE type = getImageType(); if (type != ASI_IMG_Y8 && type != ASI_IMG_RGB24) { IUResetSwitch(&VideoFormatSP); ISwitch *vf = IUFindSwitch(&VideoFormatSP,"ASI_IMG_Y8"); if (vf == NULL) vf = IUFindSwitch(&VideoFormatSP,"ASI_IMG_RAW8"); if (vf) { vf->s = ISS_ON; DEBUGF(INDI::Logger::DBG_DEBUG, "Switching to %s video format.", vf->label); PrimaryCCD.setBPP(8); UpdateCCDFrame(PrimaryCCD.getSubX(), PrimaryCCD.getSubY(), PrimaryCCD.getSubW(), PrimaryCCD.getSubH()); IDSetSwitch(&VideoFormatSP, NULL); } else { DEBUG(INDI::Logger::DBG_ERROR, "No 8 bit video format found, cannot start stream."); return false; } } ASIStartVideoCapture(m_camInfo->CameraID); pthread_mutex_lock(&condMutex); streamPredicate = 1; pthread_mutex_unlock(&condMutex); pthread_cond_signal(&cv); return true; }
bool QSICCD::UpdateCCDBin(int binx, int biny) { try { QSICam.put_BinX(binx); } catch (std::runtime_error err) { DEBUGF(INDI::Logger::DBG_ERROR, "put_BinX() failed. %s.", err.what()); return false; } try { QSICam.put_BinY(biny); } catch (std::runtime_error err) { DEBUGF(INDI::Logger::DBG_ERROR, "put_BinY() failed. %s.", err.what()); return false; } PrimaryCCD.setBin(binx, biny); return UpdateCCDFrame(PrimaryCCD.getSubX(), PrimaryCCD.getSubY(), PrimaryCCD.getSubW(), PrimaryCCD.getSubH()); }
bool QHYCCD::UpdateCCDBin(int hor, int ver) { int ret = QHYCCD_ERROR; if (hor != ver) { DEBUG(INDI::Logger::DBG_ERROR, "Invalid binning mode. Asymmetrical binning not supported."); return false; } if (hor == 3) { DEBUG(INDI::Logger::DBG_ERROR, "Invalid binning mode. Only 1x1, 2x2, and 4x4 binning modes supported."); return false; } if (hor > 1 && GetCCDCapability() & CCD_HAS_BAYER) { DEBUG(INDI::Logger::DBG_ERROR, "Binning not supported for color CCDs."); return false; } //PrimaryCCD.setBin(hor,ver); //camxbin = hor; //camybin = ver; //return UpdateCCDFrame(PrimaryCCD.getSubX(), PrimaryCCD.getSubY(), PrimaryCCD.getSubW(), PrimaryCCD.getSubH()); if(hor == 1 && ver == 1) { ret = IsQHYCCDControlAvailable(camhandle,CAM_BIN1X1MODE); } else if(hor == 2 && ver == 2) { ret = IsQHYCCDControlAvailable(camhandle,CAM_BIN2X2MODE); } else if(hor == 3 && ver == 3) { ret = IsQHYCCDControlAvailable(camhandle,CAM_BIN3X3MODE); } else if(hor == 4 && ver == 4) { ret = IsQHYCCDControlAvailable(camhandle,CAM_BIN4X4MODE); } if(ret == QHYCCD_SUCCESS) { PrimaryCCD.setBin(hor,ver); camxbin = hor; camybin = ver; return UpdateCCDFrame(PrimaryCCD.getSubX(), PrimaryCCD.getSubY(), PrimaryCCD.getSubW(), PrimaryCCD.getSubH()); } DEBUGF(INDI::Logger::DBG_ERROR, "SetBin mode failed. Invalid bin requested %dx%d",hor,ver); return false; }
bool QHYCCD::UpdateCCDBin(int hor, int ver) { int ret = QHYCCD_ERROR; if (hor != ver) { DEBUG(INDI::Logger::DBG_ERROR, "Invalid binning mode. Asymmetrical binning not supported."); return false; } if (hor == 3) { DEBUG(INDI::Logger::DBG_ERROR, "Invalid binning mode. Only 1x1, 2x2, and 4x4 binning modes supported."); return false; } if (hor > 1 && GetCCDCapability() & CCD_HAS_BAYER) { DEBUG(INDI::Logger::DBG_ERROR, "Binning not supported for color CCDs."); return false; } if (useSoftBin) ret = QHYCCD_SUCCESS; else if (hor == 1 && ver == 1) { ret = IsQHYCCDControlAvailable(camhandle, CAM_BIN1X1MODE); } else if (hor == 2 && ver == 2) { ret = IsQHYCCDControlAvailable(camhandle, CAM_BIN2X2MODE); } else if (hor == 3 && ver == 3) { ret = IsQHYCCDControlAvailable(camhandle, CAM_BIN3X3MODE); } else if (hor == 4 && ver == 4) { ret = IsQHYCCDControlAvailable(camhandle, CAM_BIN4X4MODE); } // Binning ALWAYS succeeds if (ret != QHYCCD_SUCCESS) { useSoftBin = true; } // We always use software binning so QHY binning is always at 1x1 camxbin = 1; camybin = 1; PrimaryCCD.setBin(hor, ver); return UpdateCCDFrame(PrimaryCCD.getSubX(), PrimaryCCD.getSubY(), PrimaryCCD.getSubW(), PrimaryCCD.getSubH()); }
///////////////////////////////////////////////////////// /// Update CCD bin mode ///////////////////////////////////////////////////////// bool ATIKCCD::UpdateCCDBin(int binx, int biny) { int rc = ArtemisBin(hCam, binx, biny); if (rc != ARTEMIS_OK) return false; PrimaryCCD.setBin(binx, biny); return UpdateCCDFrame(PrimaryCCD.getSubX(), PrimaryCCD.getSubY(), PrimaryCCD.getSubW(), PrimaryCCD.getSubH()); }
bool MICCD::UpdateCCDBin(int hor, int ver) { if (hor < 1 || hor > maxBinX || ver < 1 || ver > maxBinY) { DEBUGF(INDI::Logger::DBG_ERROR, "Binning (%dx%d) are out of range. Range from 1x1 to (%dx%d)", maxBinX, maxBinY); return false; } if (gxccd_set_binning(cameraHandle, hor, ver) < 0) { char errorStr[MAX_ERROR_LEN]; gxccd_get_last_error(cameraHandle, errorStr, sizeof(errorStr)); DEBUGF(INDI::Logger::DBG_ERROR, "Setting binning failed: %s.", errorStr); return false; } PrimaryCCD.setBin(hor, ver); return UpdateCCDFrame(PrimaryCCD.getSubX(), PrimaryCCD.getSubY(), PrimaryCCD.getSubW(), PrimaryCCD.getSubH()); }
bool ASICCD::ISNewSwitch (const char *dev, const char *name, ISState *states, char *names[], int n) { ASI_ERROR_CODE errCode = ASI_SUCCESS; if(!strcmp(dev,getDeviceName())) { if (!strcmp(name, ControlSP.name)) { IUUpdateSwitch(&ControlSP, states, names, n); for (int i=0; i < ControlSP.nsp; i++) { ASI_CONTROL_TYPE swType = *((ASI_CONTROL_TYPE *) ControlS[i].aux); ASI_BOOL swAuto = (ControlS[i].s == ISS_ON) ? ASI_TRUE : ASI_FALSE; for (int j=0; j < ControlNP.nnp; j++) { ASI_CONTROL_TYPE nType = *((ASI_CONTROL_TYPE *) ControlN[j].aux0); if (swType == nType) { DEBUGF(INDI::Logger::DBG_DEBUG, "ISNewSwitch->SetControlValue %d %.2f", nType, ControlN[j].value); if ( (errCode = ASISetControlValue(m_camInfo->CameraID, nType, ControlN[j].value, swAuto )) != ASI_SUCCESS) { DEBUGF(INDI::Logger::DBG_ERROR, "ASISetControlValue (%s=%g) error (%d)", ControlN[j].name, ControlN[j].value, errCode); ControlNP.s = IPS_ALERT; ControlSP.s = IPS_ALERT; IDSetNumber(&ControlNP, NULL); IDSetSwitch(&ControlSP, NULL); return false; } *((ASI_BOOL *) ControlN[j].aux1) = swAuto; break; } } } ControlSP.s = IPS_OK; IDSetSwitch(&ControlSP, NULL); return true; } /* Cooler */ if (!strcmp (name, CoolerSP.name)) { if (IUUpdateSwitch(&CoolerSP, states, names, n) < 0) return false; bool rc=false; if (CoolerS[0].s == ISS_ON) activateCooler(true); else activateCooler(false); return true; } if (!strcmp(name, VideoFormatSP.name)) { #if !defined(OSX_EMBEDED_MODE) && !defined(__CYGWIN__) if (streamer->isBusy()) { VideoFormatSP.s = IPS_ALERT; DEBUG(INDI::Logger::DBG_ERROR, "Cannot change format while streaming/recording."); IDSetSwitch(&VideoFormatSP, NULL); return true; } #endif IUUpdateSwitch(&VideoFormatSP, states, names, n); ASI_IMG_TYPE type = getImageType(); switch (type) { case ASI_IMG_RAW16: PrimaryCCD.setBPP(16); break; default: PrimaryCCD.setBPP(8); break; } UpdateCCDFrame(PrimaryCCD.getSubX(), PrimaryCCD.getSubY(), PrimaryCCD.getSubW(), PrimaryCCD.getSubH()); updateRecorderFormat(); VideoFormatSP.s = IPS_OK; IDSetSwitch(&VideoFormatSP, NULL); return true; } } return INDI::CCD::ISNewSwitch(dev,name,states,names,n); }