Пример #1
0
void MICCD::updateTemperature()
{
    float ccdtemp  = 0;
    float ccdpower = 0;
    int err        = 0;

    if (isSimulation())
    {
        ccdtemp = TemperatureN[0].value;
        if (TemperatureN[0].value < TemperatureRequest)
            ccdtemp += TEMP_THRESHOLD;
        else if (TemperatureN[0].value > TemperatureRequest)
            ccdtemp -= TEMP_THRESHOLD;

        ccdpower = 30;
    }
    else
    {
        if (gxccd_get_value(cameraHandle, GV_CHIP_TEMPERATURE, &ccdtemp) < 0)
        {
            char errorStr[MAX_ERROR_LEN];
            gxccd_get_last_error(cameraHandle, errorStr, sizeof(errorStr));
            LOGF_ERROR("Getting temperature failed: %s.", errorStr);
            err |= 1;
        }
        if (gxccd_get_value(cameraHandle, GV_POWER_UTILIZATION, &ccdpower) < 0)
        {
            char errorStr[MAX_ERROR_LEN];
            gxccd_get_last_error(cameraHandle, errorStr, sizeof(errorStr));
            LOGF_ERROR("Getting voltage failed: %s.", errorStr);
            err |= 2;
        }
    }

    TemperatureN[0].value = ccdtemp;
    CoolerN[0].value      = ccdpower * 100.0;

    if (TemperatureNP.s == IPS_BUSY && fabs(TemperatureN[0].value - TemperatureRequest) <= TEMP_THRESHOLD)
    {
        // end of temperature ramp
        TemperatureN[0].value = TemperatureRequest;
        TemperatureNP.s       = IPS_OK;
    }

    if (err)
    {
        if (err & 1)
            TemperatureNP.s = IPS_ALERT;
        if (err & 2)
            CoolerNP.s = IPS_ALERT;
    }
    else
    {
        CoolerNP.s = IPS_OK;
    }

    IDSetNumber(&TemperatureNP, nullptr);
    IDSetNumber(&CoolerNP, nullptr);
    temperatureID = IEAddTimer(POLLMS, MICCD::updateTemperatureHelper, this);
}
Пример #2
0
IPState FlipFlat::UnParkCap()
{
    if (isSimulation())
    {
        simulationWorkCounter = 3;
        return IPS_BUSY;
    }

    char response[FLAT_RES];
    if (!sendCommand(">O000", response))
        return IPS_ALERT;

    char expectedResponse[FLAT_RES];
    snprintf(expectedResponse, FLAT_RES, "*O%02d000", productID);

    if (strcmp(response, expectedResponse) == 0)
    {
        // Set cover status to random value outside of range to force it to refresh
        prevCoverStatus = 10;

        IERmTimer(unparkTimeoutID);
        unparkTimeoutID = IEAddTimer(30000, unparkTimeoutHelper, this);

        return IPS_BUSY;
    }
    else
        return IPS_ALERT;
}
Пример #3
0
bool AAGCloudWatcher::Connect() {
  if (cwc == NULL) {
    ITextVectorProperty *tvp = getText("serial");

    if (!tvp) {
      return false;
    }

  //  IDLog("%s\n", tvp->tp[0].text);

    cwc = new CloudWatcherController(tvp->tp[0].text, false);

    int check = cwc->checkCloudWatcher();

    if (check) {
      IDMessage(getDefaultName(), "Connected to AAG Cloud Watcher\n");

      sendConstants();

      IEAddTimer(1., ISPoll, this);  // Create a timer to send parameters
    } else {
      IDMessage(getDefaultName(), "Could not connect to AAG Cloud Watcher. Check port and / or cable.\n");

      delete cwc;

      cwc = NULL;

      return false;
    }
  }

  return true;
}
Пример #4
0
bool LX200Autostar::ISNewSwitch(const char *dev, const char *name, ISState *states, char *names[], int n)
{
    int index = 0;

    if (dev != nullptr && strcmp(dev, getDeviceName()) == 0)
    {
        // Focus Motion
        if (!strcmp(name, FocusMotionSP.name))
        {
            // If speed is "halt"
            if (FocusSpeedN[0].value == 0)
            {
                FocusMotionSP.s = IPS_IDLE;
                IDSetSwitch(&FocusMotionSP, nullptr);
                return false;
            }

            int last_motion = IUFindOnSwitchIndex(&FocusMotionSP);

            if (IUUpdateSwitch(&FocusMotionSP, states, names, n) < 0)
                return false;

            index = IUFindOnSwitchIndex(&FocusMotionSP);

            // If same direction and we're busy, stop
            if (last_motion == index && FocusMotionSP.s == IPS_BUSY)
            {
                IUResetSwitch(&FocusMotionSP);
                FocusMotionSP.s = IPS_IDLE;
                setFocuserSpeedMode(PortFD, 0);
                IDSetSwitch(&FocusMotionSP, nullptr);
                return true;
            }

            if (!isSimulation() && setFocuserMotion(PortFD, index) < 0)
            {
                FocusMotionSP.s = IPS_ALERT;
                IDSetSwitch(&FocusMotionSP, "Error setting focuser speed.");
                return false;
            }

            FocusMotionSP.s = IPS_BUSY;

            // with a timer
            if (FocusTimerNP.np[0].value > 0)
            {
                FocusTimerNP.s = IPS_BUSY;
                if (isDebug())
                    IDLog("Starting Focus Timer BUSY\n");

                IEAddTimer(50, LX200Generic::updateFocusHelper, this);
            }

            IDSetSwitch(&FocusMotionSP, nullptr);
            return true;
        }
    }

    return LX200Generic::ISNewSwitch(dev, name, states, names, n);
}
Пример #5
0
IPState INovaCCD::GuideSouth(uint32_t ms)
{
    DIR |= 0x06;
    DIR &= 0x0B;
    iNovaSDK_SendST4(DIR);
    timerNS = IEAddTimer(ms, timerNorthSouth, (void *)this);
    return IPS_IDLE;
}
Пример #6
0
IPState INovaCCD::GuideWest(uint32_t ms)
{
    DIR |= 0x09;
    DIR &= 0x07;
    iNovaSDK_SendST4(DIR);
    timerWE = IEAddTimer(ms, timerWestEast, (void *)this);
    return IPS_IDLE;
}
Пример #7
0
IPState SynscanDriver::GuideSouth(uint32_t ms)
{
    if (m_GuideNSTID)
    {
        IERmTimer(m_GuideNSTID);
        m_GuideNSTID = 0;
    }

    m_CustomGuideDE = TRACKRATE_SIDEREAL + GuideRateN[AXIS_DE].value * TRACKRATE_SIDEREAL;
    MoveNS(DIRECTION_SOUTH, MOTION_START);
    m_GuideNSTID = IEAddTimer(ms, guideTimeoutHelperNS, this);
    return IPS_BUSY;
}
Пример #8
0
IPState SynscanDriver::GuideWest(uint32_t ms)
{
    if (m_GuideWETID)
    {
        IERmTimer(m_GuideWETID);
        m_GuideWETID = 0;
    }

    // Sky already going westward (or earth rotating eastward, pick your favorite)
    // So we go SID_RATE + whatever guide rate was set to.
    m_CustomGuideRA = TRACKRATE_SIDEREAL + GuideRateN[AXIS_RA].value * TRACKRATE_SIDEREAL;
    MoveWE(DIRECTION_WEST, MOTION_START);
    m_GuideWETID = IEAddTimer(ms, guideTimeoutHelperWE, this);
    return IPS_BUSY;
}
Пример #9
0
/////////////////////////////////////////////////////////
/// Start West/East guide pulses
/////////////////////////////////////////////////////////
IPState ATIKCCD::guidePulseWE(uint32_t ms, AtikGuideDirection dir, const char *dirName)
{
    WEDir = dir;
    WEDirName = dirName;

    LOGF_DEBUG("Starting %s guide for %f ms", WEDirName, ms);

    int rc = ArtemisPulseGuide(hCam, dir, ms);
    if (rc != ARTEMIS_OK)
    {
        return IPS_ALERT;
    }

    WEtimerID = IEAddTimer(ms, ATIKCCD::TimerHelperWE, this);
    return IPS_BUSY;
}
Пример #10
0
void
GPhotoCCD::ShowExtendedOptions(void)
{
	gphoto_widget_list *iter;

	iter = gphoto_find_all_widgets(gphotodrv);
    while(iter)
    {
		gphoto_widget *widget = gphoto_get_widget_info(gphotodrv, &iter);
		AddWidget(widget);
	}

    gphoto_show_options(gphotodrv);

    optTID = IEAddTimer (1000, GPhotoCCD::UpdateExtendedOptions, this);
}
Пример #11
0
void ISPoll(void *p) {
  AAGCloudWatcher *cw = (AAGCloudWatcher *)p;

  if (cw->isConnected()) {
    cw->sendData();

    cw->heatingAlgorithm();

    int secs = cw->getRefreshPeriod() - cw->getLastReadPeriod();

    if (secs < 1) {
      secs = 1;
    }

    IEAddTimer(secs * 1000, ISPoll, p);  // Create a timer to send parameters
  }
}
Пример #12
0
void GPhotoCCD::UpdateExtendedOptions (bool force)
{
	map<string, cam_opt *>::iterator it;
    if(! expTID)
    {
		for ( it = CamOptions.begin() ; it != CamOptions.end(); it++ )
		{
			cam_opt *opt = (*it).second;
            if(force || gphoto_widget_changed(opt->widget))
            {
				gphoto_read_widget(opt->widget);
				UpdateWidget(opt);
			}
		}
	}

    optTID = IEAddTimer (1000, GPhotoCCD::UpdateExtendedOptions, this);
}
Пример #13
0
IPState SynscanDriver::GuideEast(uint32_t ms)
{
    if (m_GuideWETID)
    {
        IERmTimer(m_GuideWETID);
        m_GuideWETID = 0;
    }

    // So if we SID_RATE + 0.5 * SID_RATE for example, that's 150% of sidereal rate
    // but for east we'd be going a lot faster since the stars are moving toward the west
    // in sideral rate. Just standing still we would SID_RATE moving across. So for east
    // we just go GuideRate * SID_RATE without adding any more values.
    //m_CustomGuideRA = TRACKRATE_SIDEREAL + GuideRateN[AXIS_RA].value * TRACKRATE_SIDEREAL;
    m_CustomGuideRA = GuideRateN[AXIS_RA].value * TRACKRATE_SIDEREAL;

    MoveWE(DIRECTION_EAST, MOTION_START);
    m_GuideWETID = IEAddTimer(ms, guideTimeoutHelperWE, this);
    return IPS_BUSY;
}
Пример #14
0
bool QHYCCD::updateProperties()
{
  INDI::CCD::updateProperties();
  double min,max,step;

  if (isConnected())
  {

      if (HasCooler())
      {
          defineSwitch(&CoolerSP);
          defineNumber(&CoolerNP);

          temperatureID = IEAddTimer(POLLMS, QHYCCD::updateTemperatureHelper, this);
      }

      if(HasUSBSpeed)
      {
          if (sim)
          {
              SpeedN[0].min = 1;
              SpeedN[0].max = 5;
              SpeedN[0].step = 1;
              SpeedN[0].value = 1;
          }
          else
          {
              int ret = GetQHYCCDParamMinMaxStep(camhandle,CONTROL_SPEED,&min,&max,&step);
              if(ret == QHYCCD_SUCCESS)
              {
                  SpeedN[0].min = min;
                  SpeedN[0].max = max;
                  SpeedN[0].step = step;
              }

              SpeedN[0].value = GetQHYCCDParam(camhandle,CONTROL_SPEED);

              DEBUGF(INDI::Logger::DBG_DEBUG, "USB Speed. Value: %g Min: %g Max: %g Step %g", SpeedN[0].value, SpeedN[0].min, SpeedN[0].max, SpeedN[0].step);
          }

          defineNumber(&SpeedNP);
      }

      if(HasGain)
      {
          if (sim)
          {
              GainN[0].min = 0;
              GainN[0].max = 100;
              GainN[0].step = 10;
              GainN[0].value = 50;
          }
          else
          {
              int ret = GetQHYCCDParamMinMaxStep(camhandle,CONTROL_GAIN,&min,&max,&step);
              if(ret == QHYCCD_SUCCESS)
              {
                  GainN[0].min = min;
                  GainN[0].max = max;
                  GainN[0].step = step;
              }
              GainN[0].value = GetQHYCCDParam(camhandle,CONTROL_GAIN);

              DEBUGF(INDI::Logger::DBG_DEBUG, "Gain. Value: %g Min: %g Max: %g Step %g", GainN[0].value, GainN[0].min, GainN[0].max, GainN[0].step);
          }

          defineNumber(&GainNP);
      }

      if(HasOffset)
      {
          if (sim)
          {
              OffsetN[0].min = 1;
              OffsetN[0].max = 10;
              OffsetN[0].step = 1;
              OffsetN[0].value = 1;
          }
          else
          {
              int ret = GetQHYCCDParamMinMaxStep(camhandle,CONTROL_OFFSET,&min,&max,&step);
              if(ret == QHYCCD_SUCCESS)
              {
                  OffsetN[0].min = min;
                  OffsetN[0].max = max;
                  OffsetN[0].step = step;
              }
              OffsetN[0].value = GetQHYCCDParam(camhandle,CONTROL_OFFSET);

              DEBUGF(INDI::Logger::DBG_DEBUG, "Offset. Value: %g Min: %g Max: %g Step %g", OffsetN[0].value, OffsetN[0].min, OffsetN[0].max, OffsetN[0].step);
          }

          //Define the Offset
          defineNumber(&OffsetNP);
      }

      if(HasFilters)
      {
          //Define the Filter Slot and name properties
          defineNumber(&FilterSlotNP);

          GetFilterNames(FILTER_TAB);
          defineText(FilterNameTP);
      }

      if (HasUSBTraffic)
      {
          if (sim)
          {
              USBTrafficN[0].min = 1;
              USBTrafficN[0].max = 100;
              USBTrafficN[0].step = 5;
              USBTrafficN[0].value = 20;
          }
          else
          {
              int ret = GetQHYCCDParamMinMaxStep(camhandle,CONTROL_USBTRAFFIC,&min,&max,&step);
              if(ret == QHYCCD_SUCCESS)
              {
                  USBTrafficN[0].min = min;
                  USBTrafficN[0].max = max;
                  USBTrafficN[0].step = step;
              }
              USBTrafficN[0].value = GetQHYCCDParam(camhandle,CONTROL_USBTRAFFIC);

              DEBUGF(INDI::Logger::DBG_DEBUG, "USB Traffic. Value: %g Min: %g Max: %g Step %g", USBTrafficN[0].value, USBTrafficN[0].min, USBTrafficN[0].max, USBTrafficN[0].step);
          }
        defineNumber(&USBTrafficNP);
      }

    // Let's get parameters now from CCD
    setupParams();

    //timerID = SetTimer(POLLMS);
  } else
  {

      if (HasCooler())
      {
          deleteProperty(CoolerSP.name);
          deleteProperty(CoolerNP.name);
      }

      if(HasUSBSpeed)
      {
          deleteProperty(SpeedNP.name);
      }

      if(HasGain)
      {
          deleteProperty(GainNP.name);
      }

      if(HasOffset)
      {
          deleteProperty(OffsetNP.name);
      }

      if(HasFilters)
      {
          deleteProperty(FilterSlotNP.name);
          deleteProperty(FilterNameTP->name);
      }

      if (HasUSBTraffic)
        deleteProperty(USBTrafficNP.name);

    RemoveTimer(timerID);
  }

  return true;
}
Пример #15
0
void QHYCCD::updateTemperature()
{
    double ccdtemp = 0, coolpower = 0;
    double nextPoll = POLLMS;

    if (sim)
    {
        ccdtemp = TemperatureN[0].value;
        if (TemperatureN[0].value < TemperatureRequest)
            ccdtemp += TEMP_THRESHOLD;
        else if (TemperatureN[0].value > TemperatureRequest)
            ccdtemp -= TEMP_THRESHOLD;

        coolpower = 128;
    }
    else
    {
        ccdtemp   = GetQHYCCDParam(camhandle, CONTROL_CURTEMP);
        coolpower = GetQHYCCDParam(camhandle, CONTROL_CURPWM);
        ControlQHYCCDTemp(camhandle, TemperatureRequest);
    }

    DEBUGF(INDI::Logger::DBG_DEBUG, "CCD Temp: %g CCD RAW Cooling Power: %g, CCD Cooling percentage: %g", ccdtemp,
           coolpower, coolpower / 255.0 * 100);

    TemperatureN[0].value = ccdtemp;
    CoolerN[0].value      = coolpower / 255.0 * 100;

    if (coolpower > 0 && CoolerS[0].s == ISS_OFF)
    {
        CoolerNP.s   = IPS_BUSY;
        CoolerSP.s   = IPS_OK;
        CoolerS[0].s = ISS_ON;
        CoolerS[1].s = ISS_OFF;
        IDSetSwitch(&CoolerSP, NULL);
    }
    else if (coolpower <= 0 && CoolerS[0].s == ISS_ON)
    {
        CoolerNP.s   = IPS_IDLE;
        CoolerSP.s   = IPS_IDLE;
        CoolerS[0].s = ISS_OFF;
        CoolerS[1].s = ISS_ON;
        IDSetSwitch(&CoolerSP, NULL);
    }

    if (TemperatureNP.s == IPS_BUSY && fabs(TemperatureN[0].value - TemperatureRequest) <= TEMP_THRESHOLD)
    {
        TemperatureN[0].value = TemperatureRequest;
        TemperatureNP.s       = IPS_OK;
    }

    /*
    //we need call ControlQHYCCDTemp every second to control temperature
    if (TemperatureNP.s == IPS_BUSY)
        nextPoll = TEMPERATURE_BUSY_MS;
*/

    IDSetNumber(&TemperatureNP, NULL);
    IDSetNumber(&CoolerNP, NULL);

    temperatureID = IEAddTimer(nextPoll, QHYCCD::updateTemperatureHelper, this);
}
Пример #16
0
bool MICCD::updateProperties()
{
    INDI::CCD::updateProperties();

    if (isConnected())
    {
        if (HasCooler())
        {
            defineNumber(&TemperatureRampNP);
            defineNumber(&CoolerNP);
            temperatureID = IEAddTimer(POLLMS, MICCD::updateTemperatureHelper, this);
        }

        defineSwitch(&ReadModeSP);

        if (maxFanValue > 0)
            defineNumber(&FanNP);

        if (maxHeatingValue > 0)
            defineNumber(&WindowHeatingNP);

        if (hasGain)
            defineNumber(&GainNP);

        if (canDoPreflash)
            defineNumber(&PreflashNP);

        if (numFilters > 0)
        {
            INDI::FilterInterface::updateProperties();
        }

        // Let's get parameters now from CCD
        setupParams();

        timerID = SetTimer(POLLMS);
    }
    else
    {
        if (HasCooler())
        {
            deleteProperty(TemperatureRampNP.name);
            deleteProperty(CoolerNP.name);
            RemoveTimer(temperatureID);
        }

        deleteProperty(ReadModeSP.name);

        if (maxFanValue > 0)
            deleteProperty(FanNP.name);

        if (maxHeatingValue > 0)
            deleteProperty(WindowHeatingNP.name);

        if (hasGain)
            deleteProperty(GainNP.name);

        if (canDoPreflash)
            deleteProperty(PreflashNP.name);

        if (numFilters > 0)
        {
            INDI::FilterInterface::updateProperties();
        }
        RemoveTimer(timerID);
    }

    return true;
}
Пример #17
0
bool MICCD::updateProperties()
{
    INDI::CCD::updateProperties();

    if (isConnected())
    {
        if (HasCooler())
        {
            defineNumber(&TemperatureRampNP);
            defineNumber(&CoolerNP);
            temperatureID = IEAddTimer(POLLMS, MICCD::updateTemperatureHelper, this);
        }

        defineSwitch(&NoiseSP);

        if (maxFanValue > 0)
            defineNumber(&FanNP);

        if (maxHeatingValue > 0)
            defineNumber(&WindowHeatingNP);

        if (hasGain)
            defineNumber(&GainNP);

        if (numFilters > 0)
        {
            //Define the Filter Slot and name properties
            defineNumber(&FilterSlotNP);
            GetFilterNames(FILTER_TAB);
            defineText(FilterNameTP);
        }

        // Let's get parameters now from CCD
        setupParams();

        timerID = SetTimer(POLLMS);
    }
    else
    {
        if (HasCooler())
        {
            deleteProperty(TemperatureRampNP.name);
            deleteProperty(CoolerNP.name);
            RemoveTimer(temperatureID);
        }

        deleteProperty(NoiseSP.name);

        if (maxFanValue > 0)
            deleteProperty(FanNP.name);

        if (maxHeatingValue > 0)
            deleteProperty(WindowHeatingNP.name);

        if (hasGain)
            deleteProperty(GainNP.name);

        if (numFilters > 0)
        {
            deleteProperty(FilterSlotNP.name);
            deleteProperty(FilterNameTP->name);
        }
        RemoveTimer(timerID);
    }

    return true;
}
Пример #18
0
bool QHYCCD::updateProperties()
{
    double min=0, max=0, step=0;

    // This must be executed BEFORE INDI::CCD::updateProperties()
    // Since Primary CCD Exposure will be defined in there so we have to get its limits now
    {
        // Exposure limits in microseconds
        int ret = GetQHYCCDParamMinMaxStep(camhandle, CONTROL_EXPOSURE, &min, &max, &step);
        if (ret == QHYCCD_SUCCESS)
            PrimaryCCD.setMinMaxStep("CCD_EXPOSURE", "CCD_EXPOSURE_VALUE", min/1e6, max/1e6, step/1e6, false);
        else
            PrimaryCCD.setMinMaxStep("CCD_EXPOSURE", "CCD_EXPOSURE_VALUE", 0.001, 3600, 1, false);

            DEBUGF(INDI::Logger::DBG_DEBUG, "Exposure. Min: %g Max: %g Step %g", min, max, step);
    }

    // Define parent class properties
    INDI::CCD::updateProperties();

    if (isConnected())
    {
        if (HasCooler())
        {
            defineSwitch(&CoolerSP);
            defineNumber(&CoolerNP);

            temperatureID = IEAddTimer(POLLMS, QHYCCD::updateTemperatureHelper, this);
        }

        if (HasUSBSpeed)
        {
            if (sim)
            {
                SpeedN[0].min   = 1;
                SpeedN[0].max   = 5;
                SpeedN[0].step  = 1;
                SpeedN[0].value = 1;
            }
            else
            {
                int ret = GetQHYCCDParamMinMaxStep(camhandle, CONTROL_SPEED, &min, &max, &step);
                if (ret == QHYCCD_SUCCESS)
                {
                    SpeedN[0].min  = min;
                    SpeedN[0].max  = max;
                    SpeedN[0].step = step;
                }

                SpeedN[0].value = GetQHYCCDParam(camhandle, CONTROL_SPEED);

                DEBUGF(INDI::Logger::DBG_DEBUG, "USB Speed. Value: %g Min: %g Max: %g Step %g", SpeedN[0].value,
                       SpeedN[0].min, SpeedN[0].max, SpeedN[0].step);
            }

            defineNumber(&SpeedNP);
        }

        if (HasGain)
        {
            if (sim)
            {
                GainN[0].min   = 0;
                GainN[0].max   = 100;
                GainN[0].step  = 10;
                GainN[0].value = 50;
            }
            else
            {
                int ret = GetQHYCCDParamMinMaxStep(camhandle, CONTROL_GAIN, &min, &max, &step);
                if (ret == QHYCCD_SUCCESS)
                {
                    GainN[0].min  = min;
                    GainN[0].max  = max;
                    GainN[0].step = step;
                }
                GainN[0].value = GetQHYCCDParam(camhandle, CONTROL_GAIN);

                DEBUGF(INDI::Logger::DBG_DEBUG, "Gain. Value: %g Min: %g Max: %g Step %g", GainN[0].value, GainN[0].min,
                       GainN[0].max, GainN[0].step);
            }

            defineNumber(&GainNP);
        }

        if (HasOffset)
        {
            if (sim)
            {
                OffsetN[0].min   = 1;
                OffsetN[0].max   = 10;
                OffsetN[0].step  = 1;
                OffsetN[0].value = 1;
            }
            else
            {
                int ret = GetQHYCCDParamMinMaxStep(camhandle, CONTROL_OFFSET, &min, &max, &step);
                if (ret == QHYCCD_SUCCESS)
                {
                    OffsetN[0].min  = min;
                    OffsetN[0].max  = max;
                    OffsetN[0].step = step;
                }
                OffsetN[0].value = GetQHYCCDParam(camhandle, CONTROL_OFFSET);

                DEBUGF(INDI::Logger::DBG_DEBUG, "Offset. Value: %g Min: %g Max: %g Step %g", OffsetN[0].value,
                       OffsetN[0].min, OffsetN[0].max, OffsetN[0].step);
            }

            //Define the Offset
            defineNumber(&OffsetNP);
        }

        if (HasFilters)
        {
            INDI::FilterInterface::updateProperties();
        }

        if (HasUSBTraffic)
        {
            if (sim)
            {
                USBTrafficN[0].min   = 1;
                USBTrafficN[0].max   = 100;
                USBTrafficN[0].step  = 5;
                USBTrafficN[0].value = 20;
            }
            else
            {
                int ret = GetQHYCCDParamMinMaxStep(camhandle, CONTROL_USBTRAFFIC, &min, &max, &step);
                if (ret == QHYCCD_SUCCESS)
                {
                    USBTrafficN[0].min  = min;
                    USBTrafficN[0].max  = max;
                    USBTrafficN[0].step = step;
                }
                USBTrafficN[0].value = GetQHYCCDParam(camhandle, CONTROL_USBTRAFFIC);

                DEBUGF(INDI::Logger::DBG_DEBUG, "USB Traffic. Value: %g Min: %g Max: %g Step %g", USBTrafficN[0].value,
                       USBTrafficN[0].min, USBTrafficN[0].max, USBTrafficN[0].step);
            }
            defineNumber(&USBTrafficNP);
        }

        // Let's get parameters now from CCD
        setupParams();

        //timerID = SetTimer(POLLMS);
    }
    else
    {
        if (HasCooler())
        {
            deleteProperty(CoolerSP.name);
            deleteProperty(CoolerNP.name);
        }

        if (HasUSBSpeed)
        {
            deleteProperty(SpeedNP.name);
        }

        if (HasGain)
        {
            deleteProperty(GainNP.name);
        }

        if (HasOffset)
        {
            deleteProperty(OffsetNP.name);
        }

        if (HasFilters)
        {
            INDI::FilterInterface::updateProperties();
        }

        if (HasUSBTraffic)
            deleteProperty(USBTrafficNP.name);

        RemoveTimer(timerID);
    }

    return true;
}