From 1529312e38e9fde227ff4e68de50ede370bc25e6 Mon Sep 17 00:00:00 2001
From: Keenan Lang <klang@aps.anl.gov>
Date: Wed, 24 Aug 2016 16:52:24 -0500
Subject: [PATCH] Refactored optics devices into their own file.

---
 iocBoot/iocxxx/common.iocsh        | 62 +-----------------------------
 iocBoot/iocxxx/common/optics.iocsh | 60 +++++++++++++++++++++++++++++
 2 files changed, 62 insertions(+), 60 deletions(-)
 create mode 100644 iocBoot/iocxxx/common/optics.iocsh

diff --git a/iocBoot/iocxxx/common.iocsh b/iocBoot/iocxxx/common.iocsh
index e60eefb..1a4f21a 100644
--- a/iocBoot/iocxxx/common.iocsh
+++ b/iocBoot/iocxxx/common.iocsh
@@ -71,59 +71,6 @@ iocshLoad("$(AUTOSAVE)/iocsh/configMenu.iocsh", "PREFIX=$(PREFIX),CONFIG=scan1")
 # crate.
 dbLoadTemplate("$(PLATFORM)/scanParms.substitutions")
 
-### Slits (If not supplied, RELTOCENTER defaults to zero)
-dbLoadRecords("$(OPTICS)/opticsApp/Db/2slit.db","P=$(PREFIX),SLIT=Slit1V,mXp=m3,mXn=m4,RELTOCENTER=0")
-dbLoadRecords("$(OPTICS)/opticsApp/Db/2slit.db","P=$(PREFIX),SLIT=Slit1H,mXp=m5,mXn=m6,RELTOCENTER=0")
-
-# X-ray Instrumentation Associates Huber Slit Controller
-# (Uses asyn record loaded separately)
-#iocshLoad("$(OPTICS)/iocsh/Huber_xia.iocsh", "PREFIX=$(PREFIX), INSTANCE=hsc1:, ASYN_REC=$(PREFIX)asyn_6")
-#iocshLoad("$(OPTICS)/iocsh/Huber_xia.iocsh", "PREFIX=$(PREFIX), INSTANCE=hsc2:, ASYN_REC=$(PREFIX)asyn_6")
-
-### 2-post mirror
-#dbLoadRecords("$(OPTICS)/opticsApp/Db/2postMirror.db","P=$(PREFIX),Q=M1,mDn=m1,mUp=m2,LENGTH=0.3")
-
-### User filters
-#dbLoadRecords("$(OPTICS)/opticsApp/Db/filterMotor.db","P=$(PREFIX),Q=fltr1:,MOTOR=m1,LOCK=fltr_1_2:")
-#dbLoadRecords("$(OPTICS)/opticsApp/Db/filterMotor.db","P=$(PREFIX),Q=fltr2:,MOTOR=m2,LOCK=fltr_1_2:")
-#dbLoadRecords("$(OPTICS)/opticsApp/Db/filterLock.db","P=$(PREFIX),Q=fltr2:,LOCK=fltr_1_2:,LOCK_PV=$(PREFIX)DAC1_1.VAL")
-
-### Optical tables
-epicsEnvSet("DIR", "$(OPTICS)/opticsApp/Db")
-dbLoadRecords("$(DIR)/table.db","P=$(PREFIX),Q=Table1,T=table1,M0X=m1,M0Y=m2,M1Y=m3,M2X=m4,M2Y=m5,M2Z=m6,GEOM=SRI")
-#dbLoadRecords("$(DIR)/table.db","P=$(PREFIX),Q=Table1,T=table1,M0X=m1,M0Y=m2,M1Y=m3,M2X=m4,M2Y=m5,M2Z=m6,GEOM=NEWPORT")
-#dbLoadRecords("$(DIR)/table.db","P=$(PREFIX),Q=Table2,T=table2,M0X=m1,M0Y=m2,M1Y=m3,M2X=m4,M2Y=m5,M2Z=m6,GEOM=SRI")
-
-# Io calculation
-#dbLoadRecords("$(OPTICS)/opticsApp/Db/Io.db","P=$(PREFIX)Io:")
-#doAfterIocInit("seq &Io, 'P=$(PREFIX)Io:,MONO=$(PREFIX)BraggEAO,VSC=$(PREFIX)scaler1'")
-
-### Monochromator support ###
-# Kohzu and PSL monochromators: Bragg and theta/Y/Z motors
-# standard geometry (geometry 1)
-#iocshLoad("$(OPTICS)/iocsh/kohzu_mono.iocsh", "PREFIX=$(PREFIX), M_THETA=m1,M_Y=m2,M_Z=m3, YOFF_LO=17.4999,YOFF_HI=17.5001, GEOM=1, LOG=kohzuCtl.log")
-# modified geometry (geometry 2)
-#iocshLoad("$(OPTICS)/iocsh/kohzu_mono.iocsh", "PREFIX=$(PREFIX), M_THETA=m1,M_Y=m2,M_Z=m2, YOFF_LO=4, YOFF_HI=36, GEOM=2, LOG=kohzuCtl.log")
-
-# Example of specifying offset limits
-#doAfterIocInit("epicsThreadSleep(5.)")
-#doAfterIocInit("dbpf $(PREFIX)kohzu_yOffsetAO.DRVH 17.51")
-#doAfterIocInit("dbpf $(PREFIX)kohzu_yOffsetAO.DRVL 17.49")
-
-# Spherical grating monochromator
-#dbLoadRecords("$(OPTICS)/opticsApp/Db/SGM.db","P=$(PREFIX),N=1,M_x=m7,M_rIn=m6,M_rOut=m8,M_g=m9")
-
-# 4-bounce high-resolution monochromator
-#iocshLoad("$(OPTICS)/iocsh/hr_mono.iocsh", "PREFIX=$(PREFIX), INSTANCE=1, M_PHI1=m1, M_PHI2=m2, LOG=hrCtl.log")
-
-### multilayer monochromator: Bragg and theta/Y/Z motors
-#iocshLoad("$(OPTICS)/iocsh/ml_mono.iocsh", "PREFIX=$(PREFIX), M_THETA=m1, M_THETA2=m2, M_Y=m3, M_Z=m4, YOFF=35., GEOM=1")
-
-### Orientation matrix, four-circle diffractometer (see seq program 'orient' below)
-#iocshLoad("$(OPTICS)/iocsh/orient.iocsh", "PREFIX=$(PREFIX), INSTANCE=1, M_TTH=m9, M_TH=m10, M_CHI=m11, M_PHI=m12, SUB=common/orient_xtals.substitutions")
-
-# Coarse/Fine stage
-#dbLoadRecords("$(OPTICS)/opticsApp/Db/CoarseFineMotor.db","P=$(PREFIX)cf1:,PM=$(PREFIX),CM=m7,FM=m8")
 
 # Load single element Canberra AIM MCA and ICB modules
 #< $(PLATFORM)/canberra_1.cmd
