Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • teichman/ebpfcat
1 result
Show changes
Commits on Source (2)
......@@ -163,8 +163,10 @@ class Struct:
class StructDesc:
def __init__(self, struct, sm3=0, sm2=0):
def __init__(self, struct, sm3=0, sm2=None):
self.struct = struct
if sm2 is None:
sm2 = sm3
self.position_offset = {SyncManager.OUT: sm2, SyncManager.IN: sm3}
def __get__(self, instance, owner):
......@@ -253,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()
......@@ -261,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)
......@@ -269,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):
......