### motor.cmd.SMChydra
#
# This file is designed to be sourced:
#   * after the communication port has been configured
#   * before iocInit
#
# Example ethernet port configuration:
#   drvAsynIPPortConfigure("hydraEth","192.168.1.17:400", 0, 0, 0)
#

# Ethernet
HydraPort = "hydraEth"
# Serial
#!HydraPort = "serial5"

# Show communication
#asynSetTraceMask(HydraPort, 0, 3)
# Only show errors
asynSetTraceMask(HydraPort, 0, 1)
# Leave ascii selected so traces can be turned on with a single click
asynSetTraceIOMask(HydraPort, 0, 1)

# Set end-of-string terminators
asynOctetSetInputEos(HydraPort,0,"\r\n")
asynOctetSetOutputEos(HydraPort,0,"\r\n")

dbLoadTemplate("motor.substitutions.SMChydra")

# SMChydraCreateController(
#  port name,
#  asyn port name,
#  num axes,
#  moving poll period (ms),
#  idle poll period (ms) )
SMChydraCreateController("Hydra1", HydraPort, 2, 100, 500)
# Use the following line to disable idle polling
#!SMChydraCreateController("Hydra1", HydraPort, 2, 100, 0)

# This sleep is useful when asyn traces are enabled
#!epicsThreadSleep(3.0)

# Include an asyn record for each motor to make it easy to enable diagnostic messages
dbLoadRecords("$(ASYN)/db/asynRecord.db","P=IOC:,R=hydraAsyn1,PORT=Hydra1,ADDR=0,OMAX=256,IMAX=256")
dbLoadRecords("$(ASYN)/db/asynRecord.db","P=IOC:,R=hydraAsyn2,PORT=Hydra1,ADDR=1,OMAX=256,IMAX=256")