@@ -134,6 +81,8 @@ dbLoadRecords("$(DIR)/table.db","P=$(PREFIX),Q=Table1,T=table1,M0X=m1,M0Y=m2,M1Y
 # Load 3 element detector software
 #< $(PLATFORM)/canberra_3.cmd
 
+< common/optics.iocsh
+
 < common/calc.iocsh
 
 # Soft function generator
@@ -170,13 +119,6 @@ dbLoadRecords("$(STD)/stdApp/Db/misc.db","P=$(PREFIX)")
 #epicsEnvSet("FBO", "$(PREFIX)Unidig1Bo")
 #iocshLoad("$(STD)/iocsh/femto.iocsh", "PREFIX=$(PREFIX), HARDWARE=fem01:, FUNC=seq01:, G1_PV=$(FBO)6, G2_PV=$(FBO)7, G3_PV=$(FBO)8, NO_PV=$(FBO)10")
 
-### Load database records for dual PF4 filters
-#iocshLoad("OPTICS)/iocsh/pf4filters.iocsh", "PREFIX=$(PREFIX), INSTANCE=pf4")
-
-### Load database records for alternative PF4-filter support
-#dbLoadTemplate("common/filter.substitutions", "P=$(PREFIX)")
-#doAfterIocInit("seq filterDrive,'NAME=filterDrive,P=$(PREFIX),R=filter:,NUM_FILTERS=16'")
-
 # trajectory scan
 #dbLoadRecords("$(MOTOR)/motorApp/Db/trajectoryScan.db","P=$(PREFIX),R=traj1:,NAXES=2,NELM=300,NPULSE=300")
 #doAfterIocInit("seq &MAX_trajectoryScan, 'P=$(PREFIX),R=traj1:,M1=m1,M2=m2,M3=m3,M4=m4,M5=m5,M6=m6,M7=m7,M8=m8,PORT=none'")
diff --git a/iocBoot/iocxxx/common/optics.iocsh b/iocBoot/iocxxx/common/optics.iocsh
new file mode 100644
index 0000000..b6fb16d
--- /dev/null
+++ b/iocBoot/iocxxx/common/optics.iocsh
@@ -0,0 +1,60 @@
+### Slits (If not supplied, RELTOCENTER defaults to zero)
+dbLoadRecords("$(OPTICS)/opticsApp/Db/2slit.db","P=$(PREFIX),SLIT=Slit1V,mXp=m3,mXn=m4,RELTOCENTER=0")
+dbLoadRecords("$(OPTICS)/opticsApp/Db/2slit.db","P=$(PREFIX),SLIT=Slit1H,mXp=m5,mXn=m6,RELTOCENTER=0")
+
+# X-ray Instrumentation Associates Huber Slit Controller
+# (Uses asyn record loaded separately)
+#iocshLoad("$(OPTICS)/iocsh/Huber_xia.iocsh", "PREFIX=$(PREFIX), INSTANCE=hsc1:, ASYN_REC=$(PREFIX)asyn_6")
+#iocshLoad("$(OPTICS)/iocsh/Huber_xia.iocsh", "PREFIX=$(PREFIX), INSTANCE=hsc2:, ASYN_REC=$(PREFIX)asyn_6")
+
+### 2-post mirror
+#dbLoadRecords("$(OPTICS)/opticsApp/Db/2postMirror.db","P=$(PREFIX),Q=M1,mDn=m1,mUp=m2,LENGTH=0.3")
+
+### User filters
+#dbLoadRecords("$(OPTICS)/opticsApp/Db/filterMotor.db","P=$(PREFIX),Q=fltr1:,MOTOR=m1,LOCK=fltr_1_2:")
+#dbLoadRecords("$(OPTICS)/opticsApp/Db/filterMotor.db","P=$(PREFIX),Q=fltr2:,MOTOR=m2,LOCK=fltr_1_2:")
+#dbLoadRecords("$(OPTICS)/opticsApp/Db/filterLock.db","P=$(PREFIX),Q=fltr2:,LOCK=fltr_1_2:,LOCK_PV=$(PREFIX)DAC1_1.VAL")
+
+### Optical tables
+epicsEnvSet("DIR", "$(OPTICS)/opticsApp/Db")
+dbLoadRecords("$(DIR)/table.db","P=$(PREFIX),Q=Table1,T=table1,M0X=m1,M0Y=m2,M1Y=m3,M2X=m4,M2Y=m5,M2Z=m6,GEOM=SRI")
+#dbLoadRecords("$(DIR)/table.db","P=$(PREFIX),Q=Table1,T=table1,M0X=m1,M0Y=m2,M1Y=m3,M2X=m4,M2Y=m5,M2Z=m6,GEOM=NEWPORT")
+#dbLoadRecords("$(DIR)/table.db","P=$(PREFIX),Q=Table2,T=table2,M0X=m1,M0Y=m2,M1Y=m3,M2X=m4,M2Y=m5,M2Z=m6,GEOM=SRI")
+
+# Io calculation
+#dbLoadRecords("$(OPTICS)/opticsApp/Db/Io.db","P=$(PREFIX)Io:")
+#doAfterIocInit("seq &Io, 'P=$(PREFIX)Io:,MONO=$(PREFIX)BraggEAO,VSC=$(PREFIX)scaler1'")
+
+### Monochromator support ###
+# Kohzu and PSL monochromators: Bragg and theta/Y/Z motors
+# standard geometry (geometry 1)
+#iocshLoad("$(OPTICS)/iocsh/kohzu_mono.iocsh", "PREFIX=$(PREFIX), M_THETA=m1,M_Y=m2,M_Z=m3, YOFF_LO=17.4999,YOFF_HI=17.5001, GEOM=1, LOG=kohzuCtl.log")
+# modified geometry (geometry 2)
+#iocshLoad("$(OPTICS)/iocsh/kohzu_mono.iocsh", "PREFIX=$(PREFIX), M_THETA=m1,M_Y=m2,M_Z=m2, YOFF_LO=4, YOFF_HI=36, GEOM=2, LOG=kohzuCtl.log")
+
+# Example of specifying offset limits
+#doAfterIocInit("epicsThreadSleep(5.)")
+#doAfterIocInit("dbpf $(PREFIX)kohzu_yOffsetAO.DRVH 17.51")
+#doAfterIocInit("dbpf $(PREFIX)kohzu_yOffsetAO.DRVL 17.49")
+
+# Spherical grating monochromator
+#dbLoadRecords("$(OPTICS)/opticsApp/Db/SGM.db","P=$(PREFIX),N=1,M_x=m7,M_rIn=m6,M_rOut=m8,M_g=m9")
+
+# 4-bounce high-resolution monochromator
+#iocshLoad("$(OPTICS)/iocsh/hr_mono.iocsh", "PREFIX=$(PREFIX), INSTANCE=1, M_PHI1=m1, M_PHI2=m2, LOG=hrCtl.log")
+
+### multilayer monochromator: Bragg and theta/Y/Z motors
+#iocshLoad("$(OPTICS)/iocsh/ml_mono.iocsh", "PREFIX=$(PREFIX), M_THETA=m1, M_THETA2=m2, M_Y=m3, M_Z=m4, YOFF=35., GEOM=1")
+
+### Orientation matrix, four-circle diffractometer (see seq program 'orient' below)
+#iocshLoad("$(OPTICS)/iocsh/orient.iocsh", "PREFIX=$(PREFIX), INSTANCE=1, M_TTH=m9, M_TH=m10, M_CHI=m11, M_PHI=m12, SUB=common/orient_xtals.substitutions")
+
+# Coarse/Fine stage
+#dbLoadRecords("$(OPTICS)/opticsApp/Db/CoarseFineMotor.db","P=$(PREFIX)cf1:,PM=$(PREFIX),CM=m7,FM=m8")
+
+### Load database records for dual PF4 filters
+#iocshLoad("OPTICS)/iocsh/pf4filters.iocsh", "PREFIX=$(PREFIX), INSTANCE=pf4")
+
+### Load database records for alternative PF4-filter support
+#dbLoadTemplate("common/filter.substitutions", "P=$(PREFIX)")
+#doAfterIocInit("seq filterDrive,'NAME=filterDrive,P=$(PREFIX),R=filter:,NUM_FILTERS=16'")
-- 
GitLab