From 861e442bf22f0265d1412d1f44b5124d83b6565f Mon Sep 17 00:00:00 2001 From: Oksana Ivashkevych Date: Wed, 15 Jun 2022 16:00:46 -0400 Subject: [PATCH 1/6] Adding save/restore and iocStats configurable options --- configure/EXAMPLE_RELEASE.local | 10 ++++++++++ iocs/smarActIOC/iocBoot/iocSmarAct/AutoSave.cmd | 8 ++++++++ iocs/smarActIOC/iocBoot/iocSmarAct/auto_settings.req | 12 ++++++++++++ iocs/smarActIOC/iocBoot/iocSmarAct/st.cmd | 11 +++++++++++ iocs/smarActIOC/smarActApp/Db/Makefile | 4 +++- iocs/smarActIOC/smarActApp/src/Makefile | 8 ++++++++ 6 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 iocs/smarActIOC/iocBoot/iocSmarAct/AutoSave.cmd create mode 100644 iocs/smarActIOC/iocBoot/iocSmarAct/auto_settings.req diff --git a/configure/EXAMPLE_RELEASE.local b/configure/EXAMPLE_RELEASE.local index 4b27f08..1b3ca25 100644 --- a/configure/EXAMPLE_RELEASE.local +++ b/configure/EXAMPLE_RELEASE.local @@ -1,4 +1,14 @@ +# define all modules if building outside motor +SUPPORT= +ASYN=$(SUPPORT)/asyn +BUSY=$(SUPPORT)/busy +IPAC=$(SUPPORT)/ipac +#optional DEVIOCSTATS, AUTOSAVE +DEVIOCSTATS=$(SUPPORT)/iocStats +AUTOSAVE=$(SUPPORT)/autosave + MOTOR= -include $(MOTOR)/modules/RELEASE.$(EPICS_HOST_ARCH).local # path to motorSmarAct is needed to build the IOC inside motorSmarAct, but outside motor MOTOR_SMARACT= +EPICS_BASE= diff --git a/iocs/smarActIOC/iocBoot/iocSmarAct/AutoSave.cmd b/iocs/smarActIOC/iocBoot/iocSmarAct/AutoSave.cmd new file mode 100644 index 0000000..20d89c0 --- /dev/null +++ b/iocs/smarActIOC/iocBoot/iocSmarAct/AutoSave.cmd @@ -0,0 +1,8 @@ +set_requestfile_path("./") +set_requestfile_path("$(MOTOR)/motorApp/Db") +set_savefile_path("./autosave") +set_pass0_restoreFile("auto_settings.sav") +set_pass1_restoreFile("auto_settings.sav") +save_restoreSet_status_prefix("$(PREFIX)") +dbLoadRecords("$(AUTOSAVE)/asApp/Db/save_restoreStatus.db", "P=$(PREFIX)") + diff --git a/iocs/smarActIOC/iocBoot/iocSmarAct/auto_settings.req b/iocs/smarActIOC/iocBoot/iocSmarAct/auto_settings.req new file mode 100644 index 0000000..c22765d --- /dev/null +++ b/iocs/smarActIOC/iocBoot/iocSmarAct/auto_settings.req @@ -0,0 +1,12 @@ +file "asyn_motor_positions.req", P=$(P), M={Det:LensA-Ax:X}Mtr +file "asyn_motor_positions.req", P=$(P), M={Det:LensA-Ax:Y}Mtr +file "asyn_motor_positions.req", P=$(P), M={Det:LensA-Ax:Z}Mtr +file "asyn_motor_positions.req", P=$(P), M={Det:LensB-Ax:X}Mtr +file "asyn_motor_positions.req", P=$(P), M={Det:LensB-Ax:Y}Mtr +file "asyn_motor_positions.req", P=$(P), M={Det:LensB-Ax:Z}Mtr +file "asyn_motor_settings.req", P=$(P), M={Det:LensA-Ax:X}Mtr +file "asyn_motor_settings.req", P=$(P), M={Det:LensA-Ax:Y}Mtr +file "asyn_motor_settings.req", P=$(P), M={Det:LensA-Ax:Z}Mtr +file "asyn_motor_settings.req", P=$(P), M={Det:LensB-Ax:X}Mtr +file "asyn_motor_settings.req", P=$(P), M={Det:LensB-Ax:Y}Mtr +file "asyn_motor_settings.req", P=$(P), M={Det:LensB-Ax:Z}Mtr diff --git a/iocs/smarActIOC/iocBoot/iocSmarAct/st.cmd b/iocs/smarActIOC/iocBoot/iocSmarAct/st.cmd index 5c3c25b..0565ae2 100644 --- a/iocs/smarActIOC/iocBoot/iocSmarAct/st.cmd +++ b/iocs/smarActIOC/iocBoot/iocSmarAct/st.cmd @@ -1,6 +1,8 @@ #!../../bin/linux-x86_64/smarAct < envPaths +epicsEnvSet("P", "smarAct:") +epicsEnvSet("MC_CT", "unit1") cd "${TOP}" @@ -18,10 +20,19 @@ dbLoadRecords("$(MOTOR)/db/motorUtil.db", "P=smarAct:") #< smaractmcs2.iocsh < smaractscu.iocsh ## +# Optional: load devIocStats records (requires DEVIOCSTATS module) +#dbLoadRecords("$(DEVIOCSTATS)/db/iocAdminSoft.db", "IOC=$(P)$(MC_CT)") + +# autosave/restore machinery +.db template is not named *.template add # _template = diff --git a/iocs/smarActIOC/smarActApp/src/Makefile b/iocs/smarActIOC/smarActApp/src/Makefile index 444920a..9f247ca 100644 --- a/iocs/smarActIOC/smarActApp/src/Makefile +++ b/iocs/smarActIOC/smarActApp/src/Makefile @@ -38,6 +38,14 @@ smarAct_LIBS += asyn #ifdef SNCSEQ smarAct_LIBS += seq pv #endif +#ifdef DEVIOCSTATS +smarAct_DBD += devIocStats.dbd iocAdmin.dbd +smarAct_LIBS += devIocStats +#endif +#ifdef AUTOSAVE +smarAct_DBD += asSupport.dbd as.dbd +smarAct_LIBS += autosave +#endif # smarAct_registerRecordDeviceDriver.cpp derives from smarAct.dbd smarAct_SRCS += smarAct_registerRecordDeviceDriver.cpp From a4db95f895987c1be5f0b8ced73891e1913173e8 Mon Sep 17 00:00:00 2001 From: Oksana Ivashkevych Date: Thu, 16 Jun 2022 12:15:17 -0400 Subject: [PATCH 2/6] Reverting changes to Db/Makefile. Mark Rivers is correct, they are not needed, and actualy st.cmd uses the file from the module --- iocs/smarActIOC/smarActApp/Db/Makefile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/iocs/smarActIOC/smarActApp/Db/Makefile b/iocs/smarActIOC/smarActApp/Db/Makefile index e911ef5..fb58fa4 100644 --- a/iocs/smarActIOC/smarActApp/Db/Makefile +++ b/iocs/smarActIOC/smarActApp/Db/Makefile @@ -17,9 +17,7 @@ DB_INSTALLS += $(MOTOR_SMARACT)/db/MCS2_Extra.db else DB_INSTALLS += $(MOTOR)/db/MCS2_Extra.db endif -#ifdef DEVIOCSTATS -DB_INSTALLS += $(DEVIOCSTATS)/db/iocAdminSoft.db -#endif + #---------------------------------------------------- # If .db template is not named *.template add # _template = From 5202096099408abe10d39047bd9aaa70cdefe1ba Mon Sep 17 00:00:00 2001 From: Oksana Ivashkevych Date: Fri, 1 Jul 2022 09:57:56 -0400 Subject: [PATCH 3/6] Updated auto_settings.req to be in sync with motor.substitutions.smaractmcs2 --- .../iocBoot/iocSmarAct/auto_settings.req | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/iocs/smarActIOC/iocBoot/iocSmarAct/auto_settings.req b/iocs/smarActIOC/iocBoot/iocSmarAct/auto_settings.req index c22765d..ea3c3b8 100644 --- a/iocs/smarActIOC/iocBoot/iocSmarAct/auto_settings.req +++ b/iocs/smarActIOC/iocBoot/iocSmarAct/auto_settings.req @@ -1,12 +1,6 @@ -file "asyn_motor_positions.req", P=$(P), M={Det:LensA-Ax:X}Mtr -file "asyn_motor_positions.req", P=$(P), M={Det:LensA-Ax:Y}Mtr -file "asyn_motor_positions.req", P=$(P), M={Det:LensA-Ax:Z}Mtr -file "asyn_motor_positions.req", P=$(P), M={Det:LensB-Ax:X}Mtr -file "asyn_motor_positions.req", P=$(P), M={Det:LensB-Ax:Y}Mtr -file "asyn_motor_positions.req", P=$(P), M={Det:LensB-Ax:Z}Mtr -file "asyn_motor_settings.req", P=$(P), M={Det:LensA-Ax:X}Mtr -file "asyn_motor_settings.req", P=$(P), M={Det:LensA-Ax:Y}Mtr -file "asyn_motor_settings.req", P=$(P), M={Det:LensA-Ax:Z}Mtr -file "asyn_motor_settings.req", P=$(P), M={Det:LensB-Ax:X}Mtr -file "asyn_motor_settings.req", P=$(P), M={Det:LensB-Ax:Y}Mtr -file "asyn_motor_settings.req", P=$(P), M={Det:LensB-Ax:Z}Mtr +file "asyn_motor_positions.req", P=$(P), M=m1 +file "asyn_motor_positions.req", P=$(P), M=m2 +file "asyn_motor_positions.req", P=$(P), M=m3 +file "asyn_motor_settings.req", P=$(P), M=m1 +file "asyn_motor_settings.req", P=$(P), M=m2 +file "asyn_motor_settings.req", P=$(P), M=m3 From b8985eca5978204b4257df0dc2598a6df3f02d61 Mon Sep 17 00:00:00 2001 From: Kevin Peterson Date: Fri, 14 Apr 2023 14:29:13 -0500 Subject: [PATCH 4/6] Moved the motor positions to a seperate req file, which is autosaved more frequently than the settings --- iocs/smarActIOC/iocBoot/iocSmarAct/AutoSave.cmd | 1 + iocs/smarActIOC/iocBoot/iocSmarAct/auto_positions.req | 3 +++ iocs/smarActIOC/iocBoot/iocSmarAct/auto_settings.req | 3 --- iocs/smarActIOC/iocBoot/iocSmarAct/st.cmd | 4 +++- 4 files changed, 7 insertions(+), 4 deletions(-) create mode 100644 iocs/smarActIOC/iocBoot/iocSmarAct/auto_positions.req diff --git a/iocs/smarActIOC/iocBoot/iocSmarAct/AutoSave.cmd b/iocs/smarActIOC/iocBoot/iocSmarAct/AutoSave.cmd index 20d89c0..bd77458 100644 --- a/iocs/smarActIOC/iocBoot/iocSmarAct/AutoSave.cmd +++ b/iocs/smarActIOC/iocBoot/iocSmarAct/AutoSave.cmd @@ -1,6 +1,7 @@ set_requestfile_path("./") set_requestfile_path("$(MOTOR)/motorApp/Db") set_savefile_path("./autosave") +set_pass0_restoreFile("auto_positions.sav") set_pass0_restoreFile("auto_settings.sav") set_pass1_restoreFile("auto_settings.sav") save_restoreSet_status_prefix("$(PREFIX)") diff --git a/iocs/smarActIOC/iocBoot/iocSmarAct/auto_positions.req b/iocs/smarActIOC/iocBoot/iocSmarAct/auto_positions.req new file mode 100644 index 0000000..7e58f7b --- /dev/null +++ b/iocs/smarActIOC/iocBoot/iocSmarAct/auto_positions.req @@ -0,0 +1,3 @@ +file "asyn_motor_positions.req", P=$(P), M=m1 +file "asyn_motor_positions.req", P=$(P), M=m2 +file "asyn_motor_positions.req", P=$(P), M=m3 diff --git a/iocs/smarActIOC/iocBoot/iocSmarAct/auto_settings.req b/iocs/smarActIOC/iocBoot/iocSmarAct/auto_settings.req index ea3c3b8..e78f944 100644 --- a/iocs/smarActIOC/iocBoot/iocSmarAct/auto_settings.req +++ b/iocs/smarActIOC/iocBoot/iocSmarAct/auto_settings.req @@ -1,6 +1,3 @@ -file "asyn_motor_positions.req", P=$(P), M=m1 -file "asyn_motor_positions.req", P=$(P), M=m2 -file "asyn_motor_positions.req", P=$(P), M=m3 file "asyn_motor_settings.req", P=$(P), M=m1 file "asyn_motor_settings.req", P=$(P), M=m2 file "asyn_motor_settings.req", P=$(P), M=m3 diff --git a/iocs/smarActIOC/iocBoot/iocSmarAct/st.cmd b/iocs/smarActIOC/iocBoot/iocSmarAct/st.cmd index 0565ae2..4f1b26e 100644 --- a/iocs/smarActIOC/iocBoot/iocSmarAct/st.cmd +++ b/iocs/smarActIOC/iocBoot/iocSmarAct/st.cmd @@ -32,7 +32,9 @@ iocInit ## motorUtil (allstop & alldone) motorUtilInit("smarAct:") +# save motor positions every five seconds +create_monitor_set("auto_positions.req",5,"P=$(P)") # save settings every thirty seconds -create_monitor_set("auto_settings.req",30,"P=$(PREFIX)") +create_monitor_set("auto_settings.req",30,"P=$(P)") # Boot complete From 43d8bf112f84ec3de557da396f5ab20c3e9b9f88 Mon Sep 17 00:00:00 2001 From: Kevin Peterson Date: Fri, 14 Apr 2023 15:05:01 -0500 Subject: [PATCH 5/6] Commented out DEVIOCSTATS from EXAMPLE_RELEASE.local to hopefully resolve github actions build problems --- configure/EXAMPLE_RELEASE.local | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure/EXAMPLE_RELEASE.local b/configure/EXAMPLE_RELEASE.local index 1b3ca25..4130bd0 100644 --- a/configure/EXAMPLE_RELEASE.local +++ b/configure/EXAMPLE_RELEASE.local @@ -4,7 +4,7 @@ ASYN=$(SUPPORT)/asyn BUSY=$(SUPPORT)/busy IPAC=$(SUPPORT)/ipac #optional DEVIOCSTATS, AUTOSAVE -DEVIOCSTATS=$(SUPPORT)/iocStats +#DEVIOCSTATS=$(SUPPORT)/iocStats AUTOSAVE=$(SUPPORT)/autosave MOTOR= From 1f51e47b0e6efff78e68252ca6a3bc86fed52993 Mon Sep 17 00:00:00 2001 From: Kevin Peterson Date: Fri, 14 Apr 2023 15:19:29 -0500 Subject: [PATCH 6/6] Uncommented the ifdef/endif statements in the example IOC's src/Makefile --- iocs/smarActIOC/smarActApp/src/Makefile | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/iocs/smarActIOC/smarActApp/src/Makefile b/iocs/smarActIOC/smarActApp/src/Makefile index 9f247ca..6aeeb75 100644 --- a/iocs/smarActIOC/smarActApp/src/Makefile +++ b/iocs/smarActIOC/smarActApp/src/Makefile @@ -19,11 +19,11 @@ DBD += smarAct.dbd smarAct_DBD += base.dbd # Include dbd files from all support applications: -#ifdef ASYN +ifdef ASYN smarAct_DBD += asyn.dbd smarAct_DBD += drvAsynSerialPort.dbd smarAct_DBD += drvAsynIPPort.dbd -#endif +endif smarAct_DBD += motorSupport.dbd smarAct_DBD += devSmarActMCSMotor.dbd smarAct_DBD += devSmarActMCS2Motor.dbd @@ -32,20 +32,20 @@ smarAct_DBD += devSmarActSCUMotor.dbd # Add all the support libraries needed by this IOC smarAct_LIBS += smarActMotor smarAct_LIBS += motor -#ifdef ASYN +ifdef ASYN smarAct_LIBS += asyn -#endif -#ifdef SNCSEQ +endif +ifdef SNCSEQ smarAct_LIBS += seq pv -#endif -#ifdef DEVIOCSTATS +endif +ifdef DEVIOCSTATS smarAct_DBD += devIocStats.dbd iocAdmin.dbd smarAct_LIBS += devIocStats -#endif -#ifdef AUTOSAVE +endif +ifdef AUTOSAVE smarAct_DBD += asSupport.dbd as.dbd smarAct_LIBS += autosave -#endif +endif # smarAct_registerRecordDeviceDriver.cpp derives from smarAct.dbd smarAct_SRCS += smarAct_registerRecordDeviceDriver.cpp