Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autosave but do not apply TC positions #884

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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
1 change: 1 addition & 0 deletions TC/iocBoot/iocTC-IOC-01/TC_01_positions_norestore.req
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
file "TC_01_built_positions.req"
5 changes: 5 additions & 0 deletions TC/iocBoot/iocTC-IOC-01/st-common.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -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)
3 changes: 3 additions & 0 deletions TC/iocBoot/iocTC-IOC-01/st-common.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -55,6 +57,7 @@ function twincat_stcommon_main()
end
end
autosave_file:close()
autosave_file_pos:close()

end

Expand Down
1 change: 1 addition & 0 deletions TC/iocBoot/iocTC-IOC-02/TC_02_positions_norestore.req
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
file "TC_02_built_positions.req"