Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
stechuhr-client
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pandemic_Response
stechuhr-client
Commits
6a6ed4cb
Commit
6a6ed4cb
authored
4 years ago
by
David Huss
Browse files
Options
Downloads
Patches
Plain Diff
Read notes from config
parent
dbfbd539
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
stechuhr_client/client.py
+30
-29
30 additions, 29 deletions
stechuhr_client/client.py
with
30 additions
and
29 deletions
stechuhr_client/client.py
+
30
−
29
View file @
6a6ed4cb
...
...
@@ -78,6 +78,22 @@ success_on_time = "[0.05]"
[buzzer]
active = true
# Midi note numbers and lengths in seconds - played on startup
startup_notes = [69, 82, 72]
startup_note_lengths = [0.9, 0.25, 2.9]
startup_note_stop_lengths = [0.1, 0.25, 0.1]
# Midi note numbers and lengths in seconds - played on successful scan
success_notes = [69, 72, 69]
success_note_lengths = [0.9, 0.25, 0.9]
success_note_stop_lengths = [0.1, 0.25, 0.1]
# Midi note numbers and lengths in seconds - played on successful scan
failure_notes = [63, 61, 60, 59]
failure_note_lengths = [0.9, 0.25, 0.9, 1.0]
failure_note_stop_lengths = [0.1, 0.25, 0.1, 0.1]
[server]
address =
"
127.0.0.1
"
...
...
@@ -165,47 +181,32 @@ def dispatch_buzzer(state, config):
def
set_buzzer
(
state
,
config
):
global
buzzer_pin
f
=
8.175799
buzzer
=
GPIO
.
PWM
(
buzzer_pin
,
f
)
# Set frequency to 1 Khz
state
=
str
(
state
).
strip
().
lower
()
if
state
in
[
"
startup
"
,
"
ready
"
]:
f
=
1000
buzzer
=
GPIO
.
PWM
(
buzzer_pin
,
f
)
# Set frequency to 1 Khz
for
i
,
note
in
enumerate
(
config
[
"
buzzer
"
][
"
startup_notes
"
]):
buzzer
.
ChangeFrequency
((
1
+
note
)
*
0.083333333
*
f
)
# Set frequency to 1 Khz
buzzer
.
start
(
50
)
# Set dutycycle to 10
time
.
sleep
(
0.1
)
time
.
sleep
(
repeat
(
config
[
"
buzzer
"
][
"
startup_note_lengths
"
],
i
)
)
buzzer
.
stop
()
time
.
sleep
(
0.1
)
for
i
in
[
1
,
3
,
1
,
2
,
3
,
4
,
5
,
6
,
1
]:
buzzer
.
ChangeFrequency
((
1
+
i
)
*
0.083333333
*
f
)
# Set frequency to 1 Khz
buzzer
.
start
(
50
)
# Set dutycycle to 10
time
.
sleep
(
0.1
)
buzzer
.
stop
()
time
.
sleep
(
0.1
)
time
.
sleep
(
repeat
(
config
[
"
buzzer
"
][
"
startup_note_stop_lengths
"
],
i
))
elif
state
in
[
"
success
"
]:
f
=
1000
buzzer
=
GPIO
.
PWM
(
buzzer_pin
,
f
)
# Set frequency to 1 Khz
f
or
i
,
note
in
enumerate
(
config
[
"
buzzer
"
][
"
success_notes
"
]):
buzzer
.
ChangeFrequency
((
1
+
note
)
*
0.083333333
*
f
)
# Set frequency to 1 Khz
buzzer
.
start
(
50
)
# Set dutycycle to 10
time
.
sleep
(
0.1
)
time
.
sleep
(
repeat
(
config
[
"
buzzer
"
][
"
success_note_lengths
"
],
i
)
)
buzzer
.
stop
()
time
.
sleep
(
0.1
)
for
i
in
[
12
,
1
]:
buzzer
.
ChangeFrequency
((
1
+
i
)
*
0.083333333
*
f
)
# Set frequency to 1 Khz
buzzer
.
start
(
50
)
# Set dutycycle to 10
time
.
sleep
(
0.1
)
buzzer
.
stop
()
time
.
sleep
(
0.1
)
time
.
sleep
(
repeat
(
config
[
"
buzzer
"
][
"
success_note_stop_lengths
"
],
i
))
elif
state
in
[
"
failure
"
]:
f
=
1000
buzzer
=
GPIO
.
PWM
(
buzzer_pin
,
f
)
# Set frequency to 1 Khz
f
or
i
,
note
in
enumerate
(
config
[
"
buzzer
"
][
"
failure_notes
"
]):
buzzer
.
ChangeFrequency
((
1
+
note
)
*
0.083333333
*
f
)
# Set frequency to 1 Khz
buzzer
.
start
(
50
)
# Set dutycycle to 10
time
.
sleep
(
0.1
)
buzzer
.
stop
()
time
.
sleep
(
0.1
)
for
i
in
[
5
,
3
,
2
]:
buzzer
.
ChangeFrequency
((
1
+
i
)
*
0.083333333
*
f
)
# Set frequency to 1 Khz
buzzer
.
start
(
50
)
# Set dutycycle to 10
time
.
sleep
(
0.1
)
time
.
sleep
(
repeat
(
config
[
"
buzzer
"
][
"
failure_note_lengths
"
],
i
))
buzzer
.
stop
()
time
.
sleep
(
0.1
)
time
.
sleep
(
repeat
(
config
[
"
buzzer
"
][
"
failure_note_stop_lengths
"
],
i
)
)
def
process_request
(
output_queue
,
config
=
None
,
logger
=
None
):
...
...
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