ethercat-linux/uia_tree.py
Tony Cao 3a26aea082 2kHz spin-lock mode: RTT halved to 2ms, per-byte XOR proof at 500us cycle
- ticker: --spin mode polls FPRD until payload changes (phase-locks
  processing to TwinCAT frame arrival instead of free-running ticker),
  timeout at 1.5 periods keeps loop alive on master stop
- verified: 238k cycles, 0 errors, exec=245us (FPWR-bound),
  TwinCAT PLC task confirmed at 2000.8 Hz (all three tasks 0.5ms;
  base tick was already 50us - no base-time change needed)
- docs: 500us latency plan; scripts: task-rate ADS probe, 2kHz deploy,
  UI automation experiments (pywinauto) for task cycle inspection
2026-07-28 00:11:34 +08:00

30 lines
755 B
Python

import sys, time
sys.stdout.reconfigure(encoding='utf-8', errors='replace')
from pywinauto import Application
app = Application(backend='uia').connect(process=1456, timeout=10)
win = app.window(title_re='.*TcXaeShell.*')
tree = win.descendants(control_type='Tree')[0]
def expand_and_print(item, depth=0, maxdepth=4):
try:
name = item.window_text()
except Exception:
name = '?'
print(' ' * depth + name)
if depth >= maxdepth:
return
try:
item.expand()
time.sleep(0.3)
except Exception:
pass
try:
for ch in item.children():
expand_and_print(ch, depth + 1, maxdepth)
except Exception:
pass
for root in tree.children():
expand_and_print(root)