Changeset View
Changeset View
Standalone View
Standalone View
kstars/ekos/capture/sequencejob.cpp
Show All 27 Lines | |||||
28 | { | 28 | { | ||
29 | statusStrings = QStringList() << i18n("Idle") << i18n("In Progress") << i18n("Error") << i18n("Aborted") | 29 | statusStrings = QStringList() << i18n("Idle") << i18n("In Progress") << i18n("Error") << i18n("Aborted") | ||
30 | << i18n("Complete"); | 30 | << i18n("Complete"); | ||
31 | currentTemperature = targetTemperature = Ekos::INVALID_VALUE; | 31 | currentTemperature = targetTemperature = Ekos::INVALID_VALUE; | ||
32 | targetRotation = currentRotation = Ekos::INVALID_VALUE; | 32 | targetRotation = currentRotation = Ekos::INVALID_VALUE; | ||
33 | 33 | | |||
34 | prepareActions[ACTION_FILTER] = true; | 34 | prepareActions[ACTION_FILTER] = true; | ||
35 | prepareActions[ACTION_TEMPERATURE] = true; | 35 | prepareActions[ACTION_TEMPERATURE] = true; | ||
36 | //prepareActions[ACTION_POST_FOCUS] = true; | | |||
37 | prepareActions[ACTION_ROTATOR] = true; | 36 | prepareActions[ACTION_ROTATOR] = true; | ||
38 | } | 37 | } | ||
39 | 38 | | |||
40 | void SequenceJob::reset() | 39 | void SequenceJob::reset() | ||
41 | { | 40 | { | ||
42 | // Reset to default values | 41 | // Reset to default values | ||
43 | activeChip->setBatchMode(false); | 42 | activeChip->setBatchMode(false); | ||
44 | } | 43 | } | ||
Show All 26 Lines | 68 | { | |||
71 | 70 | | |||
72 | prepareReady = false; | 71 | prepareReady = false; | ||
73 | 72 | | |||
74 | // Reset all prepare actions | 73 | // Reset all prepare actions | ||
75 | setAllActionsReady(); | 74 | setAllActionsReady(); | ||
76 | 75 | | |||
77 | activeChip->setBatchMode(!preview); | 76 | activeChip->setBatchMode(!preview); | ||
78 | 77 | | |||
79 | if (localDirectory.isEmpty() == false) | | |||
80 | activeCCD->setFITSDir(localDirectory + directoryPostfix); | | |||
81 | | ||||
82 | activeCCD->setISOMode(timeStampPrefixEnabled); | | |||
83 | | ||||
84 | activeCCD->setSeqPrefix(fullPrefix); | | |||
85 | | ||||
86 | activeCCD->setUploadMode(uploadMode); | | |||
87 | | ||||
88 | // Set all custom properties | | |||
89 | //if (preview == false) | | |||
90 | //{ | | |||
91 | QMapIterator<QString, QMap<QString, double>> i(customProperties); | | |||
92 | while (i.hasNext()) | | |||
93 | { | | |||
94 | i.next(); | | |||
95 | INDI::Property *customProp = activeCCD->getProperty(i.key()); | | |||
96 | if (customProp) | | |||
97 | { | | |||
98 | QMap<QString, double> numbers = i.value(); | | |||
99 | QMapIterator<QString, double> j(numbers); | | |||
100 | INumberVectorProperty *np = customProp->getNumber(); | | |||
101 | while (j.hasNext()) | | |||
102 | { | | |||
103 | j.next(); | | |||
104 | INumber *oneNumber = IUFindNumber(np, j.key().toLatin1().data()); | | |||
105 | if (oneNumber) | | |||
106 | oneNumber->value = j.value(); | | |||
107 | } | | |||
108 | | ||||
109 | activeCCD->getDriverInfo()->getClientManager()->sendNewNumber(np); | | |||
110 | } | | |||
111 | } | | |||
112 | //} | | |||
113 | | ||||
114 | if (activeChip->isBatchMode() && remoteDirectory.isEmpty() == false) | | |||
115 | activeCCD->updateUploadSettings(remoteDirectory + directoryPostfix); | | |||
116 | | ||||
117 | if (isoIndex != -1) | | |||
118 | { | | |||
119 | if (isoIndex != activeChip->getISOIndex()) | | |||
120 | activeChip->setISOIndex(isoIndex); | | |||
121 | } | | |||
122 | | ||||
123 | if (gain != -1) | | |||
124 | { | | |||
125 | activeCCD->setGain(gain); | | |||
126 | } | | |||
127 | | ||||
128 | // Check if we need to change filter wheel | 78 | // Check if we need to change filter wheel | ||
129 | if (frameType == FRAME_LIGHT && targetFilter != -1 && activeFilter != nullptr) | 79 | if (frameType == FRAME_LIGHT && targetFilter != -1 && activeFilter != nullptr) | ||
130 | { | 80 | { | ||
131 | if (targetFilter == currentFilter) | 81 | if (targetFilter == currentFilter) | ||
132 | prepareActions[ACTION_FILTER] = true; | 82 | prepareActions[ACTION_FILTER] = true; | ||
133 | else | 83 | else | ||
134 | { | 84 | { | ||
135 | prepareActions[ACTION_FILTER] = false; | 85 | prepareActions[ACTION_FILTER] = false; | ||
▲ Show 20 Lines • Show All 128 Lines • ▼ Show 20 Line(s) | 212 | { | |||
264 | { | 214 | { | ||
265 | if (ready == false) | 215 | if (ready == false) | ||
266 | return false; | 216 | return false; | ||
267 | } | 217 | } | ||
268 | 218 | | |||
269 | return true; | 219 | return true; | ||
270 | } | 220 | } | ||
271 | 221 | | |||
272 | //SequenceJob::CAPTUREResult SequenceJob::capture(bool isDark) | | |||
273 | SequenceJob::CAPTUREResult SequenceJob::capture(bool noCaptureFilter) | 222 | SequenceJob::CAPTUREResult SequenceJob::capture(bool noCaptureFilter) | ||
274 | { | 223 | { | ||
275 | // If focusing is busy, return error | | |||
276 | //if (activeChip->getCaptureMode() == FITS_FOCUS) | | |||
277 | // return CAPTURE_FOCUS_ERROR; | | |||
278 | | ||||
279 | activeChip->setBatchMode(!preview); | 224 | activeChip->setBatchMode(!preview); | ||
280 | 225 | | |||
226 | if (localDirectory.isEmpty() == false) | ||||
227 | activeCCD->setFITSDir(localDirectory + directoryPostfix); | ||||
228 | | ||||
229 | activeCCD->setISOMode(timeStampPrefixEnabled); | ||||
230 | | ||||
231 | activeCCD->setSeqPrefix(fullPrefix); | ||||
232 | | ||||
233 | activeCCD->setUploadMode(uploadMode); | ||||
234 | | ||||
235 | QMapIterator<QString, QMap<QString, double>> i(customProperties); | ||||
236 | while (i.hasNext()) | ||||
237 | { | ||||
238 | i.next(); | ||||
239 | INDI::Property *customProp = activeCCD->getProperty(i.key()); | ||||
240 | if (customProp) | ||||
241 | { | ||||
242 | QMap<QString, double> numbers = i.value(); | ||||
243 | QMapIterator<QString, double> j(numbers); | ||||
244 | INumberVectorProperty *np = customProp->getNumber(); | ||||
245 | while (j.hasNext()) | ||||
246 | { | ||||
247 | j.next(); | ||||
248 | INumber *oneNumber = IUFindNumber(np, j.key().toLatin1().data()); | ||||
249 | if (oneNumber) | ||||
250 | oneNumber->value = j.value(); | ||||
251 | } | ||||
252 | | ||||
253 | activeCCD->getDriverInfo()->getClientManager()->sendNewNumber(np); | ||||
254 | } | ||||
255 | } | ||||
256 | | ||||
257 | if (activeChip->isBatchMode() && remoteDirectory.isEmpty() == false) | ||||
258 | activeCCD->updateUploadSettings(remoteDirectory + directoryPostfix); | ||||
259 | | ||||
260 | if (isoIndex != -1) | ||||
261 | { | ||||
262 | if (isoIndex != activeChip->getISOIndex()) | ||||
263 | activeChip->setISOIndex(isoIndex); | ||||
264 | } | ||||
265 | | ||||
266 | if (gain != -1) | ||||
267 | { | ||||
268 | activeCCD->setGain(gain); | ||||
269 | } | ||||
270 | | ||||
281 | if (targetFilter != -1 && activeFilter != nullptr) | 271 | if (targetFilter != -1 && activeFilter != nullptr) | ||
282 | { | 272 | { | ||
283 | if (targetFilter != currentFilter) | 273 | if (targetFilter != currentFilter) | ||
284 | { | 274 | { | ||
285 | //activeFilter->runCommand(INDI_SET_FILTER, &targetFilter); | | |||
286 | | ||||
287 | FilterManager::FilterPolicy policy = FilterManager::ALL_POLICIES; | 275 | FilterManager::FilterPolicy policy = FilterManager::ALL_POLICIES; | ||
288 | // Don't perform autofocus on preview | 276 | // Don't perform autofocus on preview | ||
289 | if (isPreview()) | 277 | if (isPreview()) | ||
290 | policy = static_cast<FilterManager::FilterPolicy>(policy & ~FilterManager::AUTOFOCUS_POLICY); | 278 | policy = static_cast<FilterManager::FilterPolicy>(policy & ~FilterManager::AUTOFOCUS_POLICY); | ||
291 | 279 | | |||
292 | filterManager->setFilterPosition(targetFilter, policy); | 280 | filterManager->setFilterPosition(targetFilter, policy); | ||
293 | return CAPTURE_FILTER_BUSY; | 281 | return CAPTURE_FILTER_BUSY; | ||
294 | } | 282 | } | ||
295 | } | 283 | } | ||
296 | 284 | | |||
297 | if (isoIndex != -1) | | |||
298 | { | | |||
299 | if (isoIndex != activeChip->getISOIndex()) | | |||
300 | activeChip->setISOIndex(isoIndex); | | |||
301 | } | | |||
302 | | ||||
303 | // Only attempt to set ROI and Binning if CCD transfer format is FITS | 285 | // Only attempt to set ROI and Binning if CCD transfer format is FITS | ||
304 | if (activeCCD->getTransferFormat() == ISD::CCD::FORMAT_FITS) | 286 | if (activeCCD->getTransferFormat() == ISD::CCD::FORMAT_FITS) | ||
305 | { | 287 | { | ||
306 | int currentBinX = 1, currentBinY = 1; | 288 | int currentBinX = 1, currentBinY = 1; | ||
307 | activeChip->getBinning(¤tBinX, ¤tBinY); | 289 | activeChip->getBinning(¤tBinX, ¤tBinY); | ||
308 | 290 | | |||
309 | // N.B. Always set binning _before_ setting frame because if the subframed image | 291 | // N.B. Always set binning _before_ setting frame because if the subframed image | ||
310 | // is problematic in 1x1 but works fine for 2x2, then it would fail it was set first | 292 | // is problematic in 1x1 but works fine for 2x2, then it would fail it was set first | ||
▲ Show 20 Lines • Show All 78 Lines • ▼ Show 20 Line(s) | |||||
389 | 371 | | |||
390 | void SequenceJob::setCurrentTemperature(double value) | 372 | void SequenceJob::setCurrentTemperature(double value) | ||
391 | { | 373 | { | ||
392 | currentTemperature = value; | 374 | currentTemperature = value; | ||
393 | 375 | | |||
394 | if (enforceTemperature == false || fabs(targetTemperature - currentTemperature) <= Options::maxTemperatureDiff()) | 376 | if (enforceTemperature == false || fabs(targetTemperature - currentTemperature) <= Options::maxTemperatureDiff()) | ||
395 | prepareActions[ACTION_TEMPERATURE] = true; | 377 | prepareActions[ACTION_TEMPERATURE] = true; | ||
396 | 378 | | |||
397 | //if (prepareReady == false && areActionsReady() && (status == JOB_IDLE || status == JOB_ABORTED)) | | |||
398 | if (prepareReady == false && areActionsReady()) | 379 | if (prepareReady == false && areActionsReady()) | ||
399 | { | 380 | { | ||
400 | prepareReady = true; | 381 | prepareReady = true; | ||
401 | emit prepareComplete(); | 382 | emit prepareComplete(); | ||
402 | } | 383 | } | ||
403 | } | 384 | } | ||
404 | 385 | | |||
405 | double SequenceJob::getTargetTemperature() const | 386 | double SequenceJob::getTargetTemperature() const | ||
▲ Show 20 Lines • Show All 175 Lines • ▼ Show 20 Line(s) | |||||
581 | 562 | | |||
582 | void SequenceJob::setCurrentFilter(int value) | 563 | void SequenceJob::setCurrentFilter(int value) | ||
583 | { | 564 | { | ||
584 | currentFilter = value; | 565 | currentFilter = value; | ||
585 | 566 | | |||
586 | if (currentFilter == targetFilter) | 567 | if (currentFilter == targetFilter) | ||
587 | prepareActions[ACTION_FILTER] = true; | 568 | prepareActions[ACTION_FILTER] = true; | ||
588 | 569 | | |||
589 | //if (prepareReady == false && areActionsReady() && (status == JOB_IDLE || status == JOB_ABORTED)) | | |||
590 | if (prepareReady == false && areActionsReady()) | 570 | if (prepareReady == false && areActionsReady()) | ||
591 | { | 571 | { | ||
592 | prepareReady = true; | 572 | prepareReady = true; | ||
593 | emit prepareComplete(); | 573 | emit prepareComplete(); | ||
594 | } | 574 | } | ||
595 | //else if (prepareActions[ACTION_FILTER] == true && prepareActions[ACTION_POST_FOCUS] == false) | | |||
596 | //emit checkFocus(); | | |||
597 | } | 575 | } | ||
598 | 576 | | |||
599 | void SequenceJob::setCurrentRotation(double value) | 577 | void SequenceJob::setCurrentRotation(double value) | ||
600 | { | 578 | { | ||
601 | currentRotation = value; | 579 | currentRotation = value; | ||
602 | 580 | | |||
603 | if (fabs(currentRotation - targetRotation) * 60 <= Options::astrometryRotatorThreshold()) | 581 | if (fabs(currentRotation - targetRotation) * 60 <= Options::astrometryRotatorThreshold()) | ||
604 | prepareActions[ACTION_ROTATOR] = true; | 582 | prepareActions[ACTION_ROTATOR] = true; | ||
605 | 583 | | |||
606 | //if (prepareReady == false && areActionsReady() && (status == JOB_IDLE || status == JOB_ABORTED)) | | |||
607 | if (prepareReady == false && areActionsReady()) | 584 | if (prepareReady == false && areActionsReady()) | ||
608 | { | 585 | { | ||
609 | prepareReady = true; | 586 | prepareReady = true; | ||
610 | emit prepareComplete(); | 587 | emit prepareComplete(); | ||
611 | } | 588 | } | ||
612 | 589 | | |||
613 | } | 590 | } | ||
614 | } | 591 | } |