Skip to content

Commit

Permalink
run-ethercatmc-ioc.sh: Better support for -ads
Browse files Browse the repository at this point in the history
Make the handling of -ads start scripts better:
If EPICSTWINCATADS is set, must be determined earlier,
to allow a proper handling of
ASYNPORTCONFIGUREUSE and ASYNPORTCONFIGUREDONTUSE

Add st.mcu010-ads.iocsh for testing purposes
Changes to be committed:
    modified:   run-ethercatmc-ioc.sh
    new file:   startup/st.mcu010-ads.iocsh
  • Loading branch information
tboegi committed Apr 12, 2024
1 parent c583547 commit 82a66d9
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 19 deletions.
44 changes: 25 additions & 19 deletions test/run-ethercatmc-ioc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,15 @@ APPXX=ethercatmc
# shellcheck disable=SC2012
TOP=$(echo $PWD/.. | sed -e "s%/test/\.\.$%%")
export APPXX
EPICS_EEE_E3=classic
DOLOG=
EPICS_EEE_E3=classic
EPICSTWINCATADS=""
HOST=""
LOCALAMSNETID=""
MOTORPORT=""
NOMAKE=""
NORUN=""
REMOTEAMSNETID=""
LOCALAMSNETID=""

## functions
help_and_exit() {
Expand All @@ -34,6 +37,9 @@ help_and_exit() {
*sim-indexer)
echo >&2 $0 " $cmd"
;;
*-ads)
echo >&2 $0 " $cmd" " <ip>:48898"
;;
*-indexer)
echo >&2 $0 " $cmd" " <ip>:48898"
;;
Expand Down Expand Up @@ -216,11 +222,6 @@ if test -z "$EPICS_HOST_ARCH"; then
exit 1
fi

NOMAKE=""
NORUN=""
EPICSTWINCATADS=""
DOLOG=""

# pick up some arguments
PARAM="$1"
while test "$PARAM" != ""; do
Expand Down Expand Up @@ -254,19 +255,8 @@ while test "$PARAM" != ""; do
esac
done

# Which of the 2 commands needs to be run ?
# Only one of them: Either ADS or TCP
if test "$EPICSTWINCATADS" = y; then
ASYNPORTCONFIGUREUSE="adsAsynPortDriverConfigure"
ASYNPORTCONFIGUREDONTUSE="drvAsynIPPortConfigure"
else
ASYNPORTCONFIGUREUSE="drvAsynIPPortConfigure"
ASYNPORTCONFIGUREDONTUSE="adsAsynPortDriverConfigure"
fi

export NOMAKE
export NORUN
export ASYNPORTCONFIGUREDONTUSE

MOTORCFG="$1"
export MOTORCFG
Expand All @@ -278,15 +268,31 @@ shift

# motor port is different for indexer
case $MOTORCFG in
*-ads)
MOTORPORT=48898
EPICSTWINCATADS=y
;;
*sim-indexer) ;;
*indexer)
*-indexer)
MOTORPORT=48898
;;
*)
MOTORPORT=5000
;;
esac

# Which of the 2 commands needs to be run ?
# Only one of them: Either ADS or TCP
if test "$EPICSTWINCATADS" = y; then
ASYNPORTCONFIGUREUSE="adsAsynPortDriverConfigure"
ASYNPORTCONFIGUREDONTUSE="drvAsynIPPortConfigure"
else
ASYNPORTCONFIGUREUSE="drvAsynIPPortConfigure"
ASYNPORTCONFIGUREDONTUSE="adsAsynPortDriverConfigure"
fi
export ASYNPORTCONFIGUREUSE
export ASYNPORTCONFIGUREDONTUSE

PARAM="$1"
while test "$PARAM" != ""; do
case $1 in
Expand Down
42 changes: 42 additions & 0 deletions test/startup/st.mcu010-ads.iocsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
epicsEnvSet("MOTOR_PORT", "$(SM_MOTOR_PORT=MCU1)")

epicsEnvSet("IPADDR", "$(SM_IPADDR=127.0.0.1)")
epicsEnvSet("IPPORT", "$(SM_IPPORT=48898)")
epicsEnvSet("AMSNETIDIOC", "LOCALAMSNETIDXX")
epicsEnvSet("ASYN_PORT", "$(SM_ASYN_PORT=MC_CPU1)")
epicsEnvSet("SYSPFX", "$(SM_SYSPFX=LabS-MCAG:MC-MCU-10:)")
epicsEnvSet("MCUPFX", "")
epicsEnvSet("PREC", "$(SM_PREC=3)")
epicsEnvSet("SM_NOAXES", "2")
epicsEnvSet("ADSPORT", "$(ECM_ADSPORT=852)")
epicsEnvSet("ECM_OPTIONS", "")

epicsEnvSet("MOVINGPOLLPERIOD", "200")
epicsEnvSet("IDLEPOLLPERIOD", "500")
< ethercatmcController.iocsh


#
# Axis 1
#
epicsEnvSet("AXISCONFIG", "")
epicsEnvSet("AXIS_NAME", "$(SM_AXIS_NAME=m1)")
epicsEnvSet("AXIS_NO", "$(SM_AXIS_NO=1)")
epicsEnvSet("DESC", "$(SM_DESC=DESC)")
epicsEnvSet("EGU", "$(SM_EGU=EGU)")
epicsEnvSet("RAWENCSTEP_ADEL", 0)
epicsEnvSet("RAWENCSTEP_MDEL", 0)
< ethercatmcAxis.iocsh
< ethercatmcAxisdebug.iocsh

#
# Axis 2
#
epicsEnvSet("AXISCONFIG", "")
epicsEnvSet("AXIS_NAME", "$(SM_AXIS_NAME=m2)")
epicsEnvSet("AXIS_NO", "$(SM_AXIS_NO=2)")
epicsEnvSet("RAWENCSTEP_ADEL", 0)
epicsEnvSet("RAWENCSTEP_MDEL", 0)
< ethercatmcAxis.iocsh
< ethercatmcAxisdebug.iocsh

0 comments on commit 82a66d9

Please sign in to comment.