Skip to content

Commit c4392f7

Browse files
authored
Merge pull request #20 from jwlodek/secure-starting-acq-when-temp-polling
Added some guards to prevent acquisition from starting while temperat…
2 parents 52b2e64 + d76b397 commit c4392f7

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

kinetixApp/src/ADKinetix.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,7 @@ void ADKinetix::monitorThread() {
704704
while (this->monitoringActive) {
705705
// Only check temp if not acquiring
706706
if (!this->acquisitionActive) {
707+
this->pollingTemperature = true;
707708
int16 temperature = 0;
708709
if (PV_OK != pl_get_param(this->cameraContext->hcam, PARAM_TEMP, ATTR_CURRENT,
709710
(void *)&temperature)) {
@@ -712,6 +713,7 @@ void ADKinetix::monitorThread() {
712713
setDoubleParam(KTX_Temperature, (double)(temperature / 100.0));
713714
callParamCallbacks();
714715
}
716+
this->pollingTemperature = false;
715717
}
716718

717719
epicsThreadSleep(1);
@@ -889,6 +891,10 @@ void ADKinetix::acquisitionThread() {
889891
const int16 circBuffMode = CIRC_OVERWRITE;
890892

891893
this->acquisitionActive = true;
894+
895+
// Spin in place a bit to make sure the temp thread is not actively polling the camera
896+
while (this->pollingTemperature);
897+
892898
INFO("Acquisition thread active.");
893899

894900
INFO("Resetting image counter...");

kinetixApp/src/ADKinetix.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ class ADKinetix : public ADDriver {
163163
NDDataType_t getCurrentNDBitDepth();
164164
CameraContext* cameraContext;
165165
bool acquisitionActive = false;
166+
bool pollingTemperature = false;
166167
bool monitoringActive = false;
167168
int deviceIndex;
168169
void* frameBuffer = nullptr;

0 commit comments

Comments
 (0)