@@ -227,9 +227,11 @@ def format_od_object(
227227 # Fetch the dictionary values and the parameters, if present
228228 if index in node .Dictionary :
229229 values = node .GetEntry (index , aslist = True , compute = not raw )
230+ raw_values = node .GetEntry (index , aslist = True , compute = False )
230231 else :
231232 # Fill the values with N/A if the entry is not present
232233 values = ['__N/A__' ] * len (obj ["values" ])
234+ raw_values = values
233235
234236 if index in node .ParamsDictionary :
235237 # FIXME: Is there a risk that this return less than the length of
@@ -239,16 +241,22 @@ def format_od_object(
239241 params = [maps .DEFAULT_PARAMS ] * len (values )
240242
241243 # For mypy to ensure that values and entries are lists
242- assert isinstance (values , list ) and isinstance (params , list )
244+ assert isinstance (values , list ) and isinstance (raw_values , list ) and isinstance ( params , list )
243245
244246 infos = []
245247 # The strict=True will capture if the values and params are not the same
246- for i , (value , param ) in enumerate (zip (values , params , strict = True )):
248+ for i , (value , raw_value , param ) in enumerate (zip (values , raw_values , params , strict = True )):
247249
248250 # Prepare data for printing
249251 info = node .GetSubentryInfos (index , i )
250252 typename = node .GetTypeName (info ['type' ])
251253
254+ # Adding +NODEID text?
255+ if 'COB ID' in info ["name" ] and isinstance (raw_value , str ) and "$NODEID" in raw_value and not node .ID :
256+ t_node = f"{ Fore .GREEN } +NODEID{ Style .RESET_ALL } "
257+ else :
258+ t_node = ''
259+
252260 # Type specific formatting of the value
253261 if value == "__N/A__" :
254262 t_value = f'{ Fore .LIGHTBLACK_EX } N/A{ Style .RESET_ALL } '
@@ -268,8 +276,13 @@ def format_od_object(
268276 except ValueError :
269277 suffix = ' ???' if value else ''
270278 t_value = f"0x{ value :x} { suffix } "
279+ elif index_range and index_range .name in ('rpdop' , 'tpdop' ):
280+ assert isinstance (value , int )
281+ t_value = f"0x{ value :x} { t_node } " if 'COB ID' in info ["name" ] else f"{ value } { t_node } "
282+ if i == 1 and value & 0x80000000 :
283+ t_value += f" { Fore .LIGHTYELLOW_EX } <DISABLED>{ Style .RESET_ALL } "
271284 elif i and value and (index in (4120 , ) or 'COB ID' in info ["name" ]):
272- t_value = f"0x{ value :x} "
285+ t_value = f"0x{ value :x} { t_node } "
273286 else :
274287 t_value = str (value )
275288
0 commit comments