From 788fe3fd64da1afa95a2e6b50925f50019853486 Mon Sep 17 00:00:00 2001 From: Freddie Akeroyd Date: Tue, 1 Oct 2024 19:21:52 +0100 Subject: [PATCH 1/2] Autosave but do not apply TC positions --- TC/iocBoot/iocTC-IOC-01/TC_01_positions_norestore.req | 1 + TC/iocBoot/iocTC-IOC-01/st-common.cmd | 5 +++++ TC/iocBoot/iocTC-IOC-01/st-common.lua | 3 +++ 3 files changed, 9 insertions(+) create mode 100644 TC/iocBoot/iocTC-IOC-01/TC_01_positions_norestore.req diff --git a/TC/iocBoot/iocTC-IOC-01/TC_01_positions_norestore.req b/TC/iocBoot/iocTC-IOC-01/TC_01_positions_norestore.req new file mode 100644 index 000000000..a9dd50eb5 --- /dev/null +++ b/TC/iocBoot/iocTC-IOC-01/TC_01_positions_norestore.req @@ -0,0 +1 @@ +file "TC_01_built_positions.req" diff --git a/TC/iocBoot/iocTC-IOC-01/st-common.cmd b/TC/iocBoot/iocTC-IOC-01/st-common.cmd index 4d1b3870e..11420601d 100644 --- a/TC/iocBoot/iocTC-IOC-01/st-common.cmd +++ b/TC/iocBoot/iocTC-IOC-01/st-common.cmd @@ -76,3 +76,8 @@ motorUtilInit("$(MYPVPREFIX)$(IOCNAME):") # Save motor settings every 30 seconds, this requests file is written dynamically by LUA $(IFNOTRECSIM) create_monitor_set("$(IOCNAME)_settings.req", 30) + +# Save motor positions every 5 seconds, this requests file is written dynamically by LUA +# these positions are not used for automatic restore, they are just for information +# They could be manually applied for a restore, or used with autosave asVerify to check current positions +$(IFNOTRECSIM) create_monitor_set("$(IOCNAME)_positions_norestore.req", 5) diff --git a/TC/iocBoot/iocTC-IOC-01/st-common.lua b/TC/iocBoot/iocTC-IOC-01/st-common.lua index de8634601..dd14df4fb 100644 --- a/TC/iocBoot/iocTC-IOC-01/st-common.lua +++ b/TC/iocBoot/iocTC-IOC-01/st-common.lua @@ -20,6 +20,7 @@ function twincat_stcommon_main() iocsh.devMotorCreateController(motor_port, "Controller", num_axes, ioc_prefix) autosave_file = io.open (ioc_name .. "_built_settings.req", "w") + autosave_file_pos = io.open (ioc_name .. "_built_positions.req", "w") db_args = string.format("P=%s,Q=MOT:MTR%02i:,AXES_NUM=%s", pv_prefix, mtrctrl, num_axes) iocsh.dbLoadRecords("$(MOTOR)/db/motorController.db", db_args) @@ -47,6 +48,7 @@ function twincat_stcommon_main() axis_monitors_args = string.format("P=%s,I=%s,AXIS_NUM=%s,MOTOR_PV=%s", pv_prefix, ioc_name, axis_num, motor_pv) iocsh.dbLoadRecords(axis_monitors, axis_monitors_args) autosave_file:write(string.format("file \"motor_settings.req\" P=%s, M=MOT:%s\n", pv_prefix, motor_pv)) + autosave_file_pos:write(string.format("file \"motor_positions.req\" P=%s, M=MOT:%s\n", pv_prefix, motor_pv)) -- wrap around to next MTRCTRL - this is so we can show >8 axes in the IBEX table of motors. if axis_num > 8 then alias_args_orig = string.format("$(MYPVPREFIX)MOT:%s(.*)", motor_pv) @@ -55,6 +57,7 @@ function twincat_stcommon_main() end end autosave_file:close() + autosave_file_pos:close() end From bd86d99f9cec0847ab54d7f5b34ec0874df5e02d Mon Sep 17 00:00:00 2001 From: Freddie Akeroyd Date: Wed, 2 Oct 2024 11:53:47 +0100 Subject: [PATCH 2/2] Add TC_02 file --- TC/iocBoot/iocTC-IOC-02/TC_02_positions_norestore.req | 1 + 1 file changed, 1 insertion(+) create mode 100644 TC/iocBoot/iocTC-IOC-02/TC_02_positions_norestore.req diff --git a/TC/iocBoot/iocTC-IOC-02/TC_02_positions_norestore.req b/TC/iocBoot/iocTC-IOC-02/TC_02_positions_norestore.req new file mode 100644 index 000000000..d59d2c09c --- /dev/null +++ b/TC/iocBoot/iocTC-IOC-02/TC_02_positions_norestore.req @@ -0,0 +1 @@ +file "TC_02_built_positions.req"