#errlogInit(5000)
< envPaths
# Tell EPICS all about the record types, device-support modules, drivers,
# etc. in this build from CARS
dbLoadDatabase("../../dbd/WithAsyn.dbd")
WithAsyn_registerRecordDeviceDriver(pdbbase)

### Motors
dbLoadTemplate "motor.substitutions.xps4"

dbLoadTemplate "XPSAux.substitutions"

# asyn port, IP address, IP port, number of axes, 
# active poll period (ms), idle poll period (ms), 
# enable set position, set position settling time (ms)
XPSConfig("XPS1", "164.54.160.124", 5001, 6, 10, 500, 0, 500)
asynSetTraceIOMask("XPS1", 0, 2)
#asynSetTraceMask("XPS1", 0, 255)

# asynPort, IP address, IP port, poll period (ms)
XPSAuxConfig("XPS_AUX1", "164.54.160.124", 5001, 50)
#asynSetTraceIOMask("XPS_AUX1", 0, 2)
#asynSetTraceMask("XPS_AUX1", 0, 255)

# XPS asyn port,  axis, groupName.positionerName, stepSize
XPSConfigAxis("XPS1",0,"GROUP1.PHI",     1000)
XPSConfigAxis("XPS1",1,"GROUP1.KAPPA",   5000)
XPSConfigAxis("XPS1",2,"GROUP1.OMEGA",   5000)
XPSConfigAxis("XPS1",3,"GROUP1.PSI",     4000)
XPSConfigAxis("XPS1",4,"GROUP1.2THETA", 10000)
XPSConfigAxis("XPS1",5,"GROUP1.NU",      4000)

# XPS asyn port,  max points, FTP username, FTP password
# Note: this must be done after configuring axes
XPSConfigProfile("XPS1", 2000, "Administrator", "Administrator")

XPSEnableSetPosition(XPS1, 0)
XPSSetPositionSettlingTime(XPS1, 200)

iocInit

# This IOC does not use save/restore, so set values of some PVs
dbpf("IOC:m1.RTRY", "0")
dbpf("IOC:m1.TWV", "0.1")
dbpf("IOC:m2.RTRY", "0")
dbpf("IOC:m2.TWV", "0.1")
dbpf("IOC:m3.RTRY", "0")
dbpf("IOC:m3.TWV", "0.1")
dbpf("IOC:m4.RTRY", "0")
dbpf("IOC:m4.TWV", "0.1")
dbpf("IOC:m5.RTRY", "0")
dbpf("IOC:m5.TWV", "0.1")
dbpf("IOC:m6.RTRY", "0")
dbpf("IOC:m6.TWV", "0.1")
