Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I have some questions about ASI camera drivers #261

Closed
AstroAir opened this issue Dec 14, 2020 · 0 comments
Closed

I have some questions about ASI camera drivers #261

AstroAir opened this issue Dec 14, 2020 · 0 comments

Comments

@AstroAir
Copy link

Recently, I was working on the development of ASI camera, and I had some doubts after consulting indi's code on this aspect
`

long blinks = BlinkN[BLINK_COUNT].value;
if (blinks > 0)
{
    LOGF_DEBUG("Blinking %ld time(s) before exposure", blinks);

    const long blink_duration = BlinkN[BLINK_DURATION].value * 1000000.0;
    errCode = ASISetControlValue(m_camInfo->CameraID, ASI_EXPOSURE, blink_duration, ASI_FALSE);
    if (errCode != ASI_SUCCESS)
    {
        LOGF_ERROR("Failed to set blink exposure to %ldus, error %d", blink_duration, errCode);
    }
    else
    {
        do
        {
            errCode = ASIStartExposure(m_camInfo->CameraID, ASI_TRUE);
            if (errCode != ASI_SUCCESS)
            {
                LOGF_ERROR("Failed to start blink exposure, error %d", errCode);
                break;
            }

            ASI_EXPOSURE_STATUS expStatus;
            do
            {
                usleep(100000);
                errCode = ASIGetExpStatus(m_camInfo->CameraID, &expStatus);
            }
            while (errCode == ASI_SUCCESS && expStatus == ASI_EXP_WORKING);

            if (errCode != ASI_SUCCESS || expStatus != ASI_EXP_SUCCESS)
            {
                LOGF_ERROR("Blink exposure failed, error %d, status %d", errCode, expStatus);
                break;
            }
        }
        while (--blinks > 0);
    }

    if (blinks > 0)
    {
        LOGF_WARN("%ld blink exposure(s) NOT done", blinks);
    }
}

PrimaryCCD.setExposureDuration(duration);
ExposureRequest = duration;

LOGF_DEBUG("StartExposure->setexp : %.3fs", duration);
long uSecs = duration * 1000000.0;
ASISetControlValue(m_camInfo->CameraID, ASI_EXPOSURE, uSecs, ASI_FALSE);

// Try exposure for 3 times
ASI_BOOL isDark = ASI_FALSE;
if (PrimaryCCD.getFrameType() == INDI::CCDChip::DARK_FRAME)
{
    isDark = ASI_TRUE;
}
for (int i = 0; i < 3; i++)
{
    if ((errCode = ASIStartExposure(m_camInfo->CameraID, isDark)) !=
            ASI_SUCCESS)
    {
        LOGF_ERROR("ASIStartExposure error (%d)", errCode);
        // Wait 100ms before trying again
        usleep(100000);
        continue;
    }
    break;
}

`
Why do you have to repeat the exposure three times, so it won't be a problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant