void MainWindow::initServoBoard() { this->ui->actionSave_Sequence->setVisible(true); this->ui->actionLoad_Sequence->setVisible(true); this->ui->actionSave_Sequence_As->setVisible(true); this->ui->actionSet_Global_Values->setVisible(true); this->ui->actionKeep_Edits_Automatically->setVisible(true); if (!this->servoControl) { servoControl = new ServoboardController(this->port,this->servotab,this); } connect(this->ui->actionLoad_Sequence,SIGNAL(triggered()),servoControl,SLOT(loadFile())); connect(this->ui->actionSave_Sequence,SIGNAL(triggered()),servoControl,SLOT(saveFile())); connect(this->ui->actionSave_Sequence_As,SIGNAL(triggered()),servoControl,SLOT(saveFileAs())); connect(this->servotab,SIGNAL(newPositionToSequence(Position*)), servoControl,SLOT(newPositionForSequence(Position*))); connect(this->ui->actionSet_Global_Values,SIGNAL(triggered()), servoControl,SLOT(globalVariableSetRequested())); connect(this->servotab,SIGNAL(playSequence()),servoControl,SLOT(playCurrentSequence())); connect(this->servotab,SIGNAL(playPosition(Position*)),this->servoControl,SLOT(playPosition(Position*))); connect(this->ui->actionKeep_Edits_Automatically,SIGNAL(toggled(bool)), servoControl,SLOT(suppressChangeNotifications(bool))); connect(this->servotab,SIGNAL(pauseSequence()),this->servoControl,SLOT(pauseSequence())); connect(this->servotab,SIGNAL(stopSequence()),this->servoControl,SLOT(stopSequence())); }
void MSequencer::stop() { for(int i = 0; i < MAX_SEQ; i++) { stopSequence(i); } Midi.sendStop(); }
AnalysisManager::~AnalysisManager(void) { STDLINE("Destructor",ACRed); stopSequence(); clearFilesList(); resetAnalyses(); }
void imagesequence::prepareCapture() { INDI_P * tempProp(NULL); // Do we need to select filter First?? if (currentFilter.isEmpty() || currentFilter == i18n("None")) captureImage(); else { if (!verifyFilterIntegrity()) { stopSequence(); return; } if ( stdDevFilter && ((tempProp = stdDevFilter->dp->findProp("FILTER_SLOT")) != NULL)) { connect (tempProp, SIGNAL(okState()), this, SLOT(captureImage())); selectFilter(); } else kdDebug() << "Error: std Filter device lost or missing FILTER_SLOT property" << endl; } }
void FileProcessor::commandHold(const QStringList& cmd) { bool ok; int v = cmd.at(1).toInt(&ok); if (!ok) { qDebug() << "Invalid HOLD command: " << cmd; stopSequence(); return; } QTimer::singleShot(v * 1000, this, SLOT(readNextCommand())); }
void FileProcessor::commandBase(const QStringList& cmd) { bool ok; int v = cmd.at(1).toFloat(&ok); if (!ok) { qDebug() << "Invalid BASE command: " << cmd; stopSequence(); return; } if (sound_manager_ != NULL) { sound_manager_->setBase(v); } QTimer::singleShot(0, this, SLOT(readNextCommand())); }
void FileProcessor::readNextCommand() { if (file_ == NULL) { return; } if (file_->atEnd()) { stopSequence(); return; } QString line = file_->readLine(); QStringList tokens = line.split(QRegExp("[\\s,]"), QString::SkipEmptyParts); qDebug() << "Command: " << tokens; if (tokens.at(0) == "BASE" && tokens.length() == 2) { commandBase(tokens); } else if (tokens.at(0) == "VOLUME" && tokens.length() == 2) { commandVolume(tokens); } else if (tokens.at(0) == "SET" && tokens.length() == 2) { commandSet(tokens); } else if (tokens.at(0) == "HARMONICS" && tokens.length() == 2) { commandHarmonics(tokens); } else if (tokens.at(0) == "HOLD" && tokens.length() == 2) { commandHold(tokens); } else if (tokens.at(0) == "PAUSE" && tokens.length() == 1) { commandPause(tokens); } else if (tokens.at(0) == "END" && tokens.length() == 1) { commandEnd(tokens); } else if (tokens.at(0) == "EXIT" && tokens.length() == 1) { commandExit(tokens); } else if (tokens.at(0) == "FADE" && tokens.length() == 3) { commandFade(tokens); } else if (tokens.at(0) == "SLIDE" && tokens.length() == 3) { commandSlide(tokens); } else { qDebug() << "Invalid command: " << tokens; stopSequence(); } }
void imagesequence::startSequence() { if (active) stopSequence(); // Let's find out which device has been selected and that it's connected. if (!verifyCCDIntegrity()) return; // Get expose paramater active = true; ISOStamp = ISOCheck->isChecked() ? true : false; seqExpose = exposureIN->value(); seqTotalCount = countIN->value(); seqCurrentCount = 0; seqDelay = delayIN->value() * 1000; /* in ms */ currentCCD = CCDCombo->currentText(); lastCCD = CCDCombo->currentItem(); currentFilter = filterCombo->currentText(); lastFilter = filterCombo->currentItem(); fullImgCountOUT->setText( QString("%1").arg(seqTotalCount)); currentImgCountOUT->setText(QString("%1").arg(seqCurrentCount)); // Ok, now let's connect signals and slots for this device connect(stdDevCCD, SIGNAL(FITSReceived(QString)), this, SLOT(newFITS(QString))); // set the progress info imgProgress->setEnabled(true); imgProgress->setTotalSteps(seqTotalCount); imgProgress->setProgress(seqCurrentCount); stdDevCCD->batchMode = true; stdDevCCD->ISOMode = ISOStamp; // Set this LAST stdDevCCD->updateSequencePrefix(prefixIN->text()); // Update button status startB->setEnabled(false); stopB->setEnabled(true); prepareCapture(); }
void FileProcessor::commandSlide(const QStringList& cmd) { int cur = -1; bool ok1, ok2; int target = cmd.at(1).toFloat(&ok1); int interval = cmd.at(2).toInt(&ok2); if (!ok1 || !ok2) { qDebug() << "Invalid SLIDE command: " << cmd; stopSequence(); return; } if (sound_manager_ != NULL) { cur = sound_manager_->getBeat(); d_->update_magnitude = target > cur ? 1 : -1; d_->updates_left = abs(target - cur); d_->update_interval = interval * 1000 / abs(target - cur); d_->update_type = BEAT; QTimer::singleShot(d_->update_interval, this, SLOT(doAdjustment())); qDebug() << d_->updates_left << d_->update_interval << d_->update_magnitude; } }
imagesequence::imagesequence(QWidget* parent, const char* name, bool modal, WFlags fl) : imgSequenceDlg(parent,name, modal,fl) { ksw = (KStars *) parent; INDIMenu *devMenu = ksw->getINDIMenu(); if (devMenu) { connect (devMenu, SIGNAL(newDevice()), this, SLOT(newCCD())); connect (devMenu, SIGNAL(newDevice()), this, SLOT(newFilter())); } seqTimer = new QTimer(this); setModal(false); // Connect signals and slots connect(startB, SIGNAL(clicked()), this, SLOT(startSequence())); connect(stopB, SIGNAL(clicked()), this, SLOT(stopSequence())); connect(closeB, SIGNAL(clicked()), this, SLOT(close())); connect(seqTimer, SIGNAL(timeout()), this, SLOT(prepareCapture())); connect(CCDCombo, SIGNAL(activated(int)), this, SLOT(checkCCD(int))); connect(filterCombo, SIGNAL(activated(int)), this, SLOT(updateFilterCombo(int))); active = false; ISOStamp = false; seqExpose = 0; seqTotalCount = 0; seqCurrentCount = 0; seqDelay = 0; lastCCD = 0; lastFilter = 0; stdDevCCD = NULL; stdDevFilter = NULL; }
void FileProcessor::commandEnd(const QStringList& /* cmd */) { stopSequence(); }
void imagesequence::captureImage() { INDI_P * exposeProp(NULL); INDI_E * exposeElem(NULL); INDI_P * tempProp(NULL); // Let's capture a new frame in acoord with the settings // We need to take into consideration the following conditions: // A. The device has been disconnected. // B. The device has been lost. // C. The property is still busy. // D. The property has been lost. if ( stdDevFilter && ((tempProp = stdDevFilter->dp->findProp("FILTER_SLOT")) != NULL)) tempProp->disconnect( SIGNAL (okState())); if (!verifyCCDIntegrity()) { stopSequence(); return; } exposeProp = stdDevCCD->dp->findProp("CCD_EXPOSE_DURATION"); exposeElem = exposeProp->findElement("EXPOSE_DURATION"); // disable timer until it's called again by newFITS, or called for retries seqTimer->stop(); // Make sure it's not busy, if it is then schedual. if (exposeProp->state == PS_BUSY) { retries++; if (retries > RETRY_MAX) { seqTimer->stop(); KMessageBox::error(this, i18n("Device is busy and not responding.")); stopSequence(); retries = 0; return; } seqTimer->start(RETRY_PERIOD); } // Set duration if applicable. We check the property permission, min, and max values if (exposeProp->perm == PP_RW || exposeProp->perm == PP_WO) { if (seqExpose < exposeElem->min || seqExpose > exposeElem->max) { stopSequence(); KMessageBox::error(this, i18n("Expose duration is invalid. %1 supports expose durations from %2 to %3 seconds only.").arg(currentCCD).arg(exposeElem->min).arg(exposeElem->max)); return; } // we're okay, set it exposeElem->targetValue = seqExpose; if (exposeElem->spin_w) { exposeElem->spin_w->setValue(seqExpose); exposeElem->spinChanged(seqExpose); } else exposeElem->write_w->setText( QString("%1").arg(seqExpose)); } // We're done! Send it to the driver exposeProp->newText(); }
bool imagesequence::setupCCDs() { bool imgDeviceFound (false); INDI_P *imgProp; INDIMenu *devMenu = ksw->getINDIMenu(); if (devMenu == NULL) return false; CCDCombo->clear(); for (uint i=0; i < devMenu->mgr.count(); i++) { for (uint j=0; j < devMenu->mgr.at(i)->indi_dev.count(); j++) { imgProp = devMenu->mgr.at(i)->indi_dev.at(j)->findProp("CCD_EXPOSE_DURATION"); if (!imgProp) continue; imgDeviceFound = true; if (devMenu->mgr.at(i)->indi_dev.at(j)->label.isEmpty()) devMenu->mgr.at(i)->indi_dev.at(j)->label = devMenu->mgr.at(i)->indi_dev.at(j)->name; CCDCombo->insertItem(devMenu->mgr.at(i)->indi_dev.at(j)->label); } } if (imgDeviceFound) { CCDCombo->setCurrentItem(lastCCD); currentCCD = CCDCombo->currentText(); } else return false; if (!verifyCCDIntegrity()) { stopSequence(); return false; } else { INDI_P *exposeProp; INDI_E *exposeElem; exposeProp = stdDevCCD->dp->findProp("CCD_EXPOSE_DURATION"); if (!exposeProp) { KMessageBox::error(this, i18n("Device does not support CCD_EXPOSE_DURATION property.")); return false; } exposeElem = exposeProp->findElement("EXPOSE_DURATION"); if (!exposeElem) { KMessageBox::error(this, i18n("CCD_EXPOSE_DURATION property is missing DURATION element.")); return false; } exposureIN->setValue(exposeElem->value); } return true; }
void Capture::captureImage() { if (currentCCD == NULL) return; seqTimer->stop(); if (activeJob == NULL) return; targetChip = activeJob->activeChip; if (targetChip->setFrame(activeJob->x, activeJob->y, activeJob->w, activeJob->h) == false) { appendLogText(i18n("Failed to set sub frame.")); activeJob->status = SequenceJob::JOB_ERROR; if (activeJob->preview == false) activeJob->statusCell->setText(SequenceJob::statusStrings[activeJob->status]); stopSequence(); return; } if (useGuideHead == false && targetChip->setBinning(activeJob->binX, activeJob->binY) == false) { appendLogText(i18n("Failed to set binning.")); activeJob->status = SequenceJob::JOB_ERROR; if (activeJob->preview == false) activeJob->statusCell->setText(SequenceJob::statusStrings[activeJob->status]); stopSequence(); return; } if (useGuideHead == false && darkSubCheck->isChecked() && calibrationState == CALIBRATE_NONE) { calibrationState = CALIBRATE_START; targetChip->setFrameType(FRAME_DARK); targetChip->setCaptureMode(FITS_CALIBRATE); appendLogText(i18n("Capturing dark frame...")); } else { if (useGuideHead == false) targetChip->setFrameType(frameTypeCombo->itemText(activeJob->frameType)); targetChip->setCaptureMode(FITS_NORMAL); targetChip->setCaptureFilter( (FITSScale) filterCombo->currentIndex()); appendLogText(i18n("Capturing image...")); } // If filter is different that CCD, send the filter info if (currentFilter && currentFilter != currentCCD) currentCCD->setFilter(FilterPosCombo->itemText(activeJob->filterPos-1)); targetChip->capture(seqExpose); }
void Capture::newFITS(IBLOB *bp) { ISD::CCDChip *tChip = NULL; if (!strcmp(bp->name, "CCD2")) tChip = currentCCD->getChip(ISD::CCDChip::GUIDE_CCD); else tChip = currentCCD->getChip(ISD::CCDChip::PRIMARY_CCD); if (tChip != targetChip) return; if (targetChip->getCaptureMode() == FITS_FOCUS || targetChip->getCaptureMode() == FITS_GUIDE) return; // If the FITS is not for our device, simply ignore if (QString(bp->bvp->device) != currentCCD->getDeviceName() || (startB->isEnabled() && previewB->isEnabled())) return; if (calibrationState == CALIBRATE_START) { calibrationState = CALIBRATE_DONE; seqTimer->start(seqDelay); return; } if (darkSubCheck->isChecked() && calibrationState == CALIBRATE_DONE) { calibrationState = CALIBRATE_NONE; FITSView *calibrateImage = targetChip->getImage(FITS_CALIBRATE); FITSView *currentImage = targetChip->getImage(FITS_NORMAL); FITSImage *image_data = currentImage->getImageData(); if (calibrateImage && currentImage) image_data->subtract(calibrateImage->getImageData()->getImageBuffer()); } if (seqTotalCount < 0) { jobs.removeOne(activeJob); delete (activeJob); activeJob = NULL; stopSequence(); return; } seqCurrentCount++; imgProgress->setValue(seqCurrentCount); appendLogText(i18n("Received image %1 out of %2.", seqCurrentCount, seqTotalCount)); currentImgCountOUT->setText( QString::number(seqCurrentCount)); // if we're done if (seqCurrentCount == seqTotalCount) { stopSequence(); activeJob->status = SequenceJob::JOB_DONE; activeJob->statusCell->setText(SequenceJob::statusStrings[activeJob->status]); jobCount--; if (jobCount > 0) { jobIndex++; SequenceJob *job = jobs.at(jobIndex); executeJob(job); } } else seqTimer->start(seqDelay); }