bool Camera_INDIClass::ST4PulseGuideScope(int direction, int duration) { if (pulseGuideNS_prop && pulseGuideEW_prop) { switch (direction) { case EAST: pulseE_prop->value = duration; pulseW_prop->value = 0; sendNewNumber(pulseGuideEW_prop); break; case WEST: pulseE_prop->value = 0; pulseW_prop->value = duration; sendNewNumber(pulseGuideEW_prop); break; case NORTH: pulseN_prop->value = duration; pulseS_prop->value = 0; sendNewNumber(pulseGuideNS_prop); break; case SOUTH: pulseN_prop->value = 0; pulseS_prop->value = duration; sendNewNumber(pulseGuideNS_prop); break; case NONE: printf("error CameraINDI::Guide NONE\n"); break; } wxMilliSleep(duration); return false; } else return true; }
bool ScopeINDI::SlewToCoordinates(double ra, double dec) { bool err = true; if (coord_prop && oncoordset_prop) { setslew_prop->s = ISS_ON; settrack_prop->s = ISS_OFF; setsync_prop->s = ISS_OFF; sendNewSwitch(oncoordset_prop); INumber *raprop = IUFindNumber(coord_prop,"RA"); INumber *decprop = IUFindNumber(coord_prop,"DEC"); raprop->value = ra; decprop->value = dec; sendNewNumber(coord_prop); err = false; } return err; }
void INDI::BaseClientQt::sendNewNumber (const char * deviceName, const char * propertyName, const char * elementName, double value) { INDI::BaseDevice * drv = getDevice(deviceName); if (drv == NULL) return; INumberVectorProperty * nvp = drv->getNumber(propertyName); if (nvp == NULL) return; INumber * np = IUFindNumber(nvp, elementName); if (np == NULL) return; np->value = value; sendNewNumber(nvp); }
void IndiGui::SetButtonEvent(wxCommandEvent & event) { wxTextCtrl *entry; int i; wxButton *button = (wxButton *)event.GetEventObject(); if (! button) return; IndiProp *indiProp = (IndiProp *) button->GetClientData(); if (! indiProp) return; switch (indiProp->property->getType()) { case INDI_TEXT:{ ITextVectorProperty *tvp = indiProp->property->getText(); for (i = 0; i < tvp->ntp; i++) { if (tvp->p != IP_RO) { entry = (wxTextCtrl *)(indiProp->entry[wxString::FromAscii(tvp->tp[i].name)]); sprintf(tvp->tp[i].text, "%s", entry->GetLineText(0).mb_str().data()); } } sendNewText(tvp); break; } case INDI_NUMBER:{ INumberVectorProperty *nvp = indiProp->property->getNumber(); for (i = 0; i < nvp->nnp; i++) { if (nvp->p != IP_RO) { entry = (wxTextCtrl *)(indiProp->entry[wxString::FromAscii(nvp->np[i].name)]); entry->GetLineText(0).ToDouble(&nvp->np[i].value); } } sendNewNumber(nvp); break; } default:{ } } }
Mount::MOVE_RESULT ScopeINDI::Guide(GUIDE_DIRECTION direction, int duration) { // guide using timed pulse guide if (pulseGuideNS_prop && pulseGuideEW_prop) { // despite what is said in INDI standard properties description, every telescope driver expect the guided time in msec. switch (direction) { case EAST: pulseE_prop->value = duration; pulseW_prop->value = 0; sendNewNumber(pulseGuideEW_prop); break; case WEST: pulseE_prop->value = 0; pulseW_prop->value = duration; sendNewNumber(pulseGuideEW_prop); break; case NORTH: pulseN_prop->value = duration; pulseS_prop->value = 0; sendNewNumber(pulseGuideNS_prop); break; case SOUTH: pulseN_prop->value = 0; pulseS_prop->value = duration; sendNewNumber(pulseGuideNS_prop); break; case NONE: printf("error ScopeINDI::Guide NONE\n"); break; } wxMilliSleep(duration); return MOVE_OK; } // guide using motion rate and telescope motion // !!! untested as no driver implement TELESCOPE_MOTION_RATE at the moment (INDI 0.9.9) !!! else if (MotionRate_prop && moveNS_prop && moveEW_prop) { MotionRate_prop->np->value = 0.3 * 15 / 60; // set 0.3 sidereal in arcmin/sec sendNewNumber(MotionRate_prop); switch (direction) { case EAST: moveW_prop->s = ISS_OFF; moveE_prop->s = ISS_ON; sendNewSwitch(moveEW_prop); wxMilliSleep(duration); moveW_prop->s = ISS_OFF; moveE_prop->s = ISS_OFF; sendNewSwitch(moveEW_prop); break; case WEST: moveW_prop->s = ISS_ON; moveE_prop->s = ISS_OFF; sendNewSwitch(moveEW_prop); wxMilliSleep(duration); moveW_prop->s = ISS_OFF; moveE_prop->s = ISS_OFF; sendNewSwitch(moveEW_prop); break; case NORTH: moveN_prop->s = ISS_ON; moveS_prop->s = ISS_OFF; sendNewSwitch(moveNS_prop); wxMilliSleep(duration); moveN_prop->s = ISS_OFF; moveS_prop->s = ISS_OFF; sendNewSwitch(moveNS_prop); break; case SOUTH: moveN_prop->s = ISS_OFF; moveS_prop->s = ISS_ON; sendNewSwitch(moveNS_prop); wxMilliSleep(duration); moveN_prop->s = ISS_OFF; moveS_prop->s = ISS_OFF; sendNewSwitch(moveNS_prop); break; case NONE: printf("error ScopeINDI::Guide NONE\n"); break; } return MOVE_OK; } else return MOVE_ERROR; }
bool Camera_INDIClass::Capture(int duration, usImage& img, int options, const wxRect& subframeArg) { if (Connected) { bool takeSubframe = UseSubframes; wxRect subframe(subframeArg); // we can set the exposure time directly in the camera if (expose_prop) { if (Binning != m_curBinning) { FullSize = wxSize(m_maxSize.x / Binning, m_maxSize.y / Binning); binning_x->value = Binning; binning_y->value = Binning; sendNewNumber(binning_prop); m_curBinning = Binning; } if (subframe.width <= 0 || subframe.height <= 0) { takeSubframe = false; } // Program the size if (!takeSubframe) { subframe = wxRect(0, 0, FullSize.GetWidth(), FullSize.GetHeight()); } if (subframe != m_roi) { frame_x->value = subframe.x*Binning; frame_y->value = subframe.y*Binning; frame_width->value = subframe.width*Binning; frame_height->value = subframe.height*Binning; sendNewNumber(frame_prop); m_roi = subframe; } //printf("Exposing for %d(ms)\n", duration); // set the exposure time, this immediately start the exposure expose_prop->np->value = (double)duration/1000; sendNewNumber(expose_prop); modal = true; // will be reset when the image blob is received unsigned long loopwait = duration > 100 ? 10 : 1; CameraWatchdog watchdog(duration, GetTimeoutMs()); while (modal) { wxMilliSleep(loopwait); if (WorkerThread::TerminateRequested()) return true; if (watchdog.Expired()) { DisconnectWithAlert(CAPT_FAIL_TIMEOUT); return true; } } } // for video camera without exposure time setting else if (video_prop) { takeSubframe = false; //printf("Enabling video capture\n"); ISwitch *v_on = IUFindSwitch(video_prop,"ON"); ISwitch *v_off = IUFindSwitch(video_prop,"OFF"); v_on->s = ISS_ON; v_off->s = ISS_OFF; // start capture, every video frame is received as a blob sendNewSwitch(video_prop); // wait the required time wxMilliSleep(duration); // TODO : add the frames received during exposure //printf("Stop video capture\n"); v_on->s = ISS_OFF; v_off->s = ISS_ON; sendNewSwitch(video_prop); } else { return true; } //printf("Exposure end\n"); if (strcmp(cam_bp->format, ".fits") == 0) { //printf("Processing fits file\n"); // for CCD camera if ( ! ReadFITS(img,takeSubframe,subframe) ) { if (options & CAPTURE_SUBTRACT_DARK) { //printf("Subtracting dark\n"); SubtractDark(img); } if (options & CAPTURE_RECON) { if (PixSizeX != PixSizeY) SquarePixels(img, PixSizeX, PixSizeY); } return false; } else { return true; } } else if (strcmp(cam_bp->format, ".stream") == 0) { //printf("Processing stream file\n"); // for video camera return ReadStream(img); } else { pFrame->Alert(_("Unknown image format: ") + wxString::FromAscii(cam_bp->format)); return true; } } else { // in case the camera is not connected return true; } // we must never go here return true; }