Exemple #1
0
bool MICCD::StartExposure(float duration)
{
    imageFrameType = PrimaryCCD.getFrameType();
    useShutter = (imageFrameType == INDI::CCDChip::LIGHT_FRAME || imageFrameType == INDI::CCDChip::FLAT_FRAME);

    if (!isSimulation())
    {
        // read modes in G2/G3/G4 cameras are in inverse order, we have to calculate correct value
        int mode, prm;
        gxccd_get_integer_parameter(cameraHandle, GIP_PREVIEW_READ_MODE, &prm);
        if (prm == 0) // preview mode == 0 means smaller G0/G1 cameras
            mode = IUFindOnSwitchIndex(&ReadModeSP);
        else
            mode = prm - IUFindOnSwitchIndex(&ReadModeSP);
        gxccd_set_read_mode(cameraHandle, mode);

        // send binned coords
        int x = PrimaryCCD.getSubX() / PrimaryCCD.getBinX();
        int y = PrimaryCCD.getSubY() / PrimaryCCD.getBinY();
        int w = PrimaryCCD.getSubW() / PrimaryCCD.getBinX();
        int d = PrimaryCCD.getSubH() / PrimaryCCD.getBinY();
        gxccd_start_exposure(cameraHandle, duration, useShutter, x, y, w, d);
    }

    ExposureRequest = duration;
    PrimaryCCD.setExposureDuration(duration);

    gettimeofday(&ExpStart, nullptr);
    InExposure  = true;
    downloading = false;
    LOGF_DEBUG("Taking a %.3f seconds frame...", ExposureRequest);
    return true;
}
Exemple #2
0
MICCD::MICCD(int camId, bool eth) : FilterInterface(this)
{
    cameraId = camId;
    isEth    = eth;

    if (isEth)
        cameraHandle = gxccd_initialize_eth(cameraId);
    else
        cameraHandle = gxccd_initialize_usb(cameraId);
    if (!cameraHandle)
        IDLog("Error connecting MI camera!\n");

    char sp[MAXINDINAME];
    if (gxccd_get_string_parameter(cameraHandle, GSP_CAMERA_DESCRIPTION, sp, sizeof(sp)) < 0)
    {
        gxccd_get_last_error(cameraHandle, sp, sizeof(sp));
        IDLog("Error getting MI camera info: %s.\n", sp);
        strncpy(name, "MI CCD", MAXINDIDEVICE);
    }
    else
    {
        // trim trailing spaces
        char *end = sp + strlen(sp) - 1;
        while (end > sp && isspace(*end))
            end--;
        *(end + 1) = '\0';

        snprintf(name, MAXINDINAME, "MI CCD %s", sp);
        IDLog("Detected camera: %s.\n", name);
    }

    gxccd_get_integer_parameter(cameraHandle, GIP_READ_MODES, &numReadModes);
    gxccd_get_integer_parameter(cameraHandle, GIP_FILTERS, &numFilters);
    gxccd_get_integer_parameter(cameraHandle, GIP_MAX_FAN, &maxFanValue);
    gxccd_get_integer_parameter(cameraHandle, GIP_MAX_WINDOW_HEATING, &maxHeatingValue);

    gxccd_release(cameraHandle);
    cameraHandle = nullptr;

    hasGain    = false;
    useShutter = true;

    canDoPreflash = false;

    setDeviceName(name);
    setVersion(INDI_MI_VERSION_MAJOR, INDI_MI_VERSION_MINOR);
}
Exemple #3
0
bool MICCD::setupParams()
{
    bool sim = isSimulation();
    if (sim)
    {
        SetCCDParams(4032, 2688, 16, 9, 9);
    }
    else
    {
        int chipW, chipD, pixelW, pixelD;
        gxccd_get_integer_parameter(cameraHandle, GIP_CHIP_W, &chipW);
        gxccd_get_integer_parameter(cameraHandle, GIP_CHIP_D, &chipD);
        gxccd_get_integer_parameter(cameraHandle, GIP_PIXEL_W, &pixelW);
        gxccd_get_integer_parameter(cameraHandle, GIP_PIXEL_D, &pixelD);

        SetCCDParams(chipW, chipD, 16, pixelW / 1000.0, pixelD / 1000.0);
    }

    int nbuf = PrimaryCCD.getXRes() * PrimaryCCD.getYRes() * PrimaryCCD.getBPP() / 8;
    nbuf += 512;
    PrimaryCCD.setFrameBufferSize(nbuf);

    int expTime = 0;
    gxccd_get_integer_parameter(cameraHandle, GIP_MINIMAL_EXPOSURE, &expTime);
    minExpTime = expTime / 1000000.0; // convert to seconds
    PrimaryCCD.setMinMaxStep("CCD_EXPOSURE", "CCD_EXPOSURE_VALUE", minExpTime, 3600, 1, false);

    gxccd_get_integer_parameter(cameraHandle, GIP_MAX_BINNING_X, &maxBinX);
    gxccd_get_integer_parameter(cameraHandle, GIP_MAX_BINNING_Y, &maxBinY);

    if (!sim && hasGain)
    {
        float gain = 0;
        if (gxccd_get_value(cameraHandle, GV_ADC_GAIN, &gain) < 0)
        {
            char errorStr[MAX_ERROR_LEN];
            gxccd_get_last_error(cameraHandle, errorStr, sizeof(errorStr));
            DEBUGF(INDI::Logger::DBG_ERROR, "Getting gain failed: %s.", errorStr);
            GainN[0].value = 0;
            GainNP.s = IPS_ALERT;
            IDSetNumber(&GainNP, NULL);
            return false;
        }
        else
        {
            GainN[0].value = gain;
            GainNP.s = IPS_OK;
            IDSetNumber(&GainNP, NULL);
        }
    }

    return true;
}
Exemple #4
0
bool MICCD::StartExposure(float duration)
{
    int ret = 0;
    useShutter = true;

    if (duration < minExpTime)
    {
        DEBUGF(INDI::Logger::DBG_WARNING, "Exposure shorter than minimum duration %g s requested. Setting exposure time to %g s.", duration, minExpTime);
        duration = minExpTime;
    }

    imageFrameType = PrimaryCCD.getFrameType();

    if (imageFrameType == CCDChip::BIAS_FRAME)
    {
        duration = minExpTime;
    }
    else if (imageFrameType == CCDChip::DARK_FRAME)
    {
        useShutter = false;
    }

    if (!isSimulation())
    {
        // read modes in G2/G3/G4 cameras are in inverse order, we have to calculate correct value
        int mode, prm;
        gxccd_get_integer_parameter(cameraHandle, GIP_PREVIEW_READ_MODE, &prm);
        if (prm == 0) // preview mode == 0 means smaller G0/G1 cameras
            mode = IUFindOnSwitchIndex(&NoiseSP);
        else
            mode = prm - IUFindOnSwitchIndex(&NoiseSP);
        gxccd_set_read_mode(cameraHandle, mode);

        gxccd_start_exposure(cameraHandle, duration, useShutter, PrimaryCCD.getSubX(), PrimaryCCD.getSubY(), PrimaryCCD.getSubW(), PrimaryCCD.getSubH());
    }

    ExposureRequest = duration;
    PrimaryCCD.setExposureDuration(duration);

    gettimeofday(&ExpStart, NULL);
    InExposure = true;
    downloading = false;
    DEBUGF(INDI::Logger::DBG_DEBUG, "Taking a %g seconds frame...", ExposureRequest);
    return true;
}