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 branches found
No related tags found
No related merge requests found
Pipeline #133913 passed
...@@ -255,6 +255,8 @@ class EBPFTerminal(Terminal): ...@@ -255,6 +255,8 @@ class EBPFTerminal(Terminal):
compatibility = None compatibility = None
position_offset = {SyncManager.OUT: 0, SyncManager.IN: 0} position_offset = {SyncManager.OUT: 0, SyncManager.IN: 0}
use_fmmu = True use_fmmu = True
out_pdos = None
in_pdos = None
async def apply_eeprom(self): async def apply_eeprom(self):
await super().apply_eeprom() await super().apply_eeprom()
...@@ -263,6 +265,10 @@ class EBPFTerminal(Terminal): ...@@ -263,6 +265,10 @@ class EBPFTerminal(Terminal):
raise EtherCatError( raise EtherCatError(
f"Incompatible Terminal: {self.vendorId}:{self.productCode}") f"Incompatible Terminal: {self.vendorId}:{self.productCode}")
await self.to_operational(MachineState.PRE_OPERATIONAL) 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 = {} self.pdos = {}
outbits, inbits = await self.parse_pdos() outbits, inbits = await self.parse_pdos()
self.pdo_out_sz = int((outbits + 7) // 8) self.pdo_out_sz = int((outbits + 7) // 8)
...@@ -271,6 +277,13 @@ class EBPFTerminal(Terminal): ...@@ -271,6 +277,13 @@ class EBPFTerminal(Terminal):
assert not self.pdo_in_sz or self.pdo_in_off assert not self.pdo_in_sz or self.pdo_in_off
await self.write_pdo_sm() 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): def allocate(self, packet, readwrite):
"""allocate space in packet for the pdos of this terminal """allocate space in packet for the pdos of this terminal
......
...@@ -159,13 +159,17 @@ class EL6022(EBPFTerminal): ...@@ -159,13 +159,17 @@ class EL6022(EBPFTerminal):
class EL7041(EBPFTerminal): class EL7041(EBPFTerminal):
compatibility = {(2, 461451346), (2, 461455442), (2, 460795986)} compatibility = {(2, 461451346), (2, 461455442), (2, 460795986)}
out_pdos = [0x1600, 0x1602, 0x1604]
in_pdos = [0x1A00, 0x1A03, 0x1A07]
velocity = ProcessDesc(0x7010, 0x21, "h") velocity = ProcessDesc(0x7010, 0x21, "h")
enable = ProcessDesc(0x7010, 1) enable = ProcessDesc(0x7010, 1)
reset = ProcessDesc(0x7010, 2)
reduced_current = ProcessDesc(0x7010, 3) reduced_current = ProcessDesc(0x7010, 3)
status = ProcessDesc(0x6010, 1, "H") status = ProcessDesc(0x6010, 1, "H")
error = ProcessDesc(0x6010, 4)
low_switch = ProcessDesc(0x6010, 0xc) low_switch = ProcessDesc(0x6010, 0xc)
high_switch = ProcessDesc(0x6010, 0xd) high_switch = ProcessDesc(0x6010, 0xd)
stepcounter = ProcessDesc(0x6010, 0x14)
class EL7332(EBPFTerminal): 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