#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.xps3"

dbLoadTemplate "XPSAux.substitutions"

# asyn port, IP address, IP port, number of axes, active poll period (ms), idle poll period (ms)
XPSConfig("XPS1", "164.54.160.180", 5001, 6, 20, 500)

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

# XPS asyn port,  axis, groupName.positionerName, stepSize
XPSConfigAxis("XPS1",0,"FINE.X",             100000) # VP-25XL
XPSConfigAxis("XPS1",1,"FINE.Y",              50000) # VP-5ZA
XPSConfigAxis("XPS1",2,"THETA.POSITIONER",     2000) # URS75CC
XPSConfigAxis("XPS1",3,"COARSEX.POSITIONER",   2000) # ILS200CC
XPSConfigAxis("XPS1",4,"COARSEY.POSITIONER",   2000) # ILS200CC
XPSConfigAxis("XPS1",5,"COARSEZ.POSITIONER",   5000) # IMS300CC

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")
