Skip to content
Open
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
58 changes: 58 additions & 0 deletions camerad/archon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ namespace Archon {
this->is_longexposure_set = false;
this->is_window = false;
this->is_autofetch = false;
this->is_freerun = false;
this->is_zmq = false;
this->win_hstart = 0;
this->win_hstop = 2047;
Expand Down Expand Up @@ -4421,6 +4422,63 @@ long Interface::archon_cmd(std::string cmd, std::string &reply) {
}
/**************** Archon::Interface::autofetch *******************************/

/**************** Archon::Interface::set_freerun *******************************/
/**
* @fn set_freerun
* @brief turns freerun mode on and off
* @param set_state, string "TRUE, FALSE, 0, or 1"
* @return ERROR or NO_ERROR
*
* NOTE: Manipulates EXPOSE and Start Params and reloads acf file
*/
long Interface::set_freerun(std::string set_state){
//Iniciate variables and messages for logs
std::string function = "Archon::Interface::set_freerun";
std::stringstream message;
long error = NO_ERROR;
// If something is passed then try to use it to set the "freerun" state
//
if ( !set_state.empty() ) {
try {
std::transform( set_state.begin(), set_state.end(), set_state.begin(), ::toupper ); // make uppercase
std::string expose_param = "Expose";
std::string start_param = "Start";
long new_state;
if (set_state == "TRUE" || set_state == "1") {
//set expose and start on the archon or acf to 1
new_state = 1;
error = this->set_parameter( expose_param, new_state);
if ( error == NO_ERROR ) error = this->set_parameter( start_param, new_state);
//log
this->is_freerun = true;

}
else {
//set expose and start on acf or archon to 0
new_state = 0;
error = this->set_parameter( expose_param, new_state);
if ( error == NO_ERROR ) error = this->set_parameter( start_param, new_state);

//log
this->is_freerun = false;
}
}
catch (...) {
message.str(""); message << "unknown exception converting freerun state " << set_state << " to uppercase";
this->camera.log_error( function, message.str() );
return ERROR;
}
}
if (error != NO_ERROR) {
message.str(""); message << "setting freerun state to " << set_state;
this->camera.log_error( function, message.str() );
return ERROR;
}

return (error);
}
/**************** Archon::Interface::set_freerun *******************************/

/**************** Archon::Interface::zmq ******************************/
/**
* @fn zmq
Expand Down
3 changes: 3 additions & 0 deletions camerad/archon.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ namespace Archon {
bool is_longexposure_set; //!< true for long exposure mode (exptime in sec), false for exptime in msec
bool is_window; //!< true if in window mode for h2rg, false if not
bool is_autofetch;
bool is_freerun;
bool is_zmq;
int win_hstart;
int win_hstop;
Expand Down Expand Up @@ -281,6 +282,8 @@ namespace Archon {

long autofetch(std::string state_in, std::string &state_out);

long set_freerun(std::string set_state);

long zmq(std::string state_in, std::string &state_out);

long int write_to_zmq(const std::string& message);
Expand Down
11 changes: 9 additions & 2 deletions camerad/camerad.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -628,8 +628,15 @@ void doit(Network::TcpSocket sock) {
} else if (cmd == "abort") {
server.camera.abort();
ret = 0;
}
#ifdef ASTROCAM
} //else if (cmd == "freerun") {
// server.
// TODO:: Add manipulating start = 1, expose = 1 and possibly mode_VideoRX to autofetch and non stop running
// Make start to 0 will stop the autofetch
// GOAL: Be able to turn auto fetch on and off dynamically.
// Must fetch very fast for tracking camera to grab
//}

#ifdef ASTROCAM
else
if (cmd=="isopen") {
ret = server.is_connected( retstring );
Expand Down