Skip to content
Snippets Groups Projects
Commit 38e06102 authored by Martin Teichmann's avatar Martin Teichmann
Browse files

pre-operational is good enough to read terminals

parent f2622cf9
No related branches found
No related tags found
No related merge requests found
......@@ -531,7 +531,7 @@ class Terminal:
ret, = await self.ec.roundtrip(ECCmd.FPRD, self.position, 0x0130, "H")
return ret
async def to_operational(self):
async def to_operational(self, target=8):
"""try to bring the terminal to operational state
this tries to push the terminal through its state machine to the
......@@ -556,6 +556,8 @@ class Terminal:
0x0130, "H2xH")
if error != 0:
raise EtherCatError(f"AL register {error}")
if state == target:
return
async def get_error(self):
"""read the error register"""
......
......@@ -69,7 +69,7 @@ async def info():
i += infos[i] + 1
if args.sdo:
await t.to_operational()
await t.to_operational(4)
ret = await t.read_ODlist()
for k, v in ret.items():
print(f"{k:X}:")
......@@ -86,7 +86,7 @@ async def info():
else:
print(f" {r}")
if args.pdo:
await t.to_operational()
await t.to_operational(4)
await t.parse_pdos()
for (idx, subidx), (sm, pos, fmt) in t.pdos.items():
print(f"{idx:4X}:{subidx:02X} {sm} {pos} {fmt}")
......@@ -159,7 +159,7 @@ async def create_test():
await t.initialize(-i, await ec.find_free_address())
sdo = {}
if t.has_mailbox():
await t.to_operational()
await t.to_operational(4)
odlist = await t.read_ODlist()
for k, v in odlist.items():
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment