Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CCS
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Marko Mecina
CCS
Commits
aab37008
Commit
aab37008
authored
2 months ago
by
Marko Mecina
Browse files
Options
Downloads
Patches
Plain Diff
update WFI DE packet config
parent
2ebf4ccb
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Ccs/packet_config_ATHENA_DE.py
+101
-3
101 additions, 3 deletions
Ccs/packet_config_ATHENA_DE.py
with
101 additions
and
3 deletions
Ccs/packet_config_ATHENA_DE.py
+
101
−
3
View file @
aab37008
...
...
@@ -471,12 +471,17 @@ class FpmPktParser:
Parses telemetry received from FPM
"""
def
__init__
(
self
,
scibytes
,
echobytes
=
None
,
defaultbytes
=
1024
):
def
__init__
(
self
,
scibytes
,
echobytes
=
None
,
defaultbytes
=
1024
,
scifile
=
None
):
self
.
scibytes
=
scibytes
self
.
echobytes
=
echobytes
self
.
defaultbytes
=
defaultbytes
if
scifile
is
not
None
:
self
.
scifile
=
open
(
scifile
,
'
wb
'
)
else
:
self
.
scifile
=
scifile
self
.
nbytes_tot
=
0
self
.
lastpkt
=
None
...
...
@@ -485,6 +490,7 @@ class FpmPktParser:
strict
=
True
msg
=
sock
.
recv
(
IF_LEN
)
tofile
=
False
if
not
msg
:
return
b
''
...
...
@@ -492,6 +498,7 @@ class FpmPktParser:
if
msg
[
0
]
==
IfAddr
.
CMD
:
mlen
=
ACK_LEN
-
IF_LEN
elif
msg
[
0
]
==
IfAddr
.
SCI
:
tofile
=
True
mlen
=
self
.
scibytes
elif
msg
[
0
]
==
IfAddr
.
HK
:
mlen
=
ACK_LEN
-
IF_LEN
...
...
@@ -517,6 +524,9 @@ class FpmPktParser:
self
.
lastpkt
=
msg
self
.
nbytes_tot
+=
len
(
msg
)
if
tofile
and
self
.
scifile
is
not
None
:
self
.
scifile
.
write
(
msg
[
1
:])
return
msg
def
set_scibytes
(
self
,
nbytes
):
...
...
@@ -568,7 +578,7 @@ class FpmProcessor:
def
__call__
(
self
,
buf
,
ts
=
None
):
assert
isinstance
(
buf
,
queue
.
Queue
)
#
assert isinstance(buf, queue.Queue)
try
:
pkt
=
buf
.
get
(
timeout
=
self
.
queue_to
)
...
...
@@ -608,7 +618,10 @@ class FpmProcessor:
else
:
if
self
.
curfrm
!=
-
1
:
self
.
frames
.
append
(
self
.
mk_evt_frame
(
framesize
=
self
.
framesize
,
verbose
=
verbose
))
if
not
self
.
process
:
self
.
frames
.
append
(
self
.
cfdata
)
else
:
self
.
frames
.
append
(
self
.
mk_evt_frame
(
framesize
=
self
.
framesize
,
verbose
=
verbose
))
self
.
cfdata
=
ed
self
.
framecnt
+=
1
...
...
@@ -662,6 +675,91 @@ class FpmProcessor:
self
.
frames
.
clear
()
class
FpmProcessorMod
:
"""
Processes FPM packets and assembles event frames.
"""
def
__init__
(
self
,
fromfile
,
framesize
=
NPIX_LD
,
ashex
=
True
,
process
=
True
,
notime
=
False
,
queue_to
=
10
):
self
.
framesize
=
framesize
self
.
ashex
=
ashex
self
.
process
=
process
self
.
notime
=
notime
self
.
cfdata
=
b
''
self
.
curfrm
=
-
1
self
.
framecnt
=
0
self
.
frames
=
[]
self
.
queue_to
=
queue_to
self
.
fromfile
=
open
(
fromfile
,
'
rb
'
)
def
__call__
(
self
,
ts
=
None
):
# assert isinstance(buf, queue.Queue)
try
:
pkt
=
self
.
fromfile
.
read
(
EVT_PKT_ELEMENT_LEN
)
if
not
pkt
:
return
except
:
return
self
.
frames
.
clear
()
try
:
# process data from SCI interface
self
.
proc
(
pkt
)
if
self
.
frames
:
return
self
.
frames
except
Exception
as
err
:
print
(
err
)
def
proc
(
self
,
ed
,
verbose
=
False
):
if
ed
[
0
]
==
self
.
curfrm
:
self
.
cfdata
+=
ed
else
:
if
self
.
curfrm
!=
-
1
:
if
not
self
.
process
:
self
.
frames
.
append
(
self
.
cfdata
)
else
:
self
.
frames
.
append
(
self
.
mk_evt_frame
(
framesize
=
self
.
framesize
,
verbose
=
verbose
))
self
.
cfdata
=
ed
self
.
framecnt
+=
1
self
.
curfrm
=
ed
[
0
]
def
mk_evt_frame
(
self
,
framesize
=
NPIX_LD
,
verbose
=
False
):
try
:
frame
=
EventFrame
(
self
.
cfdata
,
framesize
=
framesize
)
if
verbose
:
print
(
frame
)
except
Exception
as
err
:
print
(
err
)
return
self
.
cfdata
return
frame
def
close_file
(
self
):
self
.
fromfile
.
close
()
return
self
.
frames
def
reset
(
self
):
self
.
cfdata
=
b
''
self
.
curfrm
=
-
1
self
.
framecnt
=
0
self
.
frames
.
clear
()
class
FrameList
(
list
):
def
get_frame_ids
(
self
):
...
...
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