@@ -231,7 +231,7 @@ void ADXSPD::acquisitionThread() {
231231
232232 getIntegerParam (NDDataType, (int *) &dataType);
233233
234- // For reason's I don't fully understand, casting the dims address pointers to int*
234+ // For reasons I don't fully understand, casting the dims address pointers to int*
235235 // causes them to be populated with really odd values...
236236 size_t dims[2 ];
237237 int sizeX, sizeY;
@@ -395,31 +395,38 @@ void ADXSPD::monitorThread() {
395395 pollInterval = ADXSPD_MIN_STATUS_POLL_INTERVAL;
396396
397397 this ->lock ();
398- XSPD::Status status = this ->pDetector ->GetVar <XSPD::Status>(" status" );
399- int adStatus = ADStatusIdle;
400- switch (status) {
401- case XSPD::Status::READY:
402- break ;
403- case XSPD::Status::BUSY:
404- adStatus = ADStatusAcquire;
405- break ;
406- case XSPD::Status::CONNECTED:
407- adStatus = ADStatusInitializing;
408- break ;
409- default :
410- WARN (" Detector status: UNKNOWN" );
411- break ;
412- }
413- setIntegerParam (ADStatus, adStatus);
414398
415- setIntegerParam (ADXSPD_FramesQueued,
416- this ->pDetector ->GetActiveDataPort ()->GetVar <int >(" frames_queued" ));
399+ try {
400+ XSPD::Status status = this ->pDetector ->GetVar <XSPD::Status>(" status" );
401+ int adStatus = ADStatusIdle;
402+ switch (status) {
403+ case XSPD::Status::READY:
404+ break ;
405+ case XSPD::Status::BUSY:
406+ adStatus = ADStatusAcquire;
407+ break ;
408+ case XSPD::Status::CONNECTED:
409+ adStatus = ADStatusInitializing;
410+ break ;
411+ default :
412+ WARN (" Detector status: UNKNOWN" );
413+ break ;
414+ }
415+ setIntegerParam (ADStatus, adStatus);
416+
417+ setIntegerParam (ADXSPD_FramesQueued,
418+ this ->pDetector ->GetActiveDataPort ()->GetVar <int >(" frames_queued" ));
419+
420+ // Reading out module status takes too long. Probably should become a "GetModuleStatus"
421+ // PV that can have its Scan rate updated from I/O Intr to some rate.
422+ // for (auto& module : this->modules) {
423+ // module->checkStatus();
424+ // }
425+ } catch (std::runtime_error& e) {
426+ ERR_TO_STATUS (" Failed to update detector status: %s" , e.what ());
427+ setIntegerParam (ADStatus, ADStatusError);
428+ }
417429
418- // Reading out module status takes too long. Probably should become a "GetModuleStatus"
419- // PV that can have its Scan rate updated from I/O Intr to some rate.
420- // for (auto& module : this->modules) {
421- // module->checkStatus();
422- // }
423430 this ->unlock ();
424431
425432 if (epicsEventWaitWithTimeout (this ->shutdownEventId , pollInterval) == epicsEventWaitOK) {
0 commit comments