/** * Set the digital gain in the MT9V022. * Sets the tiled digital gain to 2x what the default is. */ dc1394error_t FFMVCCD::setDigitalGain(ISState state) { dc1394error_t err; unsigned int val; if (state == ISS_OFF) { err = writeMicronReg(0x80, 0xF4); err = readMicronReg(0x80, &val); if (err == DC1394_SUCCESS) { IDMessage(getDeviceName(), "Turned off digital gain boost. Tiled Digital Gain = 0x%x", val); } else { IDMessage(getDeviceName(), "readMicronReg failed!"); } } else { err = writeMicronReg(0x80, 0xF8); err = readMicronReg(0x80, &val); if (err == DC1394_SUCCESS) { IDMessage(getDeviceName(), "Turned on digital gain boost. Tiled Digital Gain = 0x%x", val); } else { IDMessage(getDeviceName(), "readMicronReg failed!"); } } return DC1394_SUCCESS; }
bool NFocus::Connect() { int connectrc=0; char errorMsg[MAXRBUF]; if (isDebug()) IDLog("connecting to %s\n",PortT[0].text); if ( (connectrc = tty_connect(PortT[0].text, 9600, 8, 0, 1, &PortFD)) != TTY_OK) { tty_error_msg(connectrc, errorMsg, MAXRBUF); if (isDebug()) IDLog("Failed to connect o port %s. Error: %s", PortT[0].text, errorMsg); IDMessage(getDeviceName(), "Failed to connect to port %s. Error: %s", PortT[0].text, errorMsg); return false; } IDMessage(getDeviceName(), "Nfocus is online. Getting focus parameters..."); return true; }
/** * Set the ADC reference voltage for the MT9V022. * Decreasing the reference voltage will, in effect, increase the gain. * The default Vref_ADC is 1.4V (4). We will bump it down to 1.0V (0). */ dc1394error_t FFMVCCD::setGainVref(ISState state) { dc1394error_t err; unsigned int val; if (state == ISS_OFF) { err = writeMicronReg(0x2C, 4); err = readMicronReg(0x2C, &val); if (err == DC1394_SUCCESS) { IDMessage(getDeviceName(), "Turned off Gain boost. VREF_ADC = 0x%x", val); } else { IDMessage(getDeviceName(), "readMicronReg failed!"); } } else { err = writeMicronReg(0x2C, 0); err = readMicronReg(0x2C, &val); if (err == DC1394_SUCCESS) { IDMessage(getDeviceName(), "Turned on Gain boost. VREF_ADC = 0x%x", val); } else { IDMessage(getDeviceName(), "readMicronReg failed!"); } } return DC1394_SUCCESS; }
/** * Download image from FireFly */ void FFMVCCD::grabImage() { dc1394error_t err; dc1394video_frame_t *frame; uint32_t uheight, uwidth; int sub; uint16_t val; struct timeval start, end; // Let's get a pointer to the frame buffer uint8_t * image = PrimaryCCD.getFrameBuffer(); // Get width and height int width = PrimaryCCD.getSubW() / PrimaryCCD.getBinX(); int height = PrimaryCCD.getSubH() / PrimaryCCD.getBinY(); memset(image, 0, PrimaryCCD.getFrameBufferSize()); /*----------------------------------------------------------------------- * stop data transmission *-----------------------------------------------------------------------*/ gettimeofday(&start, NULL); for (sub = 0; sub < sub_count; ++sub) { IDMessage(getDeviceName(), "Getting sub %d of %d", sub, sub_count); err=dc1394_capture_dequeue(dcam, DC1394_CAPTURE_POLICY_WAIT, &frame); if (err != DC1394_SUCCESS) { IDMessage(getDeviceName(), "Could not capture frame"); } dc1394_get_image_size_from_video_mode(dcam,DC1394_VIDEO_MODE_640x480_MONO16, &uwidth, &uheight); if (DC1394_TRUE == dc1394_capture_is_frame_corrupt(dcam, frame)) { IDMessage(getDeviceName(), "Corrupt frame!"); continue; } // Fill buffer with random pattern for (int i=0; i < height ; i++) { for (int j=0; j < width; j++) { /* Detect unsigned overflow */ val = ((uint16_t *) image)[i*width+j] + ntohs(((uint16_t*) (frame->image))[i*width+j]); if (val > ((uint16_t *) image)[i*width+j]) { ((uint16_t *) image)[i*width+j] = val; } else { ((uint16_t *) image)[i*width+j] = 0xFFFF; } } } dc1394_capture_enqueue(dcam, frame); } err=dc1394_video_set_transmission(dcam,DC1394_OFF); IDMessage(getDeviceName(), "Download complete."); gettimeofday(&end, NULL); IDMessage(getDeviceName(), "Download took %d uS", (int) ((end.tv_sec - start.tv_sec) * 1000000 + (end.tv_usec - start.tv_usec))); // Let INDI::CCD know we're done filling the image buffer ExposureComplete(&PrimaryCCD); }
/******************************** ** Client is asking us to establish connection to the device *********************************/ bool Cindi_iidc::Connect() { dc1394camera_list_t *list; dc1394error_t err; dc1394 = dc1394_new(); if (!dc1394) { return false; } /* init bus and connect to the camera */ err = dc1394_camera_enumerate(dc1394, &list); if (err != DC1394_SUCCESS) { IDMessage(getDeviceName(), "Could not find DC1394 cameras!"); return false; } if (!list->num) { IDMessage(getDeviceName(), "No DC1394 cameras found!"); return false; } dcam = dc1394_camera_new(dc1394, list->ids[0].guid); if (!dcam) { IDMessage(getDeviceName(), "Unable to connect to camera!"); return false; } /* Reset camera */ err = dc1394_camera_reset(dcam); if (err != DC1394_SUCCESS) { IDMessage(getDeviceName(), "Unable to reset camera!"); return false; } IDMessage(getDeviceName(), "indi-iidc connected successfully!"); return true; }
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; }
IPState FocusSim::MoveAbsFocuser(uint32_t targetTicks) { if (targetTicks < FocusAbsPosN[0].min || targetTicks > FocusAbsPosN[0].max) { IDMessage(getDeviceName(), "Error, requested absolute position is out of range."); return IPS_ALERT; } double mid = (FocusAbsPosN[0].max - FocusAbsPosN[0].min)/2; IDMessage(getDeviceName() , "Focuser is moving to requested position..."); // Limit to +/- 10 from initTicks ticks = initTicks + (targetTicks - mid) / 5000.0; if (isDebug()) IDLog("Current ticks: %g\n", ticks); // simulate delay in motion as the focuser moves to the new position usleep( abs(targetTicks - FocusAbsPosN[0].value) * FOCUS_MOTION_DELAY); FocusAbsPosN[0].value = targetTicks; FWHMN[0].value = 0.5625*ticks*ticks + SeeingN[0].value; if (FWHMN[0].value < SeeingN[0].value) FWHMN[0].value = SeeingN[0].value; IDSetNumber(&FWHMNP, NULL); return IPS_OK; }
bool IEQPro::Goto(double r,double d) { targetRA=r; targetDEC=d; char RAStr[64], DecStr[64]; fs_sexa(RAStr, targetRA, 2, 3600); fs_sexa(DecStr, targetDEC, 2, 3600); if (set_ieqpro_ra(PortFD, r) == false || set_ieqpro_dec(PortFD, d) == false) { DEBUG(INDI::Logger::DBG_ERROR, "Error setting RA/DEC."); return false; } if (slew_ieqpro(PortFD) == false) { DEBUG(INDI::Logger::DBG_ERROR, "Failed to slew."); return false; } TrackState = SCOPE_SLEWING; IDMessage(getDeviceName(), "Slewing to RA: %s - DEC: %s", RAStr, DecStr); return true; }
bool ioptronHC8406::updateLocation(double latitude, double longitude, double elevation) { INDI_UNUSED(elevation); if (isSimulation()) return true; double final_longitude; if (longitude > 180) final_longitude = longitude - 360.0; else final_longitude = longitude; if (!isSimulation() && setioptronHC8406Longitude(final_longitude) < 0) { DEBUG(INDI::Logger::DBG_ERROR, "Error setting site longitude coordinates"); return false; } if (!isSimulation() && setioptronHC8406Latitude(latitude) < 0) { DEBUG(INDI::Logger::DBG_ERROR, "Error setting site latitude coordinates"); return false; } char l[32], L[32]; fs_sexa(l, latitude, 3, 3600); fs_sexa(L, longitude, 4, 3600); IDMessage(getDeviceName(), "Site location updated to Lat %.32s - Long %.32s", l, L); return true; }
/************************************************************************************** ** Main device loop. We check for exposure progress ***************************************************************************************/ void FFMVCCD::TimerHit() { long timeleft; if(isConnected() == false) { return; // No need to reset timer if we are not connected anymore } if (InExposure) { timeleft=CalcTimeLeft(); // Less than a 0.1 second away from exposure completion // This is an over simplified timing method, check CCDSimulator and ffmvCCD for better timing checks if (timeleft < 0.1) { /* We're done exposing */ IDMessage(getDeviceName(), "Exposure done, downloading image..."); // Set exposure left to zero PrimaryCCD.setExposureLeft(0); // We're no longer exposing... InExposure = false; /* grab and save image */ grabImage(); } else { // Just update time left in client PrimaryCCD.setExposureLeft(timeleft); } } SetTimer(POLLMS); return; }
/************************************************************************************** ** Create a random image and return it to client ***************************************************************************************/ void SimpleDetector::grabFrame() { // Set length of continuum int len = PrimaryDetector.getSampleRate() * PrimaryDetector.getCaptureDuration() * PrimaryDetector.getBPS() / 8; PrimaryDetector.setContinuumBufferSize(len); // Let's get a pointer to the frame buffer uint8_t *continuum = PrimaryDetector.getContinuumBuffer(); // Fill buffer with random pattern for (int i = 0; i < len; i++) continuum[i] = rand() % 255; // Set length of spectrum len = 1000; PrimaryDetector.setSpectrumBufferSize(len); // Let's get a pointer to the frame buffer double *spectrum = PrimaryDetector.getSpectrumBuffer(); // Fill buffer with random pattern for (int i = 0; i < len; i++) spectrum[i] = rand() % 255; IDMessage(getDeviceName(), "Download complete."); // Let INDI::Detector know we're done filling the image buffer CaptureComplete(&PrimaryDetector); }
IPState NFocus::MoveRelFocuser(FocusDirection dir, uint32_t ticks) { double cur_rpos = 0; double new_rpos = 0; int ret = 0; bool nset = false; cur_rpos = new_rpos = ticks; /* CHECK 2006-01-26, limits are relative to the actual position */ nset = new_rpos >= -0xffff && new_rpos <= 0xffff; if (nset) { if (dir == FOCUS_OUTWARD) { if ((currentPosition + new_rpos < currentMinPosition) || (currentPosition + new_rpos > currentMaxPosition)) { IDMessage(getDeviceName(), "Value out of limits %5.0f", currentPosition + new_rpos); return IPS_ALERT; } ret = moveNFOutward(&new_rpos); } else { if ((currentPosition - new_rpos < currentMinPosition) || (currentPosition - new_rpos > currentMaxPosition)) { IDMessage(getDeviceName(), "Value out of limits %5.0f", currentPosition - new_rpos); return IPS_ALERT; } ret = moveNFInward(&new_rpos); } if (ret < 0) { // We have to leave here, because new_rpos is not set return IPS_ALERT; } currentRelativeMovement = cur_rpos; return IPS_OK; } { IDMessage(getDeviceName(), "Value out of limits."); return IPS_ALERT; } }
bool JoyStick::Connect() { bool rc = driver->Connect(); if (rc) { IDMessage(getDeviceName(), "Joystick is online."); setupParams(); } else IDMessage(getDeviceName(), "Error: cannot find Joystick device."); return rc; }
/************************************************************************************** ** Client is asking us to establish connection to the device ***************************************************************************************/ bool SimpleDetector::Connect() { IDMessage(getDeviceName(), "Simple Detector connected successfully!"); // Let's set a timer that checks teleDetectors status every POLLMS milliseconds. SetTimer(POLLMS); return true; }
/******************************** ** Client is asking us to terminate connection to the device *********************************/ bool Cindi_iidc::Disconnect() { if (dcam) { dc1394_capture_stop(dcam); dc1394_camera_free(dcam); } IDMessage(getDeviceName(), "indi-iidc disconnected successfully!"); return true; }
bool QFW::Handshake() { if (isSimulation()) { IDMessage(getDeviceName(), "Simulation: connected"); PortFD = 1; } else { // check serial connection if (PortFD < 0 || isatty(PortFD) == 0) { IDMessage(getDeviceName(), "Device /dev/ttyACM0 is not available\n"); return false; } } return true; }
/************************************************************************************** ** Client is asking us to terminate connection to the device ***************************************************************************************/ bool FFMVCCD::Disconnect() { if (dcam) { dc1394_capture_stop(dcam); dc1394_camera_free(dcam); } IDMessage(getDeviceName(), "Point Grey FireFly MV disconnected successfully!"); return true; }
int NFocus::ReadResponse(char *buf, int nbytes, int timeout) { char nfocus_error[MAXRBUF]; int bytesRead = 0; int totalBytesRead = 0; int err_code; if (isDebug()) IDLog("##########################################\n") ; while (totalBytesRead < nbytes) { if ( (err_code = tty_read(PortFD, buf+totalBytesRead, nbytes-totalBytesRead, timeout, &bytesRead)) != TTY_OK) { tty_error_msg(err_code, nfocus_error, MAXRBUF); if (isDebug()) { IDLog("TTY error detected: %s\n", nfocus_error); IDMessage(getDeviceName(), "TTY error detected: %s\n", nfocus_error); } return -1; } if (isDebug()) IDLog("Bytes Read: %d\n", bytesRead); if (bytesRead < 0 ) { if (isDebug()) IDLog("Bytesread < 1\n"); return -1; } totalBytesRead += bytesRead; } tcflush(PortFD, TCIOFLUSH); if (isDebug()) { fprintf(stderr, "READ : (%s,%d), %d\n", buf, 9, totalBytesRead) ; fprintf(stderr, "READ : ") ; for(int i=0; i < 9; i++) { fprintf(stderr, "0x%2x ", (unsigned char)buf[i]) ; } fprintf(stderr, "\n") ; } return 9; }
bool FishCampCCD::UpdateCCDFrame(int x, int y, int w, int h) { int rc = 0; /* Add the X and Y offsets */ long x_1 = x; long y_1 = y; long bin_width = x_1 + (w / PrimaryCCD.getBinX()); long bin_height = y_1 + (h / PrimaryCCD.getBinY()); if (bin_width > PrimaryCCD.getXRes() / PrimaryCCD.getBinX()) { IDMessage(getDeviceName(), "Error: invalid width requested %d", w); return false; } else if (bin_height > PrimaryCCD.getYRes() / PrimaryCCD.getBinY()) { IDMessage(getDeviceName(), "Error: invalid height request %d", h); return false; } LOGF_DEBUG("The Final image area is (%ld, %ld), (%ld, %ld)\n", x_1, y_1, bin_width, bin_height); rc = fcUsb_cmd_setRoi(cameraNum, x_1, y_1, x_1 + w - 1, y_1 + h - 1); LOGF_DEBUG("fcUsb_cmd_setRoi returns %d", rc); // Set UNBINNED coords PrimaryCCD.setFrame(x_1, y_1, w, h); int nbuf; nbuf = (bin_width * bin_height * PrimaryCCD.getBPP() / 8); // this is pixel count nbuf += 512; // leave a little extra at the end PrimaryCCD.setFrameBufferSize(nbuf); LOGF_DEBUG("Setting frame buffer size to %d bytes.\n", nbuf); return true; }
IPState NFocus::MoveRelFocuser(FocusDirection dir, uint32_t ticks) { double cur_rpos=0 ; double new_rpos = 0 ; int ret=0; bool nset = false; cur_rpos= new_rpos = ticks; /* CHECK 2006-01-26, limits are relative to the actual position */ nset = new_rpos >= -0xffff && new_rpos <= 0xffff; if (nset) { if( dir == FOCUS_OUTWARD) { if((currentPosition + new_rpos < currentMinPosition) || (currentPosition + new_rpos > currentMaxPosition)) { IDMessage(getDeviceName(), "Value out of limits %5.0f", currentPosition + new_rpos); return IPS_ALERT; } ret= updateNFPositionRelativeOutward(&new_rpos) ; } else { if((currentPosition - new_rpos < currentMinPosition) || (currentPosition - new_rpos > currentMaxPosition)) { IDMessage(getDeviceName(), "Value out of limits %5.0f", currentPosition - new_rpos); return IPS_ALERT; } ret= updateNFPositionRelativeInward(&new_rpos) ; } if( ret < 0) { IDMessage(getDeviceName(), "Read out of the relative movement failed, trying to recover position."); if((ret= updateNFPosition(¤tPosition)) < 0) { IDMessage(getDeviceName(), "Unknown error while reading Nfocus position: %d", ret); return IPS_ALERT; } IDMessage(getDeviceName(), "Nfocus position recovered %5.0f", currentPosition); // We have to leave here, because new_rpos is not set return IPS_ALERT; } currentRelativeMovement= cur_rpos ; // currentAbsoluteMovement= currentPosition; return IPS_OK; } { IDMessage(getDeviceName(), "Value out of limits."); return IPS_ALERT; } }
IPState NFocus::MoveAbsFocuser(uint32_t targetTicks) { int ret= -1 ; double new_apos = targetTicks; if (targetTicks < FocusAbsPosN[0].min || targetTicks > FocusAbsPosN[0].max) { IDMessage(getDeviceName(), "Error, requested absolute position is out of range."); return IPS_ALERT; } IDMessage(getDeviceName() , "Focuser is moving to requested position..."); if(( ret= updateNFPositionAbsolute(&new_apos)) < 0) { IDMessage(getDeviceName(), "Read out of the absolute movement failed %3d, trying to recover position.", ret); for (int i=0;; i++) { if((ret= updateNFPosition(¤tPosition)) < 0) { IDMessage(getDeviceName(),"Unknown error while reading Nfocus position: %d.", ret); if (i == NF_MAX_TRIES) return IPS_ALERT; else usleep(NF_MAX_DELAY); } else break; } IDMessage( getDeviceName(), "Nfocus position recovered resuming normal operation"); /* We have to leave here, because new_apos is not set */ return IPS_ALERT; } return IPS_OK; }
bool QFW::Handshake() { if (isSimulation()) { IDMessage(getDeviceName(), "Simulation: connected"); PortFD = 1; return true; } // check serial connection if (PortFD < 0 || isatty(PortFD) == 0) { IDMessage(getDeviceName(), "Device /dev/ttyACM0 is not available\n"); return false; } // read description char cmd[10] = {"SN\r\n"}; char resp[255]={0}; if (send_command(PortFD, cmd, resp) < 2) return false; // SN should respond SN<number>, this identifies a Quantum wheel return strncmp(cmd, resp, 2) == 0; }
bool AAGCloudWatcher::Disconnect() { if (cwc != NULL) { resetData(); resetConstants(); cwc->setPWMDutyCycle(1); delete cwc; cwc = NULL; IDMessage(getDefaultName(), "Disconnected from AAG Cloud Watcher\n"); } return true; }
bool IndiRpialtimu::Connect() { // using RTIMULib here allows it to use the .ini file generated by RTIMULibDemo. RTIMUSettings *settings = new RTIMUSettings("RTIMULib"); imu = RTIMU::createIMU(settings); pressure = RTPressure::createPressure(settings); if ((imu == NULL) || (imu->IMUType() == RTIMU_TYPE_NULL)) { IDMessage(getDeviceName(), "Astroberry AltIMU fatal error - no IMU found."); return false; } // This is an opportunity to manually override any settings before the call IMUInit // set up IMU if (!imu->IMUInit()) { IDMessage(getDeviceName(), "Astroberry AltIMU fatal error - problem initiating IMU."); return false; } // set up pressure sensor if (pressure != NULL) pressure->pressureInit(); // set up for rate timer rateTimer = displayTimer = RTMath::currentUSecsSinceEpoch(); // first timer run @1/100 recommended sampling rate SetTimer ( imu->IMUGetPollInterval() * 100 ); IDMessage(getDeviceName(), "Astroberry AltIMU connected successfully."); return true; }
/************************************************************************************** ** Get the Data ***************************************************************************************/ void RadioSim::grabData() { int to_read; int len = static_cast<int>RESOLUTION_PX(DishSize); double val = 0; int x = static_cast<int>(Ra * IMAGE_WIDTH / FOV_DEG); int y = static_cast<int>(Dec * IMAGE_HEIGHT / FOV_DEG); PrimaryDetector.setContinuumBufferSize(1); continuum = PrimaryDetector.getContinuumBuffer(); for(to_read = 0; to_read < len && x + to_read < IMAGE_WIDTH; to_read++) val += MagickImage[x + (y * IMAGE_WIDTH) + to_read]; continuum[0] = static_cast<unsigned char>(val / (to_read)); IDMessage (getDeviceName(), "value: %d", continuum[0]); LOG_INFO("Download complete."); // Let INDI::Detector know we're done filling the data buffers CaptureComplete(&PrimaryDetector); }
void ISGetProperties(const char *dev) { ATIK_CCD_ISInit(); if (iAvailableCamerasCount == 0) { IDMessage(nullptr, "No Atik cameras detected. Power on?"); return; } for (int i = 0; i < iAvailableCamerasCount; i++) { ATIKCCD *camera = cameras[i]; if (dev == nullptr || !strcmp(dev, camera->name)) { camera->ISGetProperties(dev); if (dev != nullptr) break; } } }
void ISGetProperties(const char *dev) { ISInit(); if (cameraCount == 0) { IDMessage(nullptr, "No Moravian cameras detected. Power on?"); return; } for (int i = 0; i < cameraCount; i++) { MICCD *camera = cameras[i]; if (!dev || !strcmp(dev, camera->name)) { camera->ISGetProperties(dev); if (dev) break; } } }
IPState FocusSim::MoveFocuser(FocusDirection dir, int speed, uint16_t duration) { double targetTicks = (speed * duration) / (FocusSpeedN[0].max * FocusTimerN[0].max); double plannedTicks=ticks; double plannedAbsPos=0; if (dir == FOCUS_INWARD) plannedTicks -= targetTicks; else plannedTicks += targetTicks; if (isDebug()) IDLog("Current ticks: %g - target Ticks: %g, plannedTicks %g\n", ticks, targetTicks, plannedTicks); plannedAbsPos = (plannedTicks - initTicks) * 5000 + (FocusAbsPosN[0].max - FocusAbsPosN[0].min)/2; if (plannedAbsPos < FocusAbsPosN[0].min || plannedAbsPos > FocusAbsPosN[0].max) { IDMessage(getDeviceName(), "Error, requested position is out of range."); return IPS_ALERT; } ticks = plannedTicks; if (isDebug()) IDLog("Current absolute position: %g, current ticks is %g\n", plannedAbsPos, ticks); FWHMN[0].value = 0.5625*ticks*ticks + SeeingN[0].value; FocusAbsPosN[0].value = plannedAbsPos; if (FWHMN[0].value < SeeingN[0].value) FWHMN[0].value = SeeingN[0].value; IDSetNumber(&FWHMNP, NULL); IDSetNumber(&FocusAbsPosNP, NULL); return IPS_OK; }
int NFocus::updateNFPositionRelativeInward(double *value) { char rf_cmd[32] ; int ret_read_tmp ; float temp ; int cont = 1; rf_cmd[0]= 0 ; int newval = (int)(currentInOutScalar * (*value)); IDMessage(getDeviceName(),"Moving %d real steps but virtually counting %.0f\n",newval,*value); do { if ( newval > 999) { strncpy(rf_cmd, ":F01999#\0", 9) ; newval -= 999; } else if(newval > 99) { snprintf( rf_cmd, 32, ":F01%3d#", (int) newval) ; newval = 0; } else if(newval > 9) { snprintf( rf_cmd, 32, ":F010%2d#", (int) newval) ; newval = 0; } else { snprintf( rf_cmd, 32, ":F0100%1d#", (int) newval) ; newval = 0; } if ((ret_read_tmp= SendCommand( rf_cmd)) < 0) return ret_read_tmp; do { strncpy(rf_cmd, "S\0", 2); if ((ret_read_tmp= SendRequest( rf_cmd)) < 0) return ret_read_tmp; } while ( (int)atoi(rf_cmd) ); } while ( newval > 0 ); currentPosition -= *value; return 0; }
bool SynscanMount::Park() { char str[20]; int numread, bytesWritten, bytesRead; memset(str,0,3); tty_write(PortFD,"Ka",2, &bytesWritten); // test for an echo tty_read(PortFD,str,2,2, &bytesRead); // Read 2 bytes of response if(str[1] != '#') { // this is not a correct echo // so we are not talking to a mount properly return false; } // Now we stop tracking tty_write(PortFD,"T0",2, &bytesWritten); numread=tty_read(PortFD,str,1,60, &bytesRead); if (bytesRead!=1||str[0]!='#') { if (isDebug()) IDLog("Timeout waiting for scope to stop tracking."); return false; } //sprintf((char *)str,"b%08X,%08X",0x0,0x40000000); tty_write(PortFD,"B0000,4000",10, &bytesWritten); numread=tty_read(PortFD,str,1,60, &bytesRead); if (bytesRead!=1||str[0]!='#') { if (isDebug()) IDLog("Timeout waiting for scope to respond to park."); return false; } TrackState=SCOPE_PARKING; IDMessage(getDeviceName(),"Parking Telescope..."); return true; }