12#include "../../libMagAOX/libMagAOX.hpp"
13#include "../../magaox_git_version.h"
27 return "DRV_ERROR_CODES";
30 case DRV_VXDNOTINSTALLED:
31 return "DRV_VXDNOTINSTALLED";
33 return "DRV_ERROR_SCAN";
34 case DRV_ERROR_CHECK_SUM:
35 return "DRV_ERROR_CHECK_SUM";
36 case DRV_ERROR_FILELOAD:
37 return "DRV_ERROR_FILELOAD";
38 case DRV_UNKNOWN_FUNCTION:
39 return "DRV_UNKNOWN_FUNCTION";
40 case DRV_ERROR_VXD_INIT:
41 return "DRV_ERROR_VXD_INIT";
42 case DRV_ERROR_ADDRESS:
43 return "DRV_ERROR_ADDRESS";
44 case DRV_ERROR_PAGELOCK:
45 return "DRV_ERROR_PAGELOCK";
46 case DRV_ERROR_PAGEUNLOCK:
47 return "DRV_ERROR_PAGEUNLOCK";
48 case DRV_ERROR_BOARDTEST:
49 return "DRV_ERROR_BOARDTEST";
51 return "DRV_ERROR_ACK";
52 case DRV_ERROR_UP_FIFO:
53 return "DRV_ERROR_UP_FIFO";
54 case DRV_ERROR_PATTERN:
55 return "DRV_ERROR_PATTERN";
56 case DRV_ACQUISITION_ERRORS:
57 return "DRV_ACQUISITION_ERRORS";
59 return "DRV_ACQ_BUFFER";
60 case DRV_ACQ_DOWNFIFO_FULL:
61 return "DRV_ACQ_DOWNFIFO_FULL";
62 case DRV_PROC_UNKONWN_INSTRUCTION:
63 return "DRV_PROC_UNKONWN_INSTRUCTION";
64 case DRV_ILLEGAL_OP_CODE:
65 return "DRV_ILLEGAL_OP_CODE";
66 case DRV_KINETIC_TIME_NOT_MET:
67 return "DRV_KINETIC_TIME_NOT_MET";
68 case DRV_ACCUM_TIME_NOT_MET:
69 return "DRV_ACCUM_TIME_NOT_MET";
71 return "DRV_NO_NEW_DATA";
73 return "DRV_SPOOLERROR";
74 case DRV_SPOOLSETUPERROR:
75 return "DRV_SPOOLSETUPERROR";
76 case DRV_FILESIZELIMITERROR:
77 return "DRV_FILESIZELIMITERROR";
78 case DRV_ERROR_FILESAVE:
79 return "DRV_ERROR_FILESAVE";
80 case DRV_TEMPERATURE_CODES:
81 return "DRV_TEMPERATURE_CODES";
82 case DRV_TEMPERATURE_OFF:
83 return "DRV_TEMPERATURE_OFF";
84 case DRV_TEMPERATURE_NOT_STABILIZED:
85 return "DRV_TEMPERATURE_NOT_STABILIZED";
86 case DRV_TEMPERATURE_STABILIZED:
87 return "DRV_TEMPERATURE_STABILIZED";
88 case DRV_TEMPERATURE_NOT_REACHED:
89 return "DRV_TEMPERATURE_NOT_REACHED";
90 case DRV_TEMPERATURE_OUT_RANGE:
91 return "DRV_TEMPERATURE_OUT_RANGE";
92 case DRV_TEMPERATURE_NOT_SUPPORTED:
93 return "DRV_TEMPERATURE_NOT_SUPPORTED";
94 case DRV_TEMPERATURE_DRIFT:
95 return "DRV_TEMPERATURE_DRIFT";
96 case DRV_GENERAL_ERRORS:
97 return "DRV_GENERAL_ERRORS";
99 return "DRV_INVALID_AUX";
100 case DRV_COF_NOTLOADED:
101 return "DRV_COF_NOTLOADED";
103 return "DRV_FPGAPROG";
105 return "DRV_FLEXERROR";
107 return "DRV_GPIBERROR";
108 case DRV_EEPROMVERSIONERROR:
109 return "DRV_EEPROMVERSIONERROR";
111 return "DRV_DATATYPE";
112 case DRV_DRIVER_ERRORS:
113 return "DRV_DRIVER_ERRORS";
115 return "DRV_P1INVALID";
117 return "DRV_P2INVALID";
119 return "DRV_P3INVALID";
121 return "DRV_P4INVALID";
123 return "DRV_INIERROR";
125 return "DRV_COFERROR";
127 return "DRV_ACQUIRING";
131 return "DRV_TEMPCYCLE";
132 case DRV_NOT_INITIALIZED:
133 return "DRV_NOT_INITIALIZED";
135 return "DRV_P5INVALID";
137 return "DRV_P6INVALID";
138 case DRV_INVALID_MODE:
139 return "DRV_INVALID_MODE";
140 case DRV_INVALID_FILTER:
141 return "DRV_INVALID_FILTER";
143 return "DRV_I2CERRORS";
144 case DRV_I2CDEVNOTFOUND:
145 return "DRV_I2CDEVNOTFOUND";
147 return "DRV_I2CTIMEOUT";
149 return "DRV_P7INVALID";
151 return "DRV_P8INVALID";
153 return "DRV_P9INVALID";
155 return "DRV_P10INVALID";
157 return "DRV_P11INVALID";
159 return "DRV_USBERROR";
161 return "DRV_IOCERROR";
162 case DRV_VRMVERSIONERROR:
163 return "DRV_VRMVERSIONERROR";
164 case DRV_GATESTEPERROR:
165 return "DRV_GATESTEPERROR";
166 case DRV_USB_INTERRUPT_ENDPOINT_ERROR:
167 return "DRV_USB_INTERRUPT_ENDPOINT_ERROR";
168 case DRV_RANDOM_TRACK_ERROR:
169 return "DRV_RANDOM_TRACK_ERROR";
170 case DRV_INVALID_TRIGGER_MODE:
171 return "DRV_INVALID_TRIGGER_MODE";
172 case DRV_LOAD_FIRMWARE_ERROR:
173 return "DRV_LOAD_FIRMWARE_ERROR";
174 case DRV_DIVIDE_BY_ZERO_ERROR:
175 return "DRV_DIVIDE_BY_ZERO_ERROR";
176 case DRV_INVALID_RINGEXPOSURES:
177 return "DRV_INVALID_RINGEXPOSURES";
178 case DRV_BINNING_ERROR:
179 return "DRV_BINNING_ERROR";
180 case DRV_INVALID_AMPLIFIER:
181 return "DRV_INVALID_AMPLIFIER";
182 case DRV_INVALID_COUNTCONVERT_MODE:
183 return "DRV_INVALID_COUNTCONVERT_MODE";
184 case DRV_USB_INTERRUPT_ENDPOINT_TIMEOUT:
185 return "DRV_USB_INTERRUPT_ENDPOINT_TIMEOUT";
186 case DRV_ERROR_NOCAMERA:
187 return "DRV_ERROR_NOCAMERA";
188 case DRV_NOT_SUPPORTED:
189 return "DRV_NOT_SUPPORTED";
190 case DRV_NOT_AVAILABLE:
191 return "DRV_NOT_AVAILABLE";
193 return "DRV_ERROR_MAP";
194 case DRV_ERROR_UNMAP:
195 return "DRV_ERROR_UNMAP";
197 return "DRV_ERROR_MDL";
198 case DRV_ERROR_UNMDL:
199 return "DRV_ERROR_UNMDL";
200 case DRV_ERROR_BUFFSIZE:
201 return "DRV_ERROR_BUFFSIZE";
202 case DRV_ERROR_NOHANDLE:
203 return "DRV_ERROR_NOHANDLE";
204 case DRV_GATING_NOT_AVAILABLE:
205 return "DRV_GATING_NOT_AVAILABLE";
206 case DRV_FPGA_VOLTAGE_ERROR:
207 return "DRV_FPGA_VOLTAGE_ERROR";
208 case DRV_OW_CMD_FAIL:
209 return "DRV_OW_CMD_FAIL";
210 case DRV_OWMEMORY_BAD_ADDR:
211 return "DRV_OWMEMORY_BAD_ADDR";
212 case DRV_OWCMD_NOT_AVAILABLE:
213 return "DRV_OWCMD_NOT_AVAILABLE";
214 case DRV_OW_NO_SLAVES:
215 return "DRV_OW_NO_SLAVES";
216 case DRV_OW_NOT_INITIALIZED:
217 return "DRV_OW_NOT_INITIALIZED";
218 case DRV_OW_ERROR_SLAVE_NUM:
219 return "DRV_OW_ERROR_SLAVE_NUM";
220 case DRV_MSTIMINGS_ERROR:
221 return "DRV_MSTIMINGS_ERROR";
222 case DRV_OA_NULL_ERROR:
223 return "DRV_OA_NULL_ERROR";
224 case DRV_OA_PARSE_DTD_ERROR:
225 return "DRV_OA_PARSE_DTD_ERROR";
226 case DRV_OA_DTD_VALIDATE_ERROR:
227 return "DRV_OA_DTD_VALIDATE_ERROR";
228 case DRV_OA_FILE_ACCESS_ERROR:
229 return "DRV_OA_FILE_ACCESS_ERROR";
230 case DRV_OA_FILE_DOES_NOT_EXIST:
231 return "DRV_OA_FILE_DOES_NOT_EXIST";
232 case DRV_OA_XML_INVALID_OR_NOT_FOUND_ERROR:
233 return "DRV_OA_XML_INVALID_OR_NOT_FOUND_ERROR";
234 case DRV_OA_PRESET_FILE_NOT_LOADED:
235 return "DRV_OA_PRESET_FILE_NOT_LOADED";
236 case DRV_OA_USER_FILE_NOT_LOADED:
237 return "DRV_OA_USER_FILE_NOT_LOADED";
238 case DRV_OA_PRESET_AND_USER_FILE_NOT_LOADED:
239 return "DRV_OA_PRESET_AND_USER_FILE_NOT_LOADED";
240 case DRV_OA_INVALID_FILE:
241 return "DRV_OA_INVALID_FILE";
242 case DRV_OA_FILE_HAS_BEEN_MODIFIED:
243 return "DRV_OA_FILE_HAS_BEEN_MODIFIED";
244 case DRV_OA_BUFFER_FULL:
245 return "DRV_OA_BUFFER_FULL";
246 case DRV_OA_INVALID_STRING_LENGTH:
247 return "DRV_OA_INVALID_STRING_LENGTH";
248 case DRV_OA_INVALID_CHARS_IN_NAME:
249 return "DRV_OA_INVALID_CHARS_IN_NAME";
250 case DRV_OA_INVALID_NAMING:
251 return "DRV_OA_INVALID_NAMING";
252 case DRV_OA_GET_CAMERA_ERROR:
253 return "DRV_OA_GET_CAMERA_ERROR";
254 case DRV_OA_MODE_ALREADY_EXISTS:
255 return "DRV_OA_MODE_ALREADY_EXISTS";
256 case DRV_OA_STRINGS_NOT_EQUAL:
257 return "DRV_OA_STRINGS_NOT_EQUAL";
258 case DRV_OA_NO_USER_DATA:
259 return "DRV_OA_NO_USER_DATA";
260 case DRV_OA_VALUE_NOT_SUPPORTED:
261 return "DRV_OA_VALUE_NOT_SUPPORTED";
262 case DRV_OA_MODE_DOES_NOT_EXIST:
263 return "DRV_OA_MODE_DOES_NOT_EXIST";
264 case DRV_OA_CAMERA_NOT_SUPPORTED:
265 return "DRV_OA_CAMERA_NOT_SUPPORTED";
266 case DRV_OA_FAILED_TO_GET_MODE:
267 return "DRV_OA_FAILED_TO_GET_MODE";
268 case DRV_OA_CAMERA_NOT_AVAILABLE:
269 return "DRV_OA_CAMERA_NOT_AVAILABLE";
270 case DRV_PROCESSING_FAILED:
271 return "DRV_PROCESSING_FAILED";
273 return "UNKNOWN: " + std::to_string(error);
279 const std::string & ron
282 if(ron ==
"ccd_00_08MHz")
287 else if(ron ==
"ccd_01MHz")
292 else if(ron ==
"ccd_03MHz")
297 else if(ron ==
"emccd_01MHz")
302 else if(ron ==
"emccd_05MHz")
307 else if(ron ==
"emccd_10MHz")
312 else if(ron ==
"emccd_17MHz")
326 const std::string & vssn,
336 else if(vssn ==
"0_5us")
342 else if(vssn ==
"0_9us")
348 else if(vssn ==
"1_7us")
354 else if(vssn ==
"3_3us")
601 m_readoutSpeedNames = {
"ccd_00_08MHz",
"ccd_01MHz",
"ccd_03MHz",
"emccd_01MHz",
"emccd_05MHz",
"emccd_10MHz",
"emccd_17MHz"};
602 m_readoutSpeedNameLabels = {
"CCD 0.08 MHz",
"CCD 1 MHz",
"CCD 3 MHz",
"EMCCD 1 MHz",
"EMCCD 5 MHz",
"EMCCD 10 MHz",
"EMCCD 17 MHz"};
787 if(!
lock.owns_lock())
return 0;
930 char path[] =
"/usr/local/etc/andor/";
1060 std::cerr <<
"Number of EM HS speeds: " <<
em_speeds <<
"\n";
1065 std::cerr <<
i <<
" " << speed <<
"\n";
1075 std::cerr <<
"Number of Conventional HS speeds: " <<
conv_speeds <<
"\n";
1080 std::cerr <<
i <<
" " << speed <<
"\n";
1091 std::cerr <<
"Number of VS speeds: " <<
v_speeds <<
"\n";
1096 std::cerr <<
i <<
" " << speed <<
"\n";
1218 std::cout <<
"NumberADChannels: " <<
nc <<
"\n";
1221 std::cout <<
"NumberAmp; " <<
nc <<
"\n";
1294 if(gain == 0) gain = 1;
1514 fout <<
"camera_class: \"Andor\"\n";
1515 fout <<
"camera_model: \"iXon Ultra 897\"\n";
1516 fout <<
"camera_info: \"512x512 (1-tap, freerun)\"\n";
1517 fout <<
"width: " << w <<
"\n";
1518 fout <<
"height: " << h <<
"\n";
1519 fout <<
"depth: 16\n";
1520 fout <<
"extdepth: 16\n";
1521 fout <<
"CL_DATA_PATH_NORM: 0f # single tap\n";
1522 fout <<
"CL_CFG_NORM: 02\n";
1938 if(
rv < 0)
return rv;
The base-class for MagAO-X applications.
void updateIfChanged(pcf::IndiProperty &p, const std::string &el, const T &newVal, pcf::IndiProperty::PropertyStateType ipState=pcf::IndiProperty::Ok)
Update an INDI property element value if it has changed.
stateCodes::stateCodeT state()
Get the current state code.
int powerState()
Returns the current power state.
int m_shutdown
Flag to signal it's time to shutdown. When not 0, the main loop exits.
int m_powerState
Current power state, 1=On, 0=Off, -1=Unk.
int powerStateTarget()
Returns the target power state.
void updateSwitchIfChanged(pcf::IndiProperty &p, const std::string &el, const pcf::IndiElement::SwitchStateType &newVal, pcf::IndiProperty::PropertyStateType ipState=pcf::IndiProperty::Ok)
Update an INDI switch element value if it has changed.
int stateLogged()
Updates and returns the value of m_stateLogged. Will be 0 on first call after a state change,...
static int log(const typename logT::messageT &msg, logPrioT level=logPrio::LOG_DEFAULT)
Make a log entry.
unsigned long m_powerOnWait
Time in sec to wait for device to boot after power on.
std::mutex m_indiMutex
Mutex for locking INDI communications.
std::string configName()
Get the config name.
int setTempSetPt()
Set the CCD temperature setpoint [stdCamera interface].
int configureAcquisition()
andorCtrl()
Default c'tor.
int checkNextROI()
Check the next ROI.
~andorCtrl() noexcept
Destructor.
static constexpr bool c_stdCamera_fps
app::dev config to tell stdCamera not to expose FPS status
virtual void setupConfig()
Setup the configuration system (called by MagAOXApp::setup())
virtual void loadConfig()
load the configuration system results (called by MagAOXApp::setup())
static constexpr bool c_stdCamera_temp
app::dev config to tell stdCamera to expose temperature
virtual int appShutdown()
Do any needed shutdown tasks. Currently nothing in this app.
int setReadoutSpeed()
Set the output amplifier and readout speed.
static constexpr bool c_stdCamera_usesStateString
app::dev confg to tell stdCamera to expose the state string property
virtual int whilePowerOff()
Implementation of the while-powered-off FSM.
int setTempControl()
Turn temperature control on or off.
static constexpr bool c_stdCamera_cropMode
app:dev config to tell stdCamera to expose Crop Mode controls
virtual int appLogic()
Implementation of the FSM for the Siglent SDG.
static constexpr bool c_stdCamera_exptimeCtrl
app::dev config to tell stdCamera to expose exposure time controls
static constexpr bool c_frameGrabber_flippable
app:dev config to tell framegrabber this camera can not be flipped
int setExpTime()
Required by stdCamera, but this does not do anything for this camera [stdCamera interface].
int setNextROI()
Required by stdCamera, but this does not do anything for this camera [stdCamera interface].
int setShutter(unsigned os)
int powerOnDefaults()
Set defaults for a power on state.
static constexpr bool c_stdCamera_usesROI
app:dev config to tell stdCamera to expose ROI controls
static constexpr bool c_stdCamera_readoutSpeed
app::dev config to tell stdCamera to expose readout speed controls
static constexpr bool c_stdCamera_vShiftSpeed
app:dev config to tell stdCamera to expose vertical shift speed control
int loadImageIntoStream(void *dest)
static constexpr bool c_stdCamera_emGain
app::dev config to tell stdCamera to expose EM gain controls
bool m_libInit
Whether or not the Andor SDK library is initialized.
virtual int appStartup()
Startup functions.
virtual int onPowerOff()
Implementation of the on-power-off FSM logic.
std::string m_configFile
The path, relative to configDir, where to write and read the temporary config file.
static constexpr bool c_edtCamera_relativeConfigPath
app::dev config to tell edtCamera to use absolute path to camera config file
static constexpr bool c_stdCamera_synchro
app::dev config to tell stdCamera to not expose synchro mode controls
static constexpr bool c_stdCamera_tempControl
app::dev config to tell stdCamera to expose temperature controls
static constexpr bool c_stdCamera_usesModes
app:dev config to tell stdCamera not to expose mode controls
static constexpr bool c_stdCamera_fpsCtrl
app::dev config to tell stdCamera to not expose FPS controls
int recordTelem(const telem_stdcam *)
int acquireAndCheckValid()
int setVShiftSpeed()
Set the vertical shift speed.
static constexpr bool c_stdCamera_hasShutter
app:dev config to tell stdCamera to expose shutter controls
MagAO-X EDT framegrabber interface.
u_char * m_image_p
The image data grabbed.
void setupConfig(mx::app::appConfigurator &config)
Setup the configuration system.
void loadConfig(mx::app::appConfigurator &config)
load the configuration system results
timespec m_currImageTimestamp
The timestamp of the current image.
uint32_t m_width
The width of the image, once deinterlaced etc.
int appShutdown()
Shuts down the framegrabber thread.
int loadConfig(mx::app::appConfigurator &config)
load the configuration system results
size_t m_typeSize
The size of the type, in bytes. Result of sizeof.
uint8_t m_dataType
The ImageStreamIO type code.
bool m_reconfig
Flag to set if a camera reconfiguration requires a framegrabber reset.
uint32_t m_height
The height of the image, once deinterlaced etc.
int setupConfig(mx::app::appConfigurator &config)
Setup the configuration system.
MagAO-X standard camera interface.
float m_maxEMGain
The configurable maximum EM gain. To be enforced in derivedT.
std::vector< std::string > m_readoutSpeedNames
pcf::IndiProperty m_indiP_roi_y
Property used to set the ROI x center coordinate.
float m_default_x
Power-on ROI center x coordinate.
std::string m_tempControlStatusStr
Camera specific description of temperature control status.
float m_emGain
The camera's current EM gain (if available).
std::vector< std::string > m_readoutSpeedNameLabels
int m_full_w
The full ROI width.
float m_emGainSet
The camera's EM gain, as set by the user.
std::string m_vShiftSpeedNameSet
The user requested vshift speed name, to be set by derived()
bool m_cropModeSet
Desired status of crop mode ROIs, if enabled for this camera.
std::string m_defaultReadoutSpeed
The default readout speed of the camera.
float m_expTime
The current exposure time, in seconds.
std::string m_nextMode
The mode to be set by the next reconfiguration.
int m_default_bin_x
Power-on ROI x binning.
int m_default_w
Power-on ROI width.
int recordCamera(bool force=false)
bool m_cropMode
Status of crop mode ROIs, if enabled for this camera.
int m_default_h
Power-on ROI height.
float m_expTimeSet
The exposure time, in seconds, as set by user.
pcf::IndiProperty m_indiP_roi_h
Property used to set the ROI height.
void setupConfig(mx::app::appConfigurator &config)
Setup the configuration system.
int m_full_h
The full ROI height.
float m_full_y
The full ROI center y coordinate.
std::string m_readoutSpeedName
The current readout speed name.
float m_ccdTempSetpt
The desired temperature, in C.
bool m_tempControlStatus
Whether or not temperature control is active.
pcf::IndiProperty m_indiP_roi_w
Property used to set the ROI width.
std::string m_modeName
The current mode name.
pcf::IndiProperty m_indiP_roi_bin_x
Property used to set the ROI x binning.
std::string m_startupMode
The camera mode to load during first init after a power-on.
float m_full_x
The full ROI center x coordinate.
float m_startupTemp
The temperature to set after a power-on. Set to <= -999 to not use [default].
std::string m_shutterStatus
std::string m_vShiftSpeedName
The current vshift speed name.
float m_ccdTemp
The current temperature, in C.
std::vector< std::string > m_vShiftSpeedNames
std::string m_defaultVShiftSpeed
The default readout speed of the camera.
bool m_tempControlOnTarget
Whether or not the temperature control system is on its target temperature.
cameraConfigMap m_cameraModes
Map holding the possible camera mode configurations.
void loadConfig(mx::app::appConfigurator &config)
load the configuration system results
std::vector< std::string > m_vShiftSpeedNameLabels
pcf::IndiProperty m_indiP_roi_set
Property used to trigger setting the ROI.
float m_default_y
Power-on ROI center y coordinate.
float m_fps
The current FPS.
pcf::IndiProperty m_indiP_roi_bin_y
Property used to set the ROI y binning.
pcf::IndiProperty m_indiP_roi_x
Property used to set the ROI x center coordinate.
int m_default_bin_y
Power-on ROI y binning.
bool m_tempControlStatusSet
Desired state of temperature control.
std::string m_readoutSpeedNameSet
The user requested readout speed name, to be set by derived()
@ OPERATING
The device is operating, other than homing.
@ NODEVICE
No device exists for the application to control.
@ CONFIGURING
The application is configuring the device.
@ ERROR
The application has encountered an error, from which it is recovering (with or without intervention)
@ READY
The device is ready for operation, but is not operating.
@ CONNECTED
The application has connected to the device or service.
@ NOTCONNECTED
The application is not connected to the device or service.
@ POWERON
The device power is on.
int readoutParams(int &newa, int &newhss, const std::string &ron)
int vshiftParams(int &newvs, const std::string &vssn, float &vs)
std::string andorSDKErrorName(unsigned int error)
std::unique_lock< std::mutex > lock(m_indiMutex)
static constexpr logPrioT LOG_NOTICE
A normal but significant condition.
static constexpr logPrioT LOG_WARNING
A condition has occurred which may become an error, but the process continues.
static constexpr logPrioT LOG_ERROR
An error has occured which the software will attempt to correct.
A device base class which saves telemetry.
int appShutdown()
Perform telemeter application shutdown.
int loadConfig(appConfigurator &config)
Load the device section from an application configurator.
int setupConfig(appConfigurator &config)
Setup an application configurator for the device section.
Software CRITICAL log entry.
Log entry recording stdcam stage specific status.
A simple text log, a string-type log.