Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
MessdatenSilo
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
Container 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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lennard Kloock
MessdatenSilo
Commits
c58bea19
Commit
c58bea19
authored
2 years ago
by
Lennard
Browse files
Options
Downloads
Patches
Plain Diff
Remove debug info and add check for overwriting previous commit
parent
eafb360c
Branches
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#775
passed
2 years ago
Stage: convert
Stage: upload
Stage: delete
Stage: release
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitignore
+2
-1
2 additions, 1 deletion
.gitignore
main.py
+7
-18
7 additions, 18 deletions
main.py
scripts/push.bash
+13
-7
13 additions, 7 deletions
scripts/push.bash
with
22 additions
and
26 deletions
.gitignore
+
2
−
1
View file @
c58bea19
...
...
@@ -4,3 +4,4 @@ CHANGELOG.md
profiling.log
data/data
data.zip
__pycache__/**
\ No newline at end of file
This diff is collapsed.
Click to expand it.
main.py
+
7
−
18
View file @
c58bea19
...
...
@@ -152,8 +152,6 @@ def main(config: Any) -> None:
last_write
=
time
.
time
()
data
=
np
.
zeros
((
8
,))
n
=
0
recv1
,
recv2
=
None
,
None
off1
,
off2
=
None
,
None
while
datetime
.
datetime
.
now
()
+
datetime
.
timedelta
(
seconds
=
delta_time
)
<
end_time
:
try
:
...
...
@@ -162,30 +160,24 @@ def main(config: Any) -> None:
con1
.
write
(
1
)
# offsets for writing data in correct column
off
1
=
0
if
int
(
convert
(
con1
.
readline
()))
==
1.0
else
4
off
=
0
if
int
(
convert
(
con1
.
readline
()))
==
1.0
else
4
# read data
for
i
in
range
(
4
):
recv1
=
con1
.
readline
()
new_data
[
i
+
off1
]
+=
float
(
convert
(
recv1
))
recv1
=
None
off1
=
None
new_data
[
i
+
off
]
+=
float
(
convert
(
con1
.
readline
()))
con2
.
write
(
1
)
# offsets for writing data in correct column
off
2
=
0
if
int
(
convert
(
con2
.
readline
()))
==
1.0
else
4
off
=
0
if
int
(
convert
(
con2
.
readline
()))
==
1.0
else
4
for
i
in
range
(
4
):
recv2
=
con2
.
readline
()
new_data
[
i
+
off2
]
+=
float
(
convert
(
recv2
))
recv2
=
None
off2
=
None
new_data
[
i
+
off
]
+=
float
(
convert
(
con2
.
readline
()))
n
+=
1
data
=
new_data
except
(
TypeError
,
ValueError
):
# may occur if no data was read over serial
, but why???
logger
.
info
(
f
"
Didn
'
t receive data from arduino
, off1:
{
off1
}
, off2:
{
off2
}
, recv1:
{
recv1
}
, recv2:
{
recv2
}
"
,
exc_info
=
True
)
# may occur if no data was read over serial
logger
.
info
(
"
Didnt receive data from arduino
"
,
exc_info
=
True
)
if
time
.
time
()
-
last_write
>
delta_time
:
# write data
...
...
@@ -197,9 +189,6 @@ def main(config: Any) -> None:
fh
[
0
].
doRollover
()
# rollover the current data log file
Path
(
f
"
{
Path
(
__file__
).
parent
}
/data/data
"
).
unlink
(
missing_ok
=
True
)
# delete old data file
logger
.
warning
(
"
Finished
"
)
...
...
This diff is collapsed.
Click to expand it.
scripts/push.bash
+
13
−
7
View file @
c58bea19
...
...
@@ -6,22 +6,28 @@ while pidof -x "python3 main.py">/dev/null; do
echo
"python3 main.py is still running, checking in 60 seconds."
sleep
60
done
sleep
10
du
-hc
--max-depth
=
1
.
scripts/./write.bash
sleep
10
python3 measure.py
scripts/./write.bash
sleep
10
echo
-e
"Starting python script:
\n
"
python3 main.py
if
python3 main.py
then
rm
data/data
fi
echo
-e
"
\n
Python script ended"
git pull
last_commit_name
=
$(
git log
-1
--pretty
=
%B |
cat
)
if
[[
$string
==
*
"New data"
*
]]
;
then
# check if the last commit was "New data"
# if yes overwrite the commit
git reset
--soft
HEAD~1
fi
git add
.
git commit
-m
"New data"
&&
git push
--force
\ No newline at end of file
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