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

allow for writing of dedicated PDOs

on some terminals, the PDO can be configured. This
allows for that. It is not perfect yet as we do not properly
overwrite existing PDOs.
parent ec51fa2a
No related merge requests found
......@@ -255,6 +255,8 @@ class EBPFTerminal(Terminal):
compatibility = None
position_offset = {SyncManager.OUT: 0, SyncManager.IN: 0}
use_fmmu = True
out_pdos = None
in_pdos = None
async def apply_eeprom(self):
await super().apply_eeprom()
......@@ -263,6 +265,10 @@ class EBPFTerminal(Terminal):
raise EtherCatError(
f"Incompatible Terminal: {self.vendorId}:{self.productCode}")
await self.to_operational(MachineState.PRE_OPERATIONAL)
if self.out_pdos is not None:
await self.write_pdos(0x1c12, self.out_pdos)
if self.in_pdos is not None:
await self.write_pdos(0x1c13, self.in_pdos)
self.pdos = {}
outbits, inbits = await self.parse_pdos()
self.pdo_out_sz = int((outbits + 7) // 8)
......@@ -271,6 +277,13 @@ class EBPFTerminal(Terminal):
assert not self.pdo_in_sz or self.pdo_in_off
await self.write_pdo_sm()
async def write_pdos(self, index, values):
await self.sdo_write(pack('B', 0), index, 0)
for i, v in enumerate(values, 1):
await self.sdo_write(pack('<H', v), index, i)
await self.sdo_write(pack('<H', 0), index, i + 1)
await self.sdo_write(pack('B', len(values)), index, 0)
def allocate(self, packet, readwrite):
"""allocate space in packet for the pdos of this terminal
......
......@@ -159,13 +159,17 @@ class EL6022(EBPFTerminal):
class EL7041(EBPFTerminal):
compatibility = {(2, 461451346), (2, 461455442), (2, 460795986)}
out_pdos = [0x1600, 0x1602, 0x1604]
in_pdos = [0x1A00, 0x1A03, 0x1A07]
velocity = ProcessDesc(0x7010, 0x21, "h")
enable = ProcessDesc(0x7010, 1)
reset = ProcessDesc(0x7010, 2)
reduced_current = ProcessDesc(0x7010, 3)
status = ProcessDesc(0x6010, 1, "H")
error = ProcessDesc(0x6010, 4)
low_switch = ProcessDesc(0x6010, 0xc)
high_switch = ProcessDesc(0x6010, 0xd)
stepcounter = ProcessDesc(0x6010, 0x14)
class EL7332(EBPFTerminal):
......
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