Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
HEV - High Energy Ventilator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
Projects
HEV - High Energy Ventilator
Commits
97aaef88
Commit
97aaef88
authored
4 years ago
by
Chris Burr
Browse files
Options
Downloads
Patches
Plain Diff
Make hevfromtxt.py set the timestamp correctly
parent
57248e17
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
raspberry-dataserver/hevfromtxt.py
+14
-10
14 additions, 10 deletions
raspberry-dataserver/hevfromtxt.py
with
14 additions
and
10 deletions
raspberry-dataserver/hevfromtxt.py
+
14
−
10
View file @
97aaef88
...
...
@@ -25,7 +25,7 @@ class hevfromtxt():
self
.
_volume
=
h
[:,
3
].
tolist
()
self
.
_length
=
len
(
self
.
_pressure
)
self
.
_pos
=
0
# position within sample
self
.
_
delay
=
0.2
# time period
self
.
_
increment
=
1
# received queue and observers to be notified on update
self
.
_payloadrecv
=
deque
(
maxlen
=
16
)
...
...
@@ -34,22 +34,26 @@ class hevfromtxt():
sendingWorker
.
start
()
def
generate
(
self
)
->
None
:
time_offset
=
0
while
True
:
# grab next array from filedump
increment
=
int
(
round
(
self
.
_delay
/
0.2
))
increment
=
1
if
increment
<
1
else
increment
self
.
_pos
=
self
.
_pos
+
increment
if
self
.
_pos
+
increment
<
self
.
_length
else
0
payload
=
CommsCommon
.
DataFormat
()
# directly setting private member variables in this edge case
payload
=
CommsCommon
.
DataFormat
()
payload
.
_version
=
payload
.
_RPI_VERSION
payload
.
_timestamp
=
self
.
_timestamp
[
self
.
_pos
]
payload
.
_timestamp
=
time_offset
+
self
.
_timestamp
[
self
.
_pos
]
payload
.
_pressure_buffer
=
self
.
_pressure
[
self
.
_pos
]
payload
.
_pressure_inhale
=
self
.
_volume
[
self
.
_pos
]
payload
.
_temperature_buffer
=
self
.
_flow
[
self
.
_pos
]
self
.
payloadrecv
=
payload
time
.
sleep
(
self
.
_delay
)
if
self
.
_pos
+
self
.
_increment
<
self
.
_length
:
delay
=
self
.
_timestamp
[
self
.
_pos
+
self
.
_increment
]
-
self
.
_timestamp
[
self
.
_pos
]
self
.
_pos
=
self
.
_pos
+
self
.
_increment
else
:
delay
=
self
.
_timestamp
[
self
.
_pos
]
-
self
.
_timestamp
[
self
.
_pos
-
self
.
_increment
]
time_offset
+=
self
.
_timestamp
[
self
.
_pos
]
self
.
_pos
=
0
time
.
sleep
(
delay
)
# callback to dependants to read the received payload
@property
...
...
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