diff --git a/ebpfcat/ebpfcat.py b/ebpfcat/ebpfcat.py index f5d1ac33d6f96c3045b1ff0d19218211ee51a2aa..92d246f2218f434bbb35ab5edb9ddb16dc179b6b 100644 --- a/ebpfcat/ebpfcat.py +++ b/ebpfcat/ebpfcat.py @@ -342,15 +342,15 @@ class EtherCatBase: for (i, t) in enumerate(self.terminals)]) -class SimpleEtherCat(EtherCatBase, EtherCat): +class SimpleEtherCat(EtherCat): pass class FastEtherCat(SimpleEtherCat): MAX_PROGS = 64 - def __init__(self, network, terminals): - super().__init__(network, terminals) + def __init__(self, network): + super().__init__(network) self.programs = create_map(MapType.PROG_ARRAY, 4, 4, self.MAX_PROGS) self.sync_groups = {} diff --git a/ebpfcat/ethercat.py b/ebpfcat/ethercat.py index b875f74b44d92fb59c38e90d096f6f92304fbfa4..19032527e45fa84e2ebb147f36b9221b7b8172f3 100644 --- a/ebpfcat/ethercat.py +++ b/ebpfcat/ethercat.py @@ -413,6 +413,8 @@ class EtherCat(Protocol): class Terminal: """Represent one terminal ("slave") in the loop""" + def __init__(self, ethercat): + self.ec = ethercat async def initialize(self, relative, absolute): """Initialize the terminal diff --git a/ebpfcat/scripts.py b/ebpfcat/scripts.py index 0605b458fe81799864ea0aa78c97d571f7b455d5..035a9998fcc5f2c716324c0bd7ae599c9b8436ee 100644 --- a/ebpfcat/scripts.py +++ b/ebpfcat/scripts.py @@ -52,8 +52,7 @@ async def info(): for i, t in zip(terminals, terms))) else: free = await ec.find_free_address() - term = Terminal() - term.ec = ec + term = Terminal(ec) await term.initialize(-args.terminal, free) terms = [term] @@ -128,8 +127,7 @@ async def eeprom(): await ec.roundtrip(ECCmd.FPRW, 7, 0x10, "H", 0) terminals = [args.terminal] - t = Terminal() - t.ec = ec + t = Terminal(ec) await t.initialize(-args.terminal, 7) if args.read or args.check is not None: