From 4bc89278fec458a097c575de1e3417dea0b2cd55 Mon Sep 17 00:00:00 2001 From: marcofilho Date: Mon, 26 Aug 2024 15:20:29 +0200 Subject: [PATCH 1/2] Update makefile Makefile was using old e3 directives. I copied the makefile from the recipe. --- ADOrca.Makefile | 122 +++++++----------------------------------------- 1 file changed, 16 insertions(+), 106 deletions(-) diff --git a/ADOrca.Makefile b/ADOrca.Makefile index 9bee891..4c1e99b 100644 --- a/ADOrca.Makefile +++ b/ADOrca.Makefile @@ -22,136 +22,46 @@ where_am_I := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) include $(E3_REQUIRE_TOOLS)/driver.makefile -ifneq ($(strip $(ADCORE_DEP_VERSION)),) -adcore_VERSION=$(ADCORE_DEP_VERSION) -endif - -ifneq ($(strip $(BUSY_DEP_VERSION)),) -busy_VERSION=$(BUSY_DEP_VERSION) -endif - -############################################################################ -# -# Add any required modules here that come from startup scripts, etc. -# -############################################################################ - REQUIRED += adcore REQUIRED += busy -REQUIRED += seq - - -############################################################################ -# -# If you want to exclude any architectures: -# -############################################################################ EXCLUDE_ARCHS += linux-ppc64e6500 - -############################################################################ -# -# Relevant directories to point to files -# -############################################################################ - -APP := ADOrcaApp +APP := ADOrcaApp APPDB := $(APP)/Db APPSRC := $(APP)/src APPCMDS := $(APP)/cmds -############################################################################ -# -# Add any files that should be copied to $(module)/Db -# -############################################################################ +SUPPORT:= support/dcamsdk4/lib/linux-x86_64 -# TEMPLATES += $(wildcard $(APPDB)/*.db) +TEMPLATES += $(wildcard $(APPDB)/*.db) TEMPLATES += $(wildcard $(ADCORE_DIR)/*.db) +TEMPLATES += $(wildcard $(APPDB)/*.template) -# USR_INCLUDES += -I$(where_am_I)$(APPSRC) -# USR_INCLUDES += -I $(E3_ADCORE_LOCATION)/ADCore/ADApp/ADSrc -# USR_INCLUDES += -I $(E3_ASYN_LOCATION)/asyn/interfaces -# USR_INCLUDES += -I $(E3_ASYN_LOCATION)/asyn/asynDriver -# USR_INCLUDES += -I $(E3_ASYN_LOCATION)/asyn/asynPortDriver - -# USR_INCLUDES += -DLINUX -I/home/iocuser/dcamsdk4/inc/ USR_INCLUDES += -DLINUX -I ../support/dcamsdk4/inc/ -# USR_INCLUDES += -I ../support/dcamsdk4/misc/ -############################################################################ -# -# Add any files that need to be compiled (e.g. .c, .cpp, .st, .stt) -# -############################################################################ - -# SOURCES += $(APPSRC)/ADOrcaMain.cpp SOURCES += $(APPSRC)/orca.cpp -# SOURCES += support/dcamsdk4/misc/common.cpp - -############################################################################ -# -# Add any .dbd files that should be included (e.g. from user-defined functions, etc.) -# -############################################################################ - -DBDS += $(APPSRC)/orca.dbd - - -############################################################################ -# -# Add any header files that should be included in the install (e.g. -# StreamDevice or asyn header files that are used by other modules) -# -############################################################################ - -# HEADERS += /home/iocuser/dcamsdk4/inc - - -############################################################################ -# -# Add any startup scripts that should be installed in the base directory -# -############################################################################ - +DBDS += $(APPSRC)/orca.dbd SCRIPTS += $(wildcard iocsh/*.iocsh) - - -############################################################################ -# -# If you have any .substitution files, and template files, add them here. -# -############################################################################ - -# SUBS=$(wildcard $(APPDB)/*.substitutions) TMPS=$(wildcard $(APPDB)/*.template) +USR_LDFLAGS += -L$(PREFIX)/lib/ -ldcamapi +LIB_SYS_LIBS += dcamapi + +VENDOR_LIBS += $(SUPPORT)/libdcamapi.so.4 +VENDOR_LIBS += $(SUPPORT)/libdcamapi.so.4.0.6269 +VENDOR_LIBS += $(SUPPORT)/libdcamapi.so + USR_DBFLAGS += -I . -I .. USR_DBFLAGS += -I $(E3_ADCORE_LOCATION)/db USR_DBFLAGS += -I $(EPICS_BASE)/db USR_DBFLAGS += -I $(APPDB) -USR_LDFLAGS += -L$(PWD)/support/dcamsdk4/lib/linux-x86_64 -ldcamapi -#USR_LDFLAGS += -L/usr/local/lib -ldcamapi +vlibs: $(VENDOR_LIBS) -db: $(SUBS) $(TMPS) +$(VENDOR_LIBS): + $(QUIET) install -m 755 $@ $(PREFIX)/lib/ -$(SUBS): - @printf "Inflating database ... %44s >>> %40s \n" "$@" "$(basename $(@)).db" - @rm -f $(basename $(@)).db.d $(basename $(@)).db - @$(MSI) -D $(USR_DBFLAGS) -o $(basename $(@)).db -S $@ > $(basename $(@)).db.d - @$(MSI) $(USR_DBFLAGS) -o $(basename $(@)).db -S $@ - -$(TMPS): - @printf "Inflating database ... %44s >>> %40s \n" "$@" "$(basename $(@)).db" - @rm -f $(basename $(@)).db.d $(basename $(@)).db - @$(MSI) -D $(USR_DBFLAGS) -o $(basename $(@)).db $@ > $(basename $(@)).db.d - @$(MSI) $(USR_DBFLAGS) -o $(basename $(@)).db $@ - -.PHONY: db $(SUBS) $(TMPS) +.PHONY: $(VENDOR_LIBS) vlibs -vlibs: - -.PHONY: vlibs From 634c3b12baf893fad366fc62cda2f6c1afa72863 Mon Sep 17 00:00:00 2001 From: marcofilho Date: Mon, 26 Aug 2024 16:17:55 +0200 Subject: [PATCH 2/2] Fix false warning raise. Fix concurrency problem. Before this commit, if acquisition was aborted by user before the imagetask had passed through the conditional `if ((epicsTimeDiffInSeconds(¤tAcqTime, &prevAcqTime) > maxAcqusitionTime)`, condition would evaluate to true and raise a warning saying that the acquisition timed out, which is not true. After this, condition evaluates to false and no alarm is raised. Tested several acquisitions and this does not seem to compromise the control flow. It seems to work both with internal and with external triggers. --- ADOrcaApp/src/orca.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ADOrcaApp/src/orca.cpp b/ADOrcaApp/src/orca.cpp index 004243f..63fb45e 100644 --- a/ADOrcaApp/src/orca.cpp +++ b/ADOrcaApp/src/orca.cpp @@ -779,6 +779,7 @@ void Orca::imageTask(){ int evr_counts_since_last_start = 0; int evr_counts_since_last_start_previous = 0; int evr_trigger_dropped = 0; + int acqStatus; uint64_t prevAcquisitionCount = 0; DCAMCAP_TRANSFERINFO captransferinfo; epicsTimeStamp prevAcqTime, currentAcqTime; @@ -929,10 +930,12 @@ void Orca::imageTask(){ getDoubleParam(ADAcquirePeriod, &acqusitionRate); + getIntegerParam(ADStatus, &acqStatus); maxAcqusitionTime = acqusitionRate * 2; epicsTimeGetCurrent(¤tAcqTime); - if (epicsTimeDiffInSeconds(¤tAcqTime, &prevAcqTime) > maxAcqusitionTime) { - printf("[DEBUG]::maxAcqusitionTime %f\n", maxAcqusitionTime); + if ((epicsTimeDiffInSeconds(¤tAcqTime, &prevAcqTime) > maxAcqusitionTime) && + acqStatus != ADStatusAborted) { + printf("[DEBUG]::maxAcqusitionTime %f\n", maxAcqusitionTime); setShutter(0); stopAcquire(); setIntegerParam(ADAcquire, 0);