ethercat-linux/uia_find_dc.py
Tony Cao aabfe31526 Enable EL6695 DC-Synchron mode (AssignActivate 0x320)
- DC selection must use the structured <Dc><Data AssignActivate/> XSD
  element; legacy DcData hex writes get normalized to zeros by TwinCAT
- TwinCAT converts it to DcData '2003...' (0x0320) on save: SYNC0/SYNC1
  cyclic + SYNC0 activate for the bridge
- Verified: clean activation, ticker OP, bSync=True, 90k cycles 0 errors,
  timing unchanged (jitter 7.3us mean)
- docs: pitfall #10 (DC selection method)
2026-08-09 15:32:56 +08:00

16 lines
756 B
Python

import sys, time
sys.stdout.reconfigure(encoding='utf-8', errors='replace')
from pywinauto import Application
app = Application(backend='uia').connect(process=int(sys.argv[1]), timeout=10)
win = app.top_window()
# look for DC-related text and combo boxes anywhere
texts = win.descendants(control_type='Text')
interesting = [t.window_text() for t in texts if t.window_text() and any(k in t.window_text() for k in ['FreeRun', 'DC', 'Synchron', 'EtherCAT', 'Sync'])]
print('interesting texts:', interesting[:40])
combos = win.descendants(control_type='ComboBox')
print('combos:', [c.window_text() for c in combos])
listitems = win.descendants(control_type='ListItem')
li = [l.window_text() for l in listitems if l.window_text()]
print('listitems:', li[:30])