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"};
666 log<software_critical>({__FILE__,__LINE__});
677 log<text_log>(
"maxEMGain set to 1");
683 log<text_log>(
"maxEMGain set to 300");
776 return log<software_error,0>({__FILE__,__LINE__});
787 if(!
lock.owns_lock())
return 0;
815 log<software_error>({__FILE__, __LINE__});
822 log<software_error>({__FILE__, __LINE__});
829 log<software_error>({__FILE__, __LINE__});
836 log<software_error>({__FILE__, __LINE__});
866 log<software_error>({__FILE__, __LINE__});
871 log<software_error>({__FILE__, __LINE__});
876 log<software_error>({__FILE__, __LINE__});
893 log<software_error>({__FILE__, __LINE__});
898 log<software_error>({__FILE__, __LINE__});
930 char path[] =
"/usr/local/etc/andor/";
931 error = Initialize(path);
933 if(error == DRV_USBERROR || error == DRV_ERROR_NOCAMERA || error == DRV_VXDNOTINSTALLED)
946 else if(error!=DRV_SUCCESS)
948 log<software_critical>({__FILE__, __LINE__,
"ANDOR SDK initialization failed: " +
andorSDKErrorName(error)});
956 at_32 lNumCameras = 0;
957 error = GetAvailableCameras(&lNumCameras);
959 if(error != DRV_SUCCESS)
961 log<software_critical>({__FILE__, __LINE__,
"ANDOR SDK GetAvailableCameras failed: " +
andorSDKErrorName(error)});
975 int iSelectedCamera = 0;
977 int serialNumber = 0;
978 error = GetCameraSerialNumber(&serialNumber);
980 if(error != DRV_SUCCESS)
982 log<software_critical>({__FILE__, __LINE__,
"ANDOR SDK GetCameraSerialNumber failed: " +
andorSDKErrorName(error)});
986 log<text_log>(std::string(
"Found Andor USB Camera with serial number ") + std::to_string(serialNumber));
989 error = GetCameraHandle(iSelectedCamera, &lCameraHandle);
991 if(error != DRV_SUCCESS)
993 log<software_critical>({__FILE__, __LINE__,
"ANDOR SDK GetCameraHandle failed: " +
andorSDKErrorName(error)});
997 error = SetCurrentCamera(lCameraHandle);
999 if(error != DRV_SUCCESS)
1001 log<software_critical>({__FILE__, __LINE__,
"ANDOR SDK SetCurrentCamera failed: " +
andorSDKErrorName(error)});
1005 char name[MAX_PATH];
1007 error = GetHeadModel(name);
1008 if(error != DRV_SUCCESS)
1010 log<software_critical>({__FILE__, __LINE__,
"ANDOR SDK GetHeadModel failed: " +
andorSDKErrorName(error)});
1015 log<text_log>(std::string(
"Connected to ") + name +
" with serial number " + std::to_string(serialNumber));
1018 unsigned int cofFile;
1019 unsigned int vxdRev;
1020 unsigned int vxdVer;
1021 unsigned int dllRev;
1022 unsigned int dllVer;
1023 error = GetSoftwareVersion(&eprom, &cofFile, &vxdRev, &vxdVer, &dllRev, &dllVer);
1024 if(error != DRV_SUCCESS)
1026 log<software_critical>({__FILE__, __LINE__,
"ANDOR SDK GetSoftwareVersion failed: " +
andorSDKErrorName(error)});
1030 log<text_log>(std::string(
"eprom: ") + std::to_string(eprom));
1031 log<text_log>(std::string(
"cofFile: ") + std::to_string(cofFile));
1032 log<text_log>(std::string(
"vxd: ") + std::to_string(vxdVer) +
"." + std::to_string(vxdRev));
1033 log<text_log>(std::string(
"dll: ") + std::to_string(dllVer) +
"." + std::to_string(dllRev));
1036 unsigned int Decode;
1037 unsigned int dummy1;
1038 unsigned int dummy2;
1039 unsigned int CameraFirmwareVersion;
1040 unsigned int CameraFirmwareBuild;
1041 error = GetHardwareVersion(&PCB, &Decode, &dummy1, &dummy2, &CameraFirmwareVersion, &CameraFirmwareBuild);
1042 if(error != DRV_SUCCESS)
1044 log<software_critical>({__FILE__, __LINE__,
"ANDOR SDK GetHardwareVersion failed: " +
andorSDKErrorName(error)});
1048 log<text_log>(std::string(
"PCB: ") + std::to_string(PCB));
1049 log<text_log>(std::string(
"Decode: ") + std::to_string(Decode));
1050 log<text_log>(std::string(
"f/w: ") + std::to_string(CameraFirmwareVersion) +
"." + std::to_string(CameraFirmwareBuild));
1054 error=GetNumberHSSpeeds(0,0, &em_speeds);
1055 if(error != DRV_SUCCESS)
1060 std::cerr <<
"Number of EM HS speeds: " << em_speeds <<
"\n";
1061 for(
int i=0; i< em_speeds; ++i)
1064 error=GetHSSpeed(0,0,i, &speed);
1069 error=GetNumberHSSpeeds(0,1, &conv_speeds);
1070 if(error != DRV_SUCCESS)
1075 std::cerr <<
"Number of Conventional HS speeds: " << conv_speeds <<
"\n";
1076 for(
int i=0; i< conv_speeds; ++i)
1079 error=GetHSSpeed(0,1,i, &speed);
1085 error=GetNumberVSSpeeds(&v_speeds);
1086 if(error != DRV_SUCCESS)
1091 std::cerr <<
"Number of VS speeds: " << v_speeds <<
"\n";
1092 for(
int i=0; i< v_speeds; ++i)
1095 error=GetVSSpeed(i, &speed);
1105 error = SetShutter(1,ss,500,500);
1106 if(error != DRV_SUCCESS)
1108 log<software_critical>({__FILE__, __LINE__,
"ANDOR SDK SetShutter failed: " +
andorSDKErrorName(error)});
1113 error = SetCameraLinkMode(1);
1114 if(error != DRV_SUCCESS)
1116 log<software_critical>({__FILE__, __LINE__,
"ANDOR SDK SetCameraLinkMode failed: " +
andorSDKErrorName(error)});
1121 error = SetReadMode(4);
1122 if(error != DRV_SUCCESS)
1128 error = SetAcquisitionMode(5);
1129 if(error != DRV_SUCCESS)
1135 error = SetFrameTransferMode(1);
1136 if(error != DRV_SUCCESS)
1142 error = SetEMGainMode(3);
1143 if(error != DRV_SUCCESS)
1163 error = SetHSSpeed(newa,newhss);
1164 if(error != DRV_SUCCESS)
1180 error = SetVSSpeed(newvs);
1181 if(error != DRV_SUCCESS)
1190 error = SetOutputAmplifier(newa);
1191 if(error != DRV_SUCCESS)
1197 error = SetExposureTime(0.1);
1198 if(error != DRV_SUCCESS)
1207 if(error != DRV_SUCCESS)
1213 log<text_log>(
"enabled temperature control");
1217 GetNumberADChannels(&nc);
1218 std::cout <<
"NumberADChannels: " << nc <<
"\n";
1221 std::cout <<
"NumberAmp; " << nc <<
"\n";
1235 unsigned int status = GetTemperatureF(&temp);
1237 std::string cooling;
1240 case DRV_TEMPERATURE_OFF:
1245 case DRV_TEMPERATURE_STABILIZED:
1250 case DRV_TEMPERATURE_NOT_REACHED:
1255 case DRV_TEMPERATURE_NOT_STABILIZED:
1260 case DRV_TEMPERATURE_DRIFT:
1270 log<software_error>({__FILE__, __LINE__,
"ANDOR SDK GetTemperatureF:" +
andorSDKErrorName(status)});
1287 error = GetEMCCDGain(&gain);
1288 if( error !=DRV_SUCCESS)
1290 log<software_error>({__FILE__,__LINE__,
"Andor SDK error from GetEMCCDGain: " +
andorSDKErrorName(error)});
1294 if(gain == 0) gain = 1;
1324 unsigned int error = SetHSSpeed(newa,newhss);
1325 if(error != DRV_SUCCESS)
1333 error = SetOutputAmplifier(newa);
1334 if(error != DRV_SUCCESS)
1339 log<text_log>(
"Set readout speed to " +
m_readoutSpeedNameSet +
" (" + std::to_string(newa) +
"," + std::to_string(newhss) +
")");
1367 unsigned int error = SetVSSpeed(newvs);
1368 if(error != DRV_SUCCESS)
1374 log<text_log>(
"Set vertical shift speed to " +
m_vShiftSpeedNameSet +
" (" + std::to_string(newvs) +
")");
1396 log<text_log>(
"Attempt to set EM gain while in conventional amplifier.",
logPrio::LOG_NOTICE);
1402 if(emg == 1) emg = 0;
1416 unsigned int error = SetEMCCDGain(emg);
1417 if( error !=DRV_SUCCESS)
1419 log<software_error>({__FILE__,__LINE__,
"Andor SDK error from SetEMCCDGain: " +
andorSDKErrorName(error)});
1465 int error = SetShutter(1,2,500,500);
1466 if(error != DRV_SUCCESS)
1475 int error = SetShutter(1,1,500,500);
1476 if(error != DRV_SUCCESS)
1498 std::string configFile =
"/tmp/andor_";
1500 configFile +=
".cfg";
1503 fout.open(configFile);
1507 log<software_error>({__FILE__, __LINE__,
"error opening config file for writing"});
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";
1564 unsigned int error = CoolerON();
1565 if(error != DRV_SUCCESS)
1567 log<software_critical>({__FILE__, __LINE__,
"ANDOR SDK CoolerON failed: " +
andorSDKErrorName(error)});
1573 log<text_log>(
"enabled temperature control");
1578 unsigned int error = CoolerOFF();
1579 if(error != DRV_SUCCESS)
1581 log<software_critical>({__FILE__, __LINE__,
"ANDOR SDK CoolerOFF failed: " +
andorSDKErrorName(error)});
1587 log<text_log>(
"disabled temperature control");
1597 unsigned int error = SetTemperature(temp);
1599 if(error != DRV_SUCCESS)
1601 log<software_critical>({__FILE__, __LINE__,
"ANDOR SDK setTemperature failed: " +
andorSDKErrorName(error)});
1613 float accumCycletime;
1616 unsigned int error = GetAcquisitionTimings(&exptime, &accumCycletime, &kinCycletime);
1617 if(error != DRV_SUCCESS)
1625 error = GetReadOutTime(&readoutTime);
1626 if(error != DRV_SUCCESS)
1631 m_fps = 1.0/accumCycletime;
1645 if(error != DRV_SUCCESS)
1647 log<software_critical>({__FILE__, __LINE__,
"ANDOR SDK SetExposureTime failed: " +
andorSDKErrorName(error)});
1689 error = GetStatus(&status);
1690 if(error != DRV_SUCCESS)
1696 if(status != DRV_IDLE)
1710 if(error != DRV_SUCCESS)
1712 if(error == DRV_P2INVALID)
1716 else if(error == DRV_P3INVALID)
1720 else if(error == DRV_P4INVALID)
1724 else if(error == DRV_P5INVALID)
1728 else if(error == DRV_P6INVALID)
1730 log<text_log>(std::string(
"crop mode invalid x center: ") + std::to_string(
m_nextROI.x) +
"/" + std::to_string(x0),
logPrio::LOG_ERROR);
1732 else if(error == DRV_P7INVALID)
1734 log<text_log>(std::string(
"crop mode invalid y center: ") + std::to_string(
m_nextROI.y) +
"/" + std::to_string(y0),
logPrio::LOG_ERROR);
1738 log<software_error>({__FILE__, __LINE__,
"Andor SDK Error from SetIsolatedCropModeEx: " +
andorSDKErrorName(error)});
1755 error = SetIsolatedCropModeType(1);
1756 if(error != DRV_SUCCESS)
1758 log<software_error>({__FILE__, __LINE__,
"SetIsolatedCropModeType: " +
andorSDKErrorName(error)});
1766 if(error != DRV_SUCCESS)
1768 log<software_error>({__FILE__, __LINE__,
"SetIsolatedCropModeEx(0,): " +
andorSDKErrorName(error)});
1781 if(error != DRV_SUCCESS)
1783 if(error == DRV_P1INVALID)
1787 else if(error == DRV_P2INVALID)
1791 else if(error == DRV_P3INVALID)
1795 else if(error == DRV_P4INVALID)
1799 else if(error == DRV_P5INVALID)
1803 else if(error == DRV_P6INVALID)
1809 log<software_error>({__FILE__, __LINE__,
"Andor SDK Error from SetImage: " +
andorSDKErrorName(error)});
1883 error = GetStatus(&status);
1884 if(error != DRV_SUCCESS)
1890 if(status != DRV_IDLE)
1896 error = StartAcquisition();
1897 if(error != DRV_SUCCESS)
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.
int pdvAcquire(timespec &currImageTimestamp)
void setupConfig(mx::app::appConfigurator &config)
Setup the configuration system.
void loadConfig(mx::app::appConfigurator &config)
load the configuration system results
int onPowerOff()
Actions on power off.
int updateINDI()
The static callback function to be registered for the channel properties.
int pdvStartAcquisition()
int whilePowerOff()
Actions while powered off.
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.
void * loadImageIntoStreamCopy(void *dest, void *src, size_t width, size_t height, size_t szof)
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.
int updateINDI()
Update the INDI properties for this device controller.
int onPowerOff()
On power off, sets m_reconfig to true.
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.
int updateINDI()
Update the INDI properties for this device controller.
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
int whilePowerOff()
Actions while powered off.
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.
int onPowerOff()
Actions on power off.
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)
constexpr static logPrioT LOG_ERROR
An error has occured which the software will attempt to correct.
constexpr static logPrioT LOG_WARNING
A condition has occurred which may become an error, but the process continues.
constexpr static logPrioT LOG_NOTICE
A normal but significant condition.
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 appLogic()
Perform telemeter application logic.
int setupConfig(appConfigurator &config)
Setup an application configurator for the device section.
int checkRecordTimes(const telT &tel, telTs... tels)
Check the time of the last record for each telemetry type and make an entry if needed.
Software CRITICAL log entry.
Log entry recording stdcam stage specific status.
A simple text log, a string-type log.