Skip to content
Merged
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
8 changes: 8 additions & 0 deletions roles/deploy_ioc/vars/elio.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
deploy_ioc_use_common: true
deploy_ioc_required_module: elio_cc756ab
deploy_ioc_template_root_path: "{{ deploy_ioc_required_module_path }}"
deploy_ioc_make_autosave_files: true
deploy_ioc_executable: elio
deploy_ioc_device_specific_env:
EPICS_DB_INCLUDE_PATH: "$(ELIO)/db"
1 change: 1 addition & 0 deletions roles/deploy_ioc/vars/mdrive.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ deploy_ioc_use_common: true
deploy_ioc_use_ad_common: false
deploy_ioc_make_autosave_files: true
deploy_ioc_required_module: mdrive_8bc9a09
deploy_ioc_template_root_path: "{{ deploy_ioc_required_module_path }}"
deploy_ioc_executable: mdrive
29 changes: 29 additions & 0 deletions roles/device_roles/elio/example.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---

gpio_ex1:
type: "elio"
terminals:
# POS, MODEL
- ["1", "EL3068"]
- ["2", "EL4008"]
- ["3", "EL1808"]
- ["4", "EL1808"]
- ["5", "EL2808"]
- ["6", "EL2808"]
- ["7", "EL3068"]
- ["8", "EL1124"]
- ["9", "EL2124"]

# SYS and DEV: used to generate prefix for each device
# PREFIX: used for IOC-specific PVs
# HOST may be an IP address or host name
# EK9K: port name
# NUM_TERMS: total terminal numbers
environment:
SYS: "XF:31ID1-ES"
DEV: "GPIO:1"
EK9K: EK9K1
HOST: 10.69.58.101
NUM_TERMS: 9
PREFIX: "XF:31ID1-CT{IOC:GPIO1}"
ENGINEER: "H. Xu" # Your name/contact info
11 changes: 11 additions & 0 deletions roles/device_roles/elio/schema.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---

type: enum("elio")
environment:
SYS: str()
DEV: str()
EK9K: str()
HOST: str()
NUM_TERMS: int()
PREFIX: str()
ENGINEER: str()
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The template iterates over ioc.terminals, but the role schema doesn't define/require a terminals field. This allows invalid configs to pass schema validation and then fail at render time when ioc.terminals is missing. Add a terminals entry to the schema (e.g., a non-empty list of 2-item tuples/lists: position + model) to make the role interface self-validating.

Suggested change
ENGINEER: str()
ENGINEER: str()
terminals: list()

Copilot uses AI. Check for mistakes.
10 changes: 10 additions & 0 deletions roles/device_roles/elio/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
# Tasks for Beckhoff EL EK9000 and ELXXXX terminals

- name: Install base.cmd
ansible.builtin.template:
src: templates/base.cmd.j2
dest: "{{ deploy_ioc_ioc_directory }}/iocBoot/base.cmd"
mode: "0664"
owner: "{{ host_config.softioc_user }}"
group: "{{ host_config.softioc_group }}"
19 changes: 19 additions & 0 deletions roles/device_roles/elio/templates/base.cmd.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
## Register all support components
dbLoadDatabase("{{ deploy_ioc_template_root_path }}/dbd/{{ deploy_ioc_executable }}.dbd")
{{ deploy_ioc_executable }}_registerRecordDeviceDriver(pdbbase)

# Configure the low level communication port
ek9000Configure("${EK9K}", "${HOST}", 502, ${NUM_TERMS})
dbLoadRecords("{{ deploy_ioc_template_root_path }}/db/ek9000_status.db","P=$(SYS){$(DEV)},EK9K=$(EK9K)")

# Configure terminal
{% for elio in ioc.terminals %}
############ Config for elio #{{ loop.index }} - {{ elio[0] }} - {{ elio[1] }} ############

epicsEnvSet("POS",{{ elio[0] }})
epicsEnvSet("MODEL","{{ elio[1] }}")
epicsEnvSet("Dev","{$(DEV)_$(POS)}")
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

epicsEnvSet("Dev","{$(DEV)_$(POS)}") sets the Dev env var with literal {} braces around the expanded value. Nothing else in the repo uses this {...} form for env var composition, and the resulting $(Dev) will include braces when passed into ek9000ConfigureTerminal / dbLoadTemplate, which is likely unintended and can break generated PV names/macros. Consider composing this as $(DEV)_$(POS) (no braces), or otherwise ensure the downstream templates explicitly expect braces.

Suggested change
epicsEnvSet("Dev","{$(DEV)_$(POS)}")
epicsEnvSet("Dev","$(DEV)_$(POS)")

Copilot uses AI. Check for mistakes.
ek9000ConfigureTerminal("$(EK9K)", "$(Dev)", "$(MODEL)", "$(POS)")
dbLoadTemplate("{{ deploy_ioc_template_root_path }}/db/$(MODEL).substitutions","DEVICE=$(EK9K), Sys=$(SYS), Dev=$(Dev), POS=$(POS)")

{% endfor %}
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
file "$(EPICS_BASE)/db/asynRecord.db"
{{"{"}}
pattern
{{"{"}}"P", "R", "PORT", "ADDR", "IMAX", "OMAX"{{"}"}}
{{"{"}}P, R, PORT, ADDR, IMAX, OMAX{{"}"}}
{% for device in ioc.devices -%}
{{"{"}}"{{ ioc.environment.SYS }}", "{{"{"}}MDrive:{{ device.io_port[1:] }}{{"}"}}Asyn", "{{ device.io_port }}", "0", "256", "256"{{"}"}}
{{"{"}}"{{ ioc.environment.SYS_IOC }}", "{{"{"}}MDrive:{{ device.io_port[1:] }}{{"}"}}Asyn", "{{ device.io_port }}", "0", "256", "256"{{"}"}}
{% endfor -%}
{{"}"}}
8 changes: 8 additions & 0 deletions roles/install_module/vars/ek9000_60e62b5.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---

ek9000_60e62b5:
name: "ek9000"
url: "https://github.com/slac-epics/ek9000"
version: 60e62b5
module_deps:
- modbus_bb9fa05
8 changes: 8 additions & 0 deletions roles/install_module/vars/elio_cc756ab.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---

elio_cc756ab:
name: "elio"
url: "https://github.com/NSLS2/elio-ioc"
version: cc756ab
module_deps:
- ek9000_60e62b5
1 change: 0 additions & 1 deletion roles/install_module/vars/modbus_bb9fa05.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ modbus_bb9fa05:
name: modbus
url: "https://github.com/NSLS2/modbus"
version: "bb9fa05"
executable: modbusApp
Loading