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
1 change: 1 addition & 0 deletions camerad/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ list (APPEND INTERFACE_SOURCES
add_library(${INTERFACE_TARGET} ${INTERFACE_SOURCES})
target_link_libraries(${INTERFACE_TARGET}
common
shared_memory_writer
)
target_include_directories(${INTERFACE_TARGET} PUBLIC ${INTERFACE_INCLUDES})

Expand Down
9 changes: 9 additions & 0 deletions camerad/archon_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1640,6 +1640,15 @@ namespace Camera {
logwrite(function, "applied mode geometry to controller");
}

for (const auto &[name, info] : mode->parammap) {
try {
this->set_parameter(name, std::stoi(info.value));
} catch (const std::exception &e) {
logwrite(function, "ERROR applying mode param "+name+"="+info.value+": "+e.what());
return ERROR;
}
}

return NO_ERROR;
}
/***** Camera::ArchonController::load_mode_settings *************************/
Expand Down
2 changes: 1 addition & 1 deletion camerad/archon_controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ namespace Camera {
std::atomic_flag archon_busy = ATOMIC_FLAG_INIT; //!< indicates a thread is accessing Archon
bool is_firmwareloaded;
std::string firmware;
bool is_camera_mode; //!< has a camera mode been selected
bool is_camera_mode{false}; //!< has a camera mode been selected
int msgref;
std::string backplaneversion;
std::vector<int> modtype; //!< type of each module from SYSTEM command
Expand Down
9 changes: 5 additions & 4 deletions camerad/archon_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -807,12 +807,13 @@ namespace Camera {

// if we made it all the way to the end then this is the selected mode
this->controller->selectedmode = modeselect;
this->controller->is_camera_mode = true;

// Set the exposure mode to match the camera mode name if recognized
if (this->set_exposure_mode(modeselect, {}) != NO_ERROR) {
// Fall back to SINGLE if the camera mode name doesn't match an exposure mode
this->set_exposure_mode(std::string(ArchonExposureMode::SINGLE), {});
std::string target = ArchonExposureMode::SINGLE;
for (const auto &m : this->get_exposure_modes()) {
if (m == modeselect) { target = modeselect; break; }
}
this->set_exposure_mode(target, {});

return NO_ERROR;
}
Expand Down
4 changes: 4 additions & 0 deletions camerad/camera_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ namespace Camera {

virtual long do_expose() = 0;

/** @brief returns true if cmd is an instrument-specific command
*/
virtual bool is_instrument_command(const std::string &cmd) { return false; }

/** @brief returns error if not overridden
*/
virtual long instrument_cmd(const std::string &cmd,
Expand Down
24 changes: 13 additions & 11 deletions camerad/camera_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,14 @@ namespace Camera {
}
ret = HELP;
}
/**
* instrument-specific commands
*/
else
if (interface->is_instrument_command(cmd))
{
ret = interface->instrument_cmd(cmd, args, retstring);
}
else
if ( cmd == CAMERAD_ABORT ) {
ret = interface->abort(args, retstring);
Expand Down Expand Up @@ -284,17 +292,7 @@ namespace Camera {
if ( cmd == CAMERAD_TEST ) {
ret = interface->test(args, retstring);
}
/**
* instrument-specific commands
*/
else
if ( cmd == "hispec_this" ) {
ret = interface->instrument_cmd(cmd, args, retstring);
}
else
if ( cmd == "hispec_that" ) {
ret = interface->instrument_cmd(cmd, args, retstring);
}

/**
* controller-specific commands
*/
Expand Down Expand Up @@ -326,6 +324,10 @@ namespace Camera {
if ( cmd == "bob" ) {
ret = interface->controller_cmd(cmd, args, retstring);
}
else
if ( cmd == "autofetch_mode" ) {
ret = interface->controller_cmd(cmd, args, retstring);
}

// unknown commands generate an error
//
Expand Down
14 changes: 7 additions & 7 deletions utils/timing_stats.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,15 @@ namespace Utils {
return (1.0e6 * sd) / (m * m);
}

[[nodiscard]] std::string summary() const {
[[nodiscard]] std::string summary(const std::string &label = "") const {
std::ostringstream ss;
ss << std::fixed << std::setprecision(1)
<< "median=" << median() << " us, "
<< "mean=" << mean() << " us, "
<< "jitter=" << jitter() << " us, "
ss << std::fixed << std::setprecision(1);
if (!label.empty()) ss << label << " ";
ss << "(n=" << count() << ")\n"
<< " median=" << median() << "us mean=" << mean() << "us\n"
<< " Jitter: peak2peak=" << jitter() << "us stddev=" << stddev() << "us\n"
<< std::setprecision(2)
<< hertz() << " +/- " << hertz_stddev() << " Hz"
<< " (n=" << count() << ")";
<< " Frequency: mean=" << hertz() << "Hz stddev=" << hertz_stddev() << "Hz";
return ss.str();
}

Expand Down
Loading