Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
ebpfCAT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
karaboDevices
ebpfCAT
Commits
03b4a9e8
Commit
03b4a9e8
authored
4 years ago
by
Martin Teichmann
Browse files
Options
Downloads
Patches
Plain Diff
fix setting SDOs
parent
503b4643
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ebpfcat/ethercat.py
+5
-5
5 additions, 5 deletions
ebpfcat/ethercat.py
with
5 additions
and
5 deletions
ebpfcat/ethercat.py
+
5
−
5
View file @
03b4a9e8
...
...
@@ -116,7 +116,7 @@ class ObjectEntry:
if
self
.
dataType
in
(
ECDataType
.
VISIBLE_STRING
,
ECDataType
.
UNICODE_STRING
):
return
ret
.
decode
(
"
utf8
"
)
elif
self
.
dataType
.
fmt
is
None
:
elif
isinstance
(
self
.
dataType
,
int
)
or
self
.
dataType
.
fmt
is
None
:
return
ret
else
:
return
unpack
(
"
<
"
+
self
.
dataType
.
fmt
,
ret
)[
0
]
...
...
@@ -125,7 +125,7 @@ class ObjectEntry:
if
self
.
dataType
in
(
ECDataType
.
VISIBLE_STRING
,
ECDataType
.
UNICODE_STRING
):
d
=
data
.
encode
(
"
utf8
"
)
elif
self
.
dataType
.
fmt
is
None
:
elif
isinstance
(
self
.
dataType
,
int
)
or
self
.
dataType
.
fmt
is
None
:
d
=
data
else
:
d
=
pack
(
"
<
"
+
self
.
dataType
.
fmt
,
data
)
...
...
@@ -569,9 +569,9 @@ class Terminal:
async
def
sdo_write
(
self
,
data
,
index
,
subindex
=
None
):
if
len
(
data
)
<=
4
and
subindex
is
not
None
:
await
self
.
mbx_send
(
MBXType
.
COE
,
"
HBHB
"
,
CoECmd
.
SDOREQ
.
value
<<
12
,
ODCmd
.
DOWN_EXP
.
value
|
((
4
-
len
(
data
))
<<
2
),
index
,
subindex
,
data
=
data
)
MBXType
.
COE
,
"
HBHB
4s
"
,
CoECmd
.
SDOREQ
.
value
<<
12
,
ODCmd
.
DOWN_EXP
.
value
|
((
(
4
-
len
(
data
))
<<
2
)
&
0xc
)
,
index
,
subindex
,
data
)
type
,
data
=
await
self
.
mbx_recv
()
if
type
is
not
MBXType
.
COE
:
raise
RuntimeError
(
f
"
expected CoE, got
{
type
}
"
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment