Skip to content

Commit

Permalink
remove list use from fastVacuum
Browse files Browse the repository at this point in the history
  • Loading branch information
gilesknap committed Jun 11, 2024
1 parent 873c52c commit edc4b19
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 88 deletions.
90 changes: 28 additions & 62 deletions tests/samples/schemas/fastVacuum.ibek.ioc.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,34 +49,6 @@
"title": "Entity Enabled",
"type": "boolean"
},
"gaugeNum": {
"anyOf": [
{
"description": "jinja that renders to <class 'int'>",
"pattern": ".*\\{\\{.*\\}\\}.*",
"type": "string"
},
{
"description": "auto gauge count",
"type": "integer"
}
],
"default": "{{ _global.counter(\"fvGaugeNum\", start=1) }}",
"description": "union of <class 'int'> and jinja representation of {typ}",
"title": "Gaugenum"
},
"fan": {
"default": "{{ \"%02d\" % (gaugeNum / 7 + 1) }}",
"description": "fan number",
"title": "Fan",
"type": "string"
},
"mask": {
"default": "{{ _global.set('fvMask', _global.get('fvMask', 0) + 2**gaugeNum) }}",
"description": "mask for the channel",
"title": "Mask",
"type": "string"
},
"name": {
"description": "Gui tag",
"title": "Name",
Expand Down Expand Up @@ -124,6 +96,34 @@
"description": "union of <class 'int'> and jinja representation of {typ}",
"title": "Timeout"
},
"gaugeNum": {
"anyOf": [
{
"description": "jinja that renders to <class 'int'>",
"pattern": ".*\\{\\{.*\\}\\}.*",
"type": "string"
},
{
"description": "auto gauge count",
"type": "integer"
}
],
"default": "{{ _global.counter(\"fvGaugeNum\", start=1) }}",
"description": "union of <class 'int'> and jinja representation of {typ}",
"title": "Gaugenum"
},
"fan": {
"default": "{{ \"%02d\" % (gaugeNum / 7 + 1) }}",
"description": "fan number",
"title": "Fan",
"type": "string"
},
"mask": {
"default": "{{ _global.set('fvMask', _global.get('fvMask', 0) + 2**gaugeNum) }}",
"description": "mask for the channel",
"title": "Mask",
"type": "string"
},
"lnk_no": {
"default": "{{ ((gaugeNum - 1) % 6) + 1 }}",
"description": "link number",
Expand Down Expand Up @@ -151,40 +151,6 @@
"default": "{{ (gaugeNum - 1) * master.combined_nelm }}",
"description": "union of <class 'int'> and jinja representation of {typ}",
"title": "Addr Offset"
},
"wave_addr": {
"anyOf": [
{
"description": "jinja that renders to <class 'list'>",
"pattern": ".*\\{\\{.*\\}\\}.*",
"type": "string"
},
{
"description": "waveform addresses",
"items": {},
"type": "array"
}
],
"default": "{%- set addr_list = range(addr_offset,addr_offset + master.waveform_nelm * 6, master.waveform_nelm) -%}\n{{ addr_list | list }}",
"description": "union of <class 'list'> and jinja representation of {typ}",
"title": "Wave Addr"
},
"wave_addr_alternative": {
"anyOf": [
{
"description": "jinja that renders to <class 'list'>",
"pattern": ".*\\{\\{.*\\}\\}.*",
"type": "string"
},
{
"description": "waveform addresses",
"items": {},
"type": "array"
}
],
"default": "{%- set addr = [] -%}\n{%- for i in range(6) -%}\n{%- set addr = addr.append(addr_offset + master.waveform_nelm * i) -%}\n{%- endfor -%}\n{{ addr }}",
"description": "union of <class 'list'> and jinja representation of {typ}",
"title": "Wave Addr Alternative"
}
},
"required": [
Expand Down
34 changes: 8 additions & 26 deletions tests/samples/support/fastVacuum.ibek.support.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ defs:
databases:
- file: $(DLSPLC)/db/dlsPLC_fastVacuumMaster.template
args: { device, eip_port }

- name: fastVacuumChannel
description: |-
Adds a fast vacuum channel to the fast vacuum master
Expand Down Expand Up @@ -112,7 +113,7 @@ defs:
asyn fins_port timeout
default: 0

pre_defines:
post_defines:
- description: auto gauge count
name: gaugeNum
type: int
Expand All @@ -129,7 +130,6 @@ defs:
value: |-
{{ _global.set('fvMask', _global.get('fvMask', 0) + 2**gaugeNum) }}
post_defines:
- description: link number
name: lnk_no
value: |-
Expand All @@ -146,24 +146,6 @@ defs:
value: |-
{{ (gaugeNum - 1) * master.combined_nelm }}
- description: waveform addresses
name: wave_addr
type: list
value: |-
{%- set addr_list = range(addr_offset,addr_offset + master.waveform_nelm * 6, master.waveform_nelm) -%}
{{ addr_list | list }}
- description: waveform addresses
name: wave_addr_alternative
type: list
# explicit loop is uglier but more versatile
value: |-
{%- set addr = [] -%}
{%- for i in range(6) -%}
{%- set addr = addr.append(addr_offset + master.waveform_nelm * i) -%}
{%- endfor -%}
{{ addr }}
databases:
- file: $(DLSPLC)/db/dlsPLC_fastVacuumLink.template
args: { device: "{{master.device}}", lnk_no, lnk: "{{gaugePV}}", fan, mask }
Expand All @@ -178,11 +160,11 @@ defs:
id: "{{id}}"
em:
waveform_nelm: "{{master.waveform_nelm}}"
wave0_addr: "{{wave_addr[0]}}"
wave1_addr: "{{wave_addr[1]}}"
wave2_addr: "{{wave_addr[2]}}"
wave3_addr: "{{wave_addr[3]}}"
wave4_addr: "{{wave_addr[4]}}"
wave5_addr: "{{wave_addr[5]}}"
wave0_addr: "{{ addr_offset }}"
wave1_addr: "{{ addr_offset + master.waveform_nelm }}"
wave2_addr: "{{ addr_offset + master.waveform_nelm * 2 }}"
wave3_addr: "{{ addr_offset + master.waveform_nelm * 3 }}"
wave4_addr: "{{ addr_offset + master.waveform_nelm * 4 }}"
wave5_addr: "{{ addr_offset + master.waveform_nelm * 5 }}"
combined_nelm: "{{master.combined_nelm}}"
timeout:

0 comments on commit edc4b19

Please sign in to comment.