From 34bb022ce511c985580a930762c8a5ebb8ae0f6b Mon Sep 17 00:00:00 2001 From: Martin Teichmann <martin.teichmann@gmail.com> Date: Fri, 27 Jan 2023 19:31:32 +0000 Subject: [PATCH] add parsing PDOs to ec-info --- ebpfcat/ethercat.py | 2 +- ebpfcat/scripts.py | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ebpfcat/ethercat.py b/ebpfcat/ethercat.py index c02d1af..9674348 100644 --- a/ebpfcat/ethercat.py +++ b/ebpfcat/ethercat.py @@ -401,7 +401,7 @@ class Terminal: self.eeprom = await self.read_eeprom() if 41 not in self.eeprom: - print('no 41 in eeprom') + # no sync managers defined in eeprom return await self.write(0x800, data=0x80) # empty out sync manager await self.write(0x800, data=self.eeprom[41]) diff --git a/ebpfcat/scripts.py b/ebpfcat/scripts.py index 7025076..5b0ee2c 100644 --- a/ebpfcat/scripts.py +++ b/ebpfcat/scripts.py @@ -34,6 +34,7 @@ async def info(): parser.add_argument("-n", "--names", action="store_true") parser.add_argument("-s", "--sdo", action="store_true") parser.add_argument("-v", "--values", action="store_true") + parser.add_argument("-p", "--pdo", action="store_true") args = parser.parse_args() ec = EtherCat(args.interface) @@ -42,7 +43,9 @@ async def info(): if args.terminal is None: terminals = range(await ec.count()) else: -# print(await ec.roundtrip(ECCmd.FPRW, 7, 0x10, "H", 0)) + # former terminal: don't listen! + # this does not work with all terminals, dunno why + await ec.roundtrip(ECCmd.FPRW, 7, 0x10, "H", 0) terminals = [args.terminal] terms = [Terminal() for t in terminals] @@ -76,3 +79,5 @@ async def info(): print(f" {r:10} {r:8X}") else: print(f" {r}") + if args.pdo: + t.parse_pdos() -- GitLab