Esempio n. 1
0
void QHYCCD::TimerHit()
{
  if (isConnected() == false)
    return;

   if (InExposure)
   {
       long timeleft = calcTimeLeft();

       if (timeleft < 1.0)
       {
           if (timeleft > 0.25)
           {
               //  a quarter of a second or more
               //  just set a tighter timer
               SetTimer(250);
           }
           else
           {
               if (timeleft > 0.07)
               {
                   //  use an even tighter timer
                   SetTimer(50);
               }
               else
               {
                   /* We're done exposing */
                   DEBUG(INDI::Logger::DBG_DEBUG, "Exposure done, downloading image...");
                   // Don't spam the session log unless it is a long exposure > 5 seconds
                   if (ExposureRequest > POLLMS * 5)
                       DEBUG(INDI::Logger::DBG_SESSION, "Exposure done, downloading image...");

                   PrimaryCCD.setExposureLeft(0);
                   InExposure = false;
                   /* grab and save image */
                   grabImage();

               }
           }
       }
       else
       {
           DEBUGF(INDI::Logger::DBG_DEBUG, "Exposure in progress: Time left %ld", timeleft);
           SetTimer(POLLMS);
       }

       PrimaryCCD.setExposureLeft(timeleft);
   }
}
Esempio n. 2
0
void MICCD::TimerHit()
{
    if (!isConnected())
        return;  // No need to reset timer if we are not connected anymore

    if (InExposure || downloading)
    {
        long timeleft = calcTimeLeft();
        bool ready = false;

        if (gxccd_image_ready(cameraHandle, &ready) < 0)
        {
            char errorStr[MAX_ERROR_LEN];
            gxccd_get_last_error(cameraHandle, errorStr, sizeof(errorStr));
            DEBUGF(INDI::Logger::DBG_ERROR, "Getting image ready failed: %s.", errorStr);

        }
        if (ready)
        {
            // grab and save image
            grabImage();
        }
        // camera may need some time for image download -> update client only for positive values
        else if (timeleft >= 0)
        {
            DEBUGF(INDI::Logger::DBG_DEBUG, "Exposure in progress: Time left %ld", timeleft);
            PrimaryCCD.setExposureLeft(timeleft);
        }
        else if (!downloading)
        {
            PrimaryCCD.setExposureLeft(0);
            InExposure = false;
            downloading = true;

            // Don't spam the session log unless it is a long exposure > 5 seconds
            if (ExposureRequest > POLLMS * 5)
                DEBUG(INDI::Logger::DBG_SESSION, "Exposure done, downloading image...");
        }
    }

    SetTimer(POLLMS);
}