Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions TC/iocBoot/iocTC-IOC-01/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
<macro name="ADS_PORT" pattern="^[0-9]{1,5}$" description="ADS port to use for communication" hasDefault="YES" defaultValue="852"/>
<macro name="MTRCTRL" pattern="^[0-9]{1,2}$" description="Controller number used in motor address assignment" hasDefault="NO"/>
<macro name="PLC_VERSION" pattern="^[1]$" description="The PLC version to communicate with: 0 for the old ISIS code (now removed) and 1 for new collaboration code" defaultValue="1" hasDefault="YES" />
<macro name="FORWARD_DESC" pattern="^1|0$" description="Whether to poll and forward axis description to .DESC" hasDefault="YES" defaultValue="0" />
<macro name="ALLOW_FROZEN_OFFSETS" pattern="^1|0$" description="Whether to allow frozen offset behaviour" hasDefault="YES" defaultValue="0" />
</macros>
</config_part>
</ioc_config>
6 changes: 6 additions & 0 deletions TC/iocBoot/iocTC-IOC-01/st-common.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ function twincat_stcommon_main()
local plc_version = ibex_utils.getMacroValue{macro="PLC_VERSION", default="1"}
local ads_port = ibex_utils.getMacroValue{macro="ADS_PORT"}
local forward_desc = ibex_utils.getMacroValue{macro="FORWARD_DESC", default="0"}
local enable_frozen_offsets = ibex_utils.getMacroValue{macro="ALLOW_FROZEN_OFFSETS", default="0"}
asyn_port = ibex_utils.getMacroValue{macro="PORT"}

num_axes = ibex_utils.getMacroValue{macro="NUM_AXES"} -- todo: actually poll the device to get this
Expand All @@ -34,6 +35,11 @@ function twincat_stcommon_main()
iocsh.dbLoadRecords("$(MOTOREXT)/db/desc_tc.db", desc_tc_args)
end

if enable_frozen_offsets == "1" then
local frozen_offsets_db_args = string.format("P=%s,AXIS_NUM=%s,ADSPORT=%s,PORT=%s", ioc_prefix, axis_num, ads_port, asyn_port)
iocsh.dbLoadRecords("$(MOTOREXT)/db/frozen_offsets.db", frozen_offsets_db_args)
end

motor_pv = string.format("MTR%02i%02i", mtrctrl, axis_num)
single_axis_db = "$(TOP)/db/single_axis.db"
db_args = string.format("MYPVPREFIX=%s,MOTOR_PV=%s,MOTOR_PORT=%s,ADDR=%s", pv_prefix, motor_pv, motor_port, axis_num-1)
Expand Down