From f63ab1ba0a3d16103fb244065d0187b34cefb90a Mon Sep 17 00:00:00 2001 From: Jack Harper Date: Tue, 26 May 2026 17:04:49 +0100 Subject: [PATCH] add conditional for frozen offsets for TC --- TC/iocBoot/iocTC-IOC-01/config.xml | 2 ++ TC/iocBoot/iocTC-IOC-01/st-common.lua | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/TC/iocBoot/iocTC-IOC-01/config.xml b/TC/iocBoot/iocTC-IOC-01/config.xml index 298e7492f..4c60eb061 100644 --- a/TC/iocBoot/iocTC-IOC-01/config.xml +++ b/TC/iocBoot/iocTC-IOC-01/config.xml @@ -8,6 +8,8 @@ + + diff --git a/TC/iocBoot/iocTC-IOC-01/st-common.lua b/TC/iocBoot/iocTC-IOC-01/st-common.lua index de8634601..a6f03b2f5 100644 --- a/TC/iocBoot/iocTC-IOC-01/st-common.lua +++ b/TC/iocBoot/iocTC-IOC-01/st-common.lua @@ -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 @@ -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)