From 78b437aac5ae9080e4d4d295ccf1a5bd1503afe2 Mon Sep 17 00:00:00 2001 From: Martin Teichmann <martin.teichmann@xfel.eu> Date: Thu, 16 Feb 2023 16:42:25 +0100 Subject: [PATCH] actually pre-operational is good enough for most operations, pre-operational is good enough a state. By thinko we went to safe operational, which is not needed. --- ebpfcat/ebpfcat.py | 5 ++--- ebpfcat/ethercat.py | 2 +- ebpfcat/scripts.py | 6 +++--- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/ebpfcat/ebpfcat.py b/ebpfcat/ebpfcat.py index ce21c6e..f6dcc75 100644 --- a/ebpfcat/ebpfcat.py +++ b/ebpfcat/ebpfcat.py @@ -220,9 +220,8 @@ class EBPFTerminal(Terminal): if (self.compatibility is not None and (self.vendorId, self.productCode) not in self.compatibility): raise RuntimeError( - f"Incompatible Terminal: {self.vendorId}:{self.productCode} " - f"({relative}, {absolute})") - await self.to_operational(4) + f"Incompatible Terminal: {self.vendorId}:{self.productCode}") + await self.to_operational(2) self.pdos = {} if self.has_mailbox(): await self.parse_pdos() diff --git a/ebpfcat/ethercat.py b/ebpfcat/ethercat.py index 1e0b557..e21e867 100644 --- a/ebpfcat/ethercat.py +++ b/ebpfcat/ethercat.py @@ -559,7 +559,7 @@ class Terminal: 0x0130, "H2xH") if error != 0: raise EtherCatError(f"AL register {error}") - if state == target: + if state >= target: return async def get_error(self): diff --git a/ebpfcat/scripts.py b/ebpfcat/scripts.py index 09f9efe..3663ced 100644 --- a/ebpfcat/scripts.py +++ b/ebpfcat/scripts.py @@ -74,7 +74,7 @@ async def info(): print(f"{k:2}: {v}\n {v.hex()}") if args.sdo: - await t.to_operational(4) + await t.to_operational(2) ret = await t.read_ODlist() for k, v in ret.items(): print(f"{k:X}:") @@ -91,7 +91,7 @@ async def info(): else: print(f" {r}") if args.pdo: - await t.to_operational(4) + await t.to_operational(2) await t.parse_pdos() for (idx, subidx), (sm, pos, fmt) in t.pdos.items(): print(f"{idx:4X}:{subidx:02X} {sm} {pos} {fmt}") @@ -164,7 +164,7 @@ async def create_test(): await t.initialize(-i, await ec.find_free_address()) sdo = {} if t.has_mailbox(): - await t.to_operational(4) + await t.to_operational(2) odlist = await t.read_ODlist() for k, v in odlist.items(): -- GitLab