@@ -95,7 +95,7 @@ async def _create_softioc(
95
95
except OSError :
96
96
logging .exception ("Unable to connect to PandA" )
97
97
raise
98
- (all_records , all_values_dict , panda_dict ) = await create_records (
98
+ (all_records , all_values_dict , block_info_dict ) = await create_records (
99
99
client , dispatcher , record_prefix
100
100
)
101
101
@@ -104,7 +104,7 @@ async def _create_softioc(
104
104
raise RuntimeError ("Unexpected state - softioc task already exists" )
105
105
106
106
create_softioc_task = asyncio .create_task (
107
- update (client , all_records , 0.1 , all_values_dict , panda_dict )
107
+ update (client , all_records , 0.1 , all_values_dict , block_info_dict )
108
108
)
109
109
110
110
create_softioc_task .add_done_callback (_when_finished )
@@ -188,13 +188,13 @@ async def introspect_panda(
188
188
189
189
190
190
def _create_dicts_from_changes (
191
- changes : Changes , block_info : Dict [str , BlockInfo ]
191
+ changes : Changes , block_info_dict : Dict [str , BlockInfo ]
192
192
) -> Tuple [Dict [str , Dict [EpicsName , RecordValue ]], Dict [EpicsName , RecordValue ]]:
193
193
"""Take the `Changes` object and convert it into two dictionaries.
194
194
195
195
Args:
196
196
changes: The `Changes` object as returned by `GetChanges`
197
- block_info : Information from the initial `GetBlockInfo` request,
197
+ block_info_dict : Information from the initial `GetBlockInfo` request,
198
198
used to check the `number` of blocks for parsing metadata
199
199
200
200
Returns:
@@ -222,10 +222,10 @@ def _store_values(
222
222
"LABEL_"
223
223
):
224
224
_ , block_name_number = field_name .split ("_" , maxsplit = 1 )
225
- if block_name_number in block_info :
226
- number_of_blocks = block_info [block_name_number ].number
225
+ if block_name_number in block_info_dict :
226
+ number_of_blocks = block_info_dict [block_name_number ].number
227
227
else :
228
- number_of_blocks = block_info [block_name_number [:- 1 ]].number
228
+ number_of_blocks = block_info_dict [block_name_number [:- 1 ]].number
229
229
230
230
# The block is fixed with metadata
231
231
# "*METADATA.LABEL_SEQ2": "NewSeqMetadataLabel",
@@ -1694,7 +1694,7 @@ def create_block_records(
1694
1694
1695
1695
# The record uses the default _RecordUpdater.update to update the value
1696
1696
# on the panda
1697
- record_dict [key ] = self ._create_record_info (
1697
+ record_dict [EpicsName ( key ) ] = self ._create_record_info (
1698
1698
key ,
1699
1699
None ,
1700
1700
builder .longStringOut ,
@@ -1741,7 +1741,7 @@ async def create_records(
1741
1741
EpicsName ,
1742
1742
RecordValue ,
1743
1743
],
1744
- Dict [str , _BlockAndFieldInfo ],
1744
+ Dict [str , BlockInfo ],
1745
1745
]:
1746
1746
"""Query the PandA and create the relevant records based on the information
1747
1747
returned"""
@@ -1816,15 +1816,16 @@ async def create_records(
1816
1816
1817
1817
record_factory .initialise (dispatcher )
1818
1818
1819
- return (all_records , all_values_dict , panda_dict )
1819
+ block_info_dict = {key : value .block_info for key , value in panda_dict .items ()}
1820
+ return (all_records , all_values_dict , block_info_dict )
1820
1821
1821
1822
1822
1823
async def update (
1823
1824
client : AsyncioClient ,
1824
1825
all_records : Dict [EpicsName , RecordInfo ],
1825
1826
poll_period : float ,
1826
1827
all_values_dict : Dict [EpicsName , RecordValue ],
1827
- block_info : Dict [str , BlockInfo ],
1828
+ block_info_dict : Dict [str , BlockInfo ],
1828
1829
):
1829
1830
"""Query the PandA at regular intervals for any changed fields, and update
1830
1831
the records accordingly
@@ -1867,7 +1868,9 @@ async def update(
1867
1868
# Clear any alarm state as we've received a new update from PandA
1868
1869
set_all_records_severity (all_records , alarm .NO_ALARM , alarm .UDF_ALARM )
1869
1870
1870
- _ , new_all_values_dict = _create_dicts_from_changes (changes , block_info )
1871
+ _ , new_all_values_dict = _create_dicts_from_changes (
1872
+ changes , block_info_dict
1873
+ )
1871
1874
1872
1875
# Apply the new values to the existing dict, so various updater classes
1873
1876
# will have access to the latest values.
0 commit comments