diff --git a/sequencerd/sequence.cpp b/sequencerd/sequence.cpp index 8113affb..793d1e0a 100644 --- a/sequencerd/sequence.cpp +++ b/sequencerd/sequence.cpp @@ -669,6 +669,10 @@ namespace Sequencer { // These things can all be done in parallel, just have to sync up at the end. // + // latch repeat state before any worker starts + this->is_repeat_target.store( this->repeat_target() ); + if ( this->is_repeat_target.load() ) this->broadcast.notice( function, "repeat target" ); + // threads to start, pair their ThreadStatusBit with the function to call std::vector>> worker_threads; @@ -744,9 +748,9 @@ namespace Sequencer { break; } - // If not a calibration target then acquire, first acam then slicecam + // If not a calibration or repeat target then acquire, first acam then slicecam // - if ( !this->target.iscal ) { + if ( !this->target.iscal && !this->is_repeat_target.load() ) { // during acam acquisition, enable slicecam autoexpose to try to get the // exposure time set before fine acquisition starts. @@ -784,8 +788,9 @@ namespace Sequencer { if ( !this->target.iscal ) { // send offsets only on fineacquire, otherwise user needs to fix things - if ( this->is_fineacquire_locked.load() && - this->target_offset() == ERROR ) { + if ( !this->is_repeat_target.load() && + this->is_fineacquire_locked.load() && + this->target_offset() == ERROR ) { if (this->wait_for_user()==ABORT) { this->broadcast.notice( function, "cancelled" ); return; @@ -1047,10 +1052,7 @@ namespace Sequencer { case Sequencer::VSM_ACQUIRE: // uses virtual-mode width and offset for acquire, // but only for new targets - if ( this->target.ra_hms == this->last_ra_hms && - this->target.dec_dms == this->last_dec_dms ) { - return NO_ERROR; - } + if ( this->is_repeat_target.load() ) return NO_ERROR; slitcmd << this->slitwidthacquire << " " << this->slitoffsetacquire; modestr = "ACQUIRE"; break; @@ -2119,8 +2121,7 @@ namespace Sequencer { // No telescope move if target coordinates didn't change // - if ( this->target.ra_hms == this->last_ra_hms && - this->target.dec_dms == this->last_dec_dms ) { + if (repeat_target()) { this->broadcast.notice( function, "no move required for repeat target" ); return NO_ERROR; } @@ -4808,13 +4809,16 @@ namespace Sequencer { else // --------------------------------------------------------- - // clearlasttarget -- clear the last target name, allowing repointing + // clearlasttarget -- clear the last target info, allowing repointing // to the same target (otherwise move_to_target won't // repoint the telescope if the name is the same) // --------------------------------------------------------- // if ( testname == "clearlasttarget" ) { this->last_target=""; + this->last_ra_hms.clear(); + this->last_dec_dms.clear(); + this->is_repeat_target.store(false); error=NO_ERROR; } else diff --git a/sequencerd/sequence.h b/sequencerd/sequence.h index 30990eb0..340f5048 100644 --- a/sequencerd/sequence.h +++ b/sequencerd/sequence.h @@ -299,6 +299,7 @@ namespace Sequencer { std::atomic should_fineacquire{true}; ///< should I use fineacquire? (user-switchable) std::atomic is_fineacquire_locked{false}; ///< is slicecam fine acquisition locked? std::atomic is_fineacquire_running{false}; ///< is slicecam fine acquisition running? + std::atomic is_repeat_target{false}; ///< same coords as last target means no slew, no acquire std::atomic is_acam_guiding{false}; ///< is acam guiding (IS_ACQUIRED)? std::atomic is_acam_acquiring{false}; ///< is acam in an acquire mode? std::atomic acam_pubtime{0}; ///< publish time (us) of latest received acamd status @@ -326,6 +327,11 @@ namespace Sequencer { }).detach(); } + /** @brief if ra/dec of this target is the same as the last then it's a repeat + * @return true|false + */ + bool repeat_target() const { return ( target.ra_hms == last_ra_hms && + target.dec_dms == last_dec_dms ); } public: Sequence() : context(),