Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 15 additions & 11 deletions sequencerd/sequence.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::pair<Sequencer::ThreadStatusBits, std::function<long()>>> worker_threads;

Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions sequencerd/sequence.h
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ namespace Sequencer {
std::atomic<bool> should_fineacquire{true}; ///< should I use fineacquire? (user-switchable)
std::atomic<bool> is_fineacquire_locked{false}; ///< is slicecam fine acquisition locked?
std::atomic<bool> is_fineacquire_running{false}; ///< is slicecam fine acquisition running?
std::atomic<bool> is_repeat_target{false}; ///< same coords as last target means no slew, no acquire
std::atomic<bool> is_acam_guiding{false}; ///< is acam guiding (IS_ACQUIRED)?
std::atomic<bool> is_acam_acquiring{false}; ///< is acam in an acquire mode?
std::atomic<int64_t> acam_pubtime{0}; ///< publish time (us) of latest received acamd status
Expand Down Expand Up @@ -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(),
Expand Down
Loading